(self, type: TokenType, *, reject: bool = False)
| 108 | yield Token(TokenType.EOF, "", pos) |
| 109 | |
| 110 | def accept(self, type: TokenType, *, reject: bool = False) -> Optional[Token]: |
| 111 | if self.current.type is type: |
| 112 | token = self.current |
| 113 | if token.type is not TokenType.EOF: |
| 114 | self.current = next(self.tokens) |
| 115 | return token |
| 116 | if reject: |
| 117 | self.reject((type,)) |
| 118 | return None |
| 119 | |
| 120 | def reject(self, expected: Sequence[TokenType]) -> "NoReturn": |
| 121 | raise ParseError( |
no test coverage detected