(self, kind: str)
| 61 | return None |
| 62 | |
| 63 | def require(self, kind: str) -> Token: |
| 64 | # Return next token and advance position, requiring kind to match |
| 65 | tkn = self.next() |
| 66 | if tkn is not None and tkn.kind == kind: |
| 67 | return tkn |
| 68 | raise self.make_syntax_error( |
| 69 | f"Expected {kind!r} but got {tkn and tkn.text!r}", tkn |
| 70 | ) |
| 71 | |
| 72 | def consume_to(self, end: str) -> list[Token]: |
| 73 | res: list[Token] = [] |
no test coverage detected