htoml-1.0.0.1: Parser for TOML files

Safe HaskellNone
LanguageHaskell2010

Text.Toml.Parser

Contents

Synopsis

Documentation

type Parser a = forall s. Parsec Text s a Source

Our very own Parser type.

parseOnly :: Parsec Text (Set [Text]) a -> Text -> Either ParseError a Source

Convenience function for the test suite and GHCI.

tomlDoc :: Parsec Text (Set [Text]) Table Source

Parses a complete document formatted according to the TOML spec.

table :: Parser Table Source

Parses a table of key-value pairs.

inlineTable :: Parser Node Source

Parses an inline table of key-value pairs.

maybeDupe :: Ord a => [a] -> Maybe a Source

Find dupes, if any.

namedSection :: Parser ([Text], Node) Source

Parses a Table or TableArray with its header. The resulting tuple has the header's value in the first position, and the NTable or NTArray in the second.

tableHeader :: Parser [Text] Source

Parses a table header.

tableArrayHeader :: Parser [Text] Source

Parses a table array header.

headerValue :: Parser [Text] Source

Parses the value of any header (names separated by dots), into a list of Text.

assignment :: Parser (Text, Node) Source

Parses a key-value assignment.

value :: Parser Node Source

Parses a value.

array :: Parser Node Source

  • Toml value parsers

float :: Parser Node Source

Attoparsec double parses scientific "e" notation; reimplement according to Toml spec.

Utility functions

arrayOf :: Parser Node -> Parser Node Source

Parses the elements of an array, while restricting them to a certain type.

escSeq :: Parser Char Source

Parser for escape sequences.

unicodeHex :: Int -> Parser Char Source

Parser for unicode hexadecimal values of representation length n.

signed :: Num a => Parser a -> Parser a Source

Parser for signs (a plus or a minus).

skipBlanks :: Parser () Source

Parses the (rest of the) line including an EOF, whitespace and comments.

isSpc :: Char -> Bool Source

Results in True for whitespace chars, tab or space, according to spec.

eol :: Parser () Source

Parse an EOL, as per TOML spec this is 0x0A a.k.a. '\n' or 0x0D a.k.a. '\r'.