bibpy.parser module

Parsing functions using the funcparserlib library.

bibpy.parser.base_parser(validate_field, validate_entry)[source]

Return the base parser which all other parsers are based on.

The valid_fields and valid_entries arguments denote the allowable names for a grammar.

bibpy.parser.biblatex_parser()[source]

Return a parser for biblatex.

bibpy.parser.bibtex_parser()[source]

Return a parser for bibtex.

bibpy.parser.date_parser()[source]

Return a parser for biblatex dates.

bibpy.parser.delimited_list(element, separator)[source]

Create a parser of a list of delimited tokens.

bibpy.parser.enclosed(start, end, inner)[source]

Parse an enclosed expression and skip delimiters.

bibpy.parser.entry_query_parser()[source]

Return a parser for name queries.

bibpy.parser.field_query_parser()[source]

Return a parser for numeric queries.

Example queries: ‘1900-1995’ or ‘>= 1998’

bibpy.parser.flatten(lst)[source]

Flatten a list of an arbitrary depth.

bibpy.parser.full_delimited_list(element, separator)[source]

Create a parser of a list of delimited tokens, keeping delimiters.

bibpy.parser.get_duplicates(iterable)[source]

Find and return any duplicates in the iterable.

bibpy.parser.grammar_from_format(format)[source]

Return the grammar correspoding to the given format string.

bibpy.parser.if_token_type(token_type, pred)[source]

Return a parser that parses a token type for which a predicate holds.

bibpy.parser.is_comment_entry(token)[source]
bibpy.parser.is_preamble_entry(token)[source]
bibpy.parser.is_string_entry(token)[source]
bibpy.parser.join_string_expr(delimiter)[source]

Return a function that can join string expressions.

bibpy.parser.key_query_parser()[source]

Return a parser for key queries.

bibpy.parser.make_braced_expr(tokens)[source]

Make a braced expr from a recursive, nested list of tokens.

bibpy.parser.make_comment_entry(tokens)[source]

Make a comment entry from a list of parsed tokens.

bibpy.parser.make_date(tokens)[source]

Make a DateRange from a list of tokens.

bibpy.parser.make_entry(tokens)[source]

Make a bib entry from a list of parsed tokens.

bibpy.parser.make_field(tokens)[source]

Make a field from two tokens.

bibpy.parser.make_list(tokens)[source]

Make a list from the list of parsed tokens.

bibpy.parser.make_preamble_entry(tokens)[source]

Make a preamble entry from a list of parsed tokens.

bibpy.parser.make_query_result(query_type)[source]

Return a function that creates the result of a query.

bibpy.parser.make_string(token)[source]

Make a string from a token.

bibpy.parser.make_string_entry(tokens)[source]

Make a bib string entry from a list of parsed tokens.

bibpy.parser.mixed_parser()[source]

Return a mixed (bibtex/biblatex) parser.

bibpy.parser.parse(string, format, ignore_comments=True)[source]

Parse string using a given reference format.

bibpy.parser.parse_braced_expr(expr)[source]

Parse a braced string and return its tokens.

bibpy.parser.parse_date(datestring)[source]

Parse a biblatex date.

bibpy.parser.parse_file(source, format, ignore_comments=True)[source]

Parse a file using a given reference format.

bibpy.parser.parse_name(name)[source]

Parse a name, such as an author.

bibpy.parser.parse_query(query, query_type)[source]

Parse a query and return the operator and value.

E.g. ‘~Author’ is parsed as (‘~’, ‘Author’)

bibpy.parser.parse_string_expr(expr)[source]

Parse a bibtex string expression.

bibpy.parser.prefix_indices(parts)[source]

Find the indices for a name prefix (‘von’ part) in a list of tokens.

bibpy.parser.relaxed_parser()[source]

Return a grammar for a relaxed parser.

bibpy.parser.remove_outer_braces(braced_expr)[source]

Remove the outer braces from a braced expression.

bibpy.parser.simple_entry(content, matcher, producer)[source]
bibpy.parser.skip(s)[source]

Parse and skip a specific token type.

bibpy.parser.token_type(token_type)[source]

Match a given token type and return its value.

bibpy.parser.token_value(token)[source]

Get the value from a token.