Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell98 |
The parsers in this module also skip trailing spaces.
Synopsis
- file :: Parser [T]
- comment :: Parser String
- entry :: Parser T
- assignment :: Parser (String, String)
- value :: Parser String
- texSequence :: Char -> Parser String
- texBlock :: Char -> Parser String
- identifier :: CharParser st String
- bibIdentifier :: Parser String
- skippingSpace :: Parser a -> Parser a
- skippingLeadingSpace :: Parser a -> Parser a
- splitCommaSepList :: String -> [String]
- splitAuthorList :: String -> [String]
- splitSepList :: Char -> String -> [String]
Documentation
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.
Parse a BibTeX entry like
@article{author2010title, author = {Firstname Surname}, title = {Title}, year = 2010, month = jul, }
.
value :: Parser String Source #
Parse a value like
jul
or
2010
or
{Firstname Surname}
or
"Firstname Surname"
.
texSequence :: Char -> Parser String Source #
Parse a sequence of texBlock
s 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}
.
identifier :: CharParser st String Source #
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
.
skippingLeadingSpace :: Parser a -> Parser a Source #
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.