bibtex- Parse, format and processing BibTeX files

Safe HaskellSafe-Inferred



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 TSource

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 StringSource

Parse a value like





 {Firstname Surname}


 "Firstname Surname"


texSequence :: Char -> Parser StringSource

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

texBlock :: Char -> Parser StringSource

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

bibIdentifier :: Parser StringSource

Parse a name of a BibTeX entry like author2010title.

skippingSpace :: Parser a -> Parser aSource

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.