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

Function run_parser

Tools/peg_generator/pegen/testutil.py:38–45  ·  view source on GitHub ↗
(file: IO[bytes], parser_class: type[Parser], *, verbose: bool = False)

Source from the content-addressed store, hash-verified

36
37
38def run_parser(file: IO[bytes], parser_class: type[Parser], *, verbose: bool = False) -> Any:
39 # Run a parser on a file (stream).
40 tokenizer = Tokenizer(tokenize.generate_tokens(file.readline)) # type: ignore[arg-type] # typeshed issue #3515
41 parser = parser_class(tokenizer, verbose=verbose)
42 result = parser.start()
43 if result is None:
44 raise parser.make_syntax_error("invalid syntax")
45 return result
46
47
48def parse_string(

Callers 1

parse_stringFunction · 0.85

Calls 3

TokenizerClass · 0.90
startMethod · 0.45
make_syntax_errorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…