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

Function parse_key_part

Lib/tomllib/_parser.py:468–481  ·  view source on GitHub ↗
(src: str, pos: Pos)

Source from the content-addressed store, hash-verified

466
467
468def parse_key_part(src: str, pos: Pos) -> tuple[Pos, str]:
469 try:
470 char: str | None = src[pos]
471 except IndexError:
472 char = None
473 if char in BARE_KEY_CHARS:
474 start_pos = pos
475 pos = skip_chars(src, pos, BARE_KEY_CHARS)
476 return pos, src[start_pos:pos]
477 if char == "'":
478 return parse_literal_str(src, pos)
479 if char == '"':
480 return parse_one_line_basic_str(src, pos)
481 raise TOMLDecodeError("Invalid initial character for a key part", src, pos)
482
483
484def parse_one_line_basic_str(src: str, pos: Pos) -> tuple[Pos, str]:

Callers 1

parse_keyFunction · 0.85

Calls 4

skip_charsFunction · 0.85
parse_literal_strFunction · 0.85
parse_one_line_basic_strFunction · 0.85
TOMLDecodeErrorClass · 0.85

Tested by

no test coverage detected