parselglossy.grammars.lexer module

Top-level functions for parselglossy.

parselglossy.grammars.lexer.dispatch_grammar(grammar: str)[source]
parselglossy.grammars.lexer.lex_from_str(*, in_str: IO[Any], grammar: str = 'standard', ir_file: Union[str, pathlib.Path, None] = None) → Dict[str, Any][source]

Run grammar of choice on input string.

Parameters:
  • in_str (IO[Any]) – The string to be parsed.
  • grammar (str) – Grammar to be used. Defaults to “standard”.
  • ir_file (Union[str, Path]) – File to write intermediate representation to (JSON format). None by default, which means file is not written out.
Returns:

Return type:

The contents of the input string as a dictionary.

Raises:

ParselglossyError