MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / skip_until

Function skip_until

tools/python-3.11.9-amd64/Lib/tomllib/_parser.py:241–260  ·  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

239
240
241def 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
263def skip_comment(src: str, pos: Pos) -> Pos:

Callers 3

skip_commentFunction · 0.70
parse_literal_strFunction · 0.70
parse_multiline_strFunction · 0.70

Calls 3

suffixed_errFunction · 0.70
indexMethod · 0.45
isdisjointMethod · 0.45

Tested by

no test coverage detected