(self, end: str)
| 70 | ) |
| 71 | |
| 72 | def consume_to(self, end: str) -> list[Token]: |
| 73 | res: list[Token] = [] |
| 74 | parens = 0 |
| 75 | while tkn := self.next(raw=True): |
| 76 | res.append(tkn) |
| 77 | if tkn.kind == end and parens == 0: |
| 78 | return res |
| 79 | if tkn.kind == "LPAREN": |
| 80 | parens += 1 |
| 81 | if tkn.kind == "RPAREN": |
| 82 | parens -= 1 |
| 83 | raise self.make_syntax_error( |
| 84 | f"Expected {end!r} but reached EOF", tkn) |
| 85 | |
| 86 | def extract_line(self, lineno: int) -> str: |
| 87 | # Return source line `lineno` (1-based) |
no test coverage detected