buildingmotif.label_parsing.parser#
Functions
|
Analyze the failures of a parser. |
|
Returns the first true value in the iterable. |
|
Parse the given target string using the given parser. |
|
Parse a list of strings using the given parser. |
|
Classes
|
|
|
- class ParseResult(tokens: List[buildingmotif.label_parsing.tokens.TokenResult], success: bool, _errors: List[str] = <factory>)[source]#
- tokens: List[TokenResult]#
- success: bool#
- property errors#
Return a list of errors and the offset into the string where the error occurred.
- analyze_failures(failures: Dict[str, List[TokenResult]])[source]#
Analyze the failures of a parser.
- parse_list(parser, target_list) Tuple[Dict[str, List[TokenResult]], Dict[str, List[TokenResult]]] [source]#
Parse a list of strings using the given parser.
- Parameters:
parser (Parser) – the parsing combinator function
target_list (List[str]) – the list of strings to parse
- Returns:
a tuple of the results and failures
- parse(parser: Parser, target: str) ParseResult [source]#
Parse the given target string using the given parser.
- Parameters:
parser (Parser) – the parsing combinator function
target (str) – the target string to parse
- Returns:
the result of the parser
- Return type: