buildingmotif.label_parsing#

class Parser(*args, **kwargs)[source]#
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

results_to_tokens(results)[source]#
class Token(value: Any)[source]#
value: Any#
class TokenResult(value: Optional[str], token: Token, length: int, error: Optional[str] = None)[source]#

A token result. Contains a token, the type of the token, the length of the token, and a possible error.

value: Optional[str]#
token: Token#
length: int#
error: Optional[str] = None#
class Identifier(value: str)[source]#

An identifier token. Contains a string.

value: str#
class Constant(value: URIRef)[source]#

A constant token. Contains a URI, probably some sort of Class

value: URIRef#
class Delimiter(value: str)[source]#

A delimiter token.

value: str#
class Null(value: None = None)[source]#

A null token.

value: None = None#

Modules

buildingmotif.label_parsing.combinators

buildingmotif.label_parsing.parser

buildingmotif.label_parsing.tokens