bibtex- Parse, format and processing BibTeX files

Safe HaskellSafe



The parsers in this module also skip trailing spaces.



file :: Parser [T] Source

Beware that this and all other parsers do not accept leading spaces, cf. skippingSpace. That is when encountering leading white spaces the parser will just return an empty list. If you want to parse a file that contains entirely of BibTeX data you better call skippingLeadingSpace file instead. However, the file parser is more combinable and can be used for files that contain both BibTeX and other data or it can be used for automated filetype checking.

entry :: Parser T Source

Parse a BibTeX entry like

  author = {Firstname Surname},
  title = {Title},
  year = 2010,
  month = jul,


assignment :: Parser (String, String) Source

Parse an assignment like

author = {Firstname Surname}


value :: Parser String Source

Parse a value like





{Firstname Surname}


"Firstname Surname"


texSequence :: Char -> Parser String Source

Parse a sequence of texBlocks until the occurrence of a closing character. The closing character is not part of the result.

texBlock :: Char -> Parser String Source

Parse a single character like a, a LaTeX macro call like \alpha or a block enclosed in curly braces like {\"{a}bc}.

bibIdentifier :: Parser String Source

Parse a name of a BibTeX entry like author2010title.

skippingSpace :: Parser a -> Parser a Source

Extends a parser, such that all trailing spaces are skipped. It might be more comfortable to skip all leading spaces, but parser written that way are hard to combine. This is so, since if you run two parsers in parallel and both of them expect leading spaces, then the parser combinator does not know which one of the parallel parsers to choose.

See also: lexeme.

splitCommaSepList :: String -> [String] Source

Split a string at the commas and remove leading spaces.

splitAuthorList :: String -> [String] Source

Split a string containing a list of authors in BibTeX notation.