(
src: str,
pos: Pos,
expect: str,
*,
error_on: frozenset[str],
error_on_eof: bool,
)
| 239 | |
| 240 | |
| 241 | def skip_until( |
| 242 | src: str, |
| 243 | pos: Pos, |
| 244 | expect: str, |
| 245 | *, |
| 246 | error_on: frozenset[str], |
| 247 | error_on_eof: bool, |
| 248 | ) -> Pos: |
| 249 | try: |
| 250 | new_pos = src.index(expect, pos) |
| 251 | except ValueError: |
| 252 | new_pos = len(src) |
| 253 | if error_on_eof: |
| 254 | raise suffixed_err(src, new_pos, f"Expected {expect!r}") from None |
| 255 | |
| 256 | if not error_on.isdisjoint(src[pos:new_pos]): |
| 257 | while src[pos] not in error_on: |
| 258 | pos += 1 |
| 259 | raise suffixed_err(src, pos, f"Found invalid character {src[pos]!r}") |
| 260 | return new_pos |
| 261 | |
| 262 | |
| 263 | def skip_comment(src: str, pos: Pos) -> Pos: |
no test coverage detected