(s: Scanner)
| 159 | |
| 160 | |
| 161 | def not_expr(s: Scanner) -> ast.expr: |
| 162 | if s.accept(TokenType.NOT): |
| 163 | return ast.UnaryOp(ast.Not(), not_expr(s)) |
| 164 | if s.accept(TokenType.LPAREN): |
| 165 | ret = expr(s) |
| 166 | s.accept(TokenType.RPAREN, reject=True) |
| 167 | return ret |
| 168 | ident = s.accept(TokenType.IDENT) |
| 169 | if ident: |
| 170 | return ast.Name(IDENT_PREFIX + ident.value, ast.Load()) |
| 171 | s.reject((TokenType.NOT, TokenType.LPAREN, TokenType.IDENT)) |
| 172 | |
| 173 | |
| 174 | class MatcherAdapter(Mapping[str, bool]): |