trifecta-0.43: A modern parser combinator library with convenient diagnostics

Portabilitynon-portable
Stabilityprovisional
Maintainerekmett@gmail.com

Text.Trifecta.Parser.Token.Prim

Description

 

Synopsis

Documentation

charLiteral' :: MonadParser m => m CharSource

This parser parses a single literal character. Returns the literal character value. This parsers deals correctly with escape sequences. The literal character is parsed according to the grammar rules defined in the Haskell report (which matches most programming languages quite closely).

This parser does NOT swallow trailing whitespace.

stringLiteral' :: MonadParser m => m StringSource

This parser parses a literal string. Returns the literal string value. This parsers deals correctly with escape sequences and gaps. The literal string is parsed according to the grammar rules defined in the Haskell report (which matches most programming languages quite closely).

This parser does NOT swallow trailing whitespace

natural' :: MonadParser m => m IntegerSource

This parser parses a natural number (a positive whole number). Returns the value of the number. The number can be specified in decimal, hexadecimal or octal. The number is parsed according to the grammar rules in the Haskell report.

This parser does NOT swallow trailing whitespace.

integer' :: MonadParser m => m IntegerSource

This parser parses an integer (a whole number). This parser is like natural except that it can be prefixed with sign (i.e. '-' or '+'). Returns the value of the number. The number can be specified in decimal, hexadecimal or octal. The number is parsed according to the grammar rules in the Haskell report.

This parser does NOT swallow trailing whitespace.

Also, unlike the integer parser, this parser does not admit spaces between the sign and the number.

double' :: MonadParser m => m DoubleSource

This parser parses a floating point value. Returns the value of the number. The number is parsed according to the grammar rules defined in the Haskell report.

This parser does NOT swallow trailing whitespace.

naturalOrDouble' :: MonadParser m => m (Either Integer Double)Source

This parser parses either natural or a double. Returns the value of the number. This parsers deals with any overlap in the grammar rules for naturals and floats. The number is parsed according to the grammar rules defined in the Haskell report.

This parser does NOT swallow trailing whitespace.

decimal :: MonadParser m => m IntegerSource

Parses a positive whole number in the decimal system. Returns the value of the number.

hexadecimal :: MonadParser m => m IntegerSource

Parses a positive whole number in the hexadecimal system. The number should be prefixed with "x" or "X". Returns the value of the number.

octal :: MonadParser m => m IntegerSource

Parses a positive whole number in the octal system. The number should be prefixed with "o" or "O". Returns the value of the number.