MCPcopy Index your code
hub / github.com/python/cpython / parse_string

Function parse_string

Tools/peg_generator/pegen/testutil.py:48–55  ·  view source on GitHub ↗
(
    source: str, parser_class: type[Parser], *, dedent: bool = True, verbose: bool = False
)

Source from the content-addressed store, hash-verified

46
47
48def parse_string(
49 source: str, parser_class: type[Parser], *, dedent: bool = True, verbose: bool = False
50) -> Any:
51 # Run the parser on a string.
52 if dedent:
53 source = textwrap.dedent(source)
54 file = io.StringIO(source)
55 return run_parser(file, parser_class, verbose=verbose) # type: ignore[arg-type] # typeshed issue #3515
56
57
58def make_parser(source: str) -> type[Parser]:

Callers 15

test_parse_grammarMethod · 0.90
test_repeated_rulesMethod · 0.90
test_long_rule_strMethod · 0.90
test_typed_rulesMethod · 0.90
test_gatherMethod · 0.90
test_expr_grammarMethod · 0.90
test_optional_literalMethod · 0.90
test_repeat_0_simpleMethod · 0.90
test_repeat_0_complexMethod · 0.90
test_repeat_1_simpleMethod · 0.90

Calls 2

run_parserFunction · 0.85
dedentMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…