Top-level functions for parselglossy.
parselglossy.grammars.lexer.
lex_from_str
(*, in_str: Union[str, pathlib.Path], grammar: str = 'standard', ir_file: Optional[Union[str, pathlib.Path]] = None) → Dict[str, Any][source]¶Run grammar of choice on input string.
in_str (Union[str, Path]) – The string to be parsed.
grammar (str) – Grammar to be used. Defaults to “standard”.
ir_file (Optional[Union[str, Path]]) – File to write intermediate representation to (JSON format). None by default, which means file is not written out.
The contents of the input string as a dictionary.
parselglossy.grammars.lexer.
parse_string_to_dict
(lexer, s: Union[str, pathlib.Path]) → Dict[str, Any][source]¶Helper function around parseString(s).asDict() that checks whether some keywords or sections were accidentally repeated and shadowing earlier keywords/sections.
lexer (JSONDict) – Nested dictionary
s (Union[str, Path]) – String to parse
tokes_dict – Dictionary of tokens
JSONDict