MCPcopy Index your code
hub / github.com/RustPython/RustPython / skip_until

Function skip_until

Lib/tomllib/_parser.py:314–333  ·  view source on GitHub ↗
(
    src: str,
    pos: Pos,
    expect: str,
    *,
    error_on: frozenset[str],
    error_on_eof: bool,
)

Source from the content-addressed store, hash-verified

312
313
314def skip_until(
315 src: str,
316 pos: Pos,
317 expect: str,
318 *,
319 error_on: frozenset[str],
320 error_on_eof: bool,
321) -> Pos:
322 try:
323 new_pos = src.index(expect, pos)
324 except ValueError:
325 new_pos = len(src)
326 if error_on_eof:
327 raise TOMLDecodeError(f"Expected {expect!r}", src, new_pos) from None
328
329 if not error_on.isdisjoint(src[pos:new_pos]):
330 while src[pos] not in error_on:
331 pos += 1
332 raise TOMLDecodeError(f"Found invalid character {src[pos]!r}", src, pos)
333 return new_pos
334
335
336def skip_comment(src: str, pos: Pos) -> Pos:

Callers 3

skip_commentFunction · 0.85
parse_literal_strFunction · 0.85
parse_multiline_strFunction · 0.85

Calls 4

lenFunction · 0.85
TOMLDecodeErrorClass · 0.85
indexMethod · 0.45
isdisjointMethod · 0.45

Tested by

no test coverage detected