Character parsers #
Parsers for character tokens. These work with any iterator of Char, such as CharIterator.
Character classes are ASCII only; Unicode classes are planned separately.
char c accepts and returns character c.
Equations
- ParseIt.Char.char c = ParseIt.withErrorMessage (toString "expected " ++ toString (repr c)) (ParseIt.token c)
Instances For
string s accepts the characters of s in order and returns s.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Parse space (U+0020).
Equations
- ParseIt.Char.space = ParseIt.withErrorMessage "expected space (U+0020)" (ParseIt.token ' ')
Instances For
Parse horizontal tab (U+0009).
Equations
- ParseIt.Char.tab = ParseIt.withErrorMessage "expected horizontal tab (U+0009)" (ParseIt.token '\t')
Instances For
Parse line feed (U+000A).
Equations
- ParseIt.Char.ASCII.lf = ParseIt.withErrorMessage "expected line feed (U+000A)" (ParseIt.token '\n')
Instances For
Parse carriage return (U+000D).
Equations
- ParseIt.Char.ASCII.cr = ParseIt.withErrorMessage "expected carriage return (U+000D)" (ParseIt.token '\x0d')
Instances For
Parse end of line: line feed, optionally preceded by carriage return.
Equations
- ParseIt.Char.eol = ParseIt.withErrorMessage "expected newline" (ParseIt.Char.ASCII.cr *> ParseIt.Char.ASCII.lf <|> ParseIt.Char.ASCII.lf)
Instances For
Parse whitespace character (space and U+0009 to U+000D).
Equations
- ParseIt.Char.ASCII.whitespace = ParseIt.withErrorMessage "expected whitespace character" (ParseIt.tokenFilter fun (c : Char) => c == ' ' || decide (c ≥ '\t') && decide (c ≤ '\x0d'))
Instances For
Parse uppercase letter character (A to Z).
Equations
- ParseIt.Char.ASCII.uppercase = ParseIt.withErrorMessage "expected uppercase letter character" (ParseIt.tokenFilter fun (c : Char) => decide (c ≥ 'A') && decide (c ≤ 'Z'))
Instances For
Parse lowercase letter character (a to z).
Equations
- ParseIt.Char.ASCII.lowercase = ParseIt.withErrorMessage "expected lowercase letter character" (ParseIt.tokenFilter fun (c : Char) => decide (c ≥ 'a') && decide (c ≤ 'z'))
Instances For
Parse alphabetic character (A to Z and a to z).
Equations
- One or more equations did not get rendered due to their size.
Instances For
Parse numeric character (0 to 9).
Equations
- ParseIt.Char.ASCII.numeric = ParseIt.withErrorMessage "expected decimal digit character" (ParseIt.tokenFilter fun (c : Char) => decide (c ≥ '0') && decide (c ≤ '9'))
Instances For
Parse letter or digit character (A to Z, a to z and 0 to 9).
Equations
- One or more equations did not get rendered due to their size.
Instances For
Parse control character (U+0000 to U+001F and U+007F).
Equations
- ParseIt.Char.ASCII.control = ParseIt.withErrorMessage "expected control character" (ParseIt.tokenFilter fun (c : Char) => decide (c.val < 32) || c.val == 127)
Instances For
Parse hexadecimal digit (0 to 9, A to F and a to f).
Equations
- One or more equations did not get rendered due to their size.