dasch / parser / Parser.Common

Common parsers that can be used in many contexts.

High Level Parsers

int : Parser Basics.Int

Matches an integer.

parse "42" int -- Ok 42

float : Parser Basics.Float

Matches a float.

parse "4.2" float -- Ok 4.2

word : Parser String

Matches a "word", comprised of alphanumeric characters and _.

parse "hello world" word -- Ok "hello"

Date & Time

iso8601 : Parser String

Matches valid ISO8601 datetimes.

Single-Character Parsers

alpha : Parser Char

Matches an alphabetic character.

alphaNum : Parser Char

Matches an alphanumeric character.

digit : Parser Char

Matches a digit, e.g. 8.

upper : Parser Char

Matches an uppercase alphabetic characters, e.g. A.

lower : Parser Char

Matches a lowercase alphabetic characters, e.g. z.

Whitespace

space : Parser Char

Matches the space character, ``.

tab : Parser Char

Matches the tab character, \t.

blank : Parser Char

Matches either a space or a tab.

blanks : Parser String

Matches zero or more blank characters.

newline : Parser Char

Matches a newline character.