UTF-8 Character parsers #
Consume a single byte.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Consume a single UTF-8 character.
Equations
Instances For
Match a specific character.
Equations
- Parser.Utf8.char c = Parser.skipSatisfy fun (x : Char) => x == c
Instances For
Match an exact non-empty string
Equations
- Parser.Utf8.string str h = match s : str.toList with | [] => ⋯.elim | c :: cs => Parser.Utf8.string.go c cs
Instances For
Equations
- Parser.Utf8.string.go c [] = Parser.skipSatisfy fun (x : Char) => x == c
- Parser.Utf8.string.go c (c' :: cs) = (Parser.skipSatisfy fun (x : Char) => x == c) >>=ᵍ fun (__r : Unit) => Parser.Utf8.string.go c' cs
Instances For
Consume characters while f holds, returning the collected string.
Equations
Instances For
Consume one or more characters while f holds.
Equations
Instances For
Skip characters while f holds.
Equations
Instances For
Skip one or more characters while f holds.
Equations
Instances For
skipWhile1 fails exactly as takeWhile1 does.
Skip zero or more whitespace characters.
Instances For
Skip one or more whitespace characters.
Instances For
Run p then skip trailing whitespace.
Equations
- Parser.Utf8.lexeme p = gcast ⋯ (p >>=ᵍ fun (r : α) => Parser.Utf8.whitespace >>=ᵍ fun (__r : Unit) => gpure r)
Instances For
Equations
Instances For
Equations
Instances For
Equations
Instances For
Equations
Instances For
Equations
Instances For
Equations
Instances For
Equations
Instances For
Equations
Instances For
Parse p surrounded by the delimiters l and r. Delimiters consume whitespace after them.
Equations
- Parser.Utf8.bracket l r p = Parser.rawBracket (Parser.Utf8.lexeme l) (Parser.Utf8.lexeme r) p
Instances For
Parse p surrounded by parentheses.
Instances For
Parse p surrounded by square brackets.
Instances For
Parse p surrounded by curly braces.
Instances For
Parse a single decimal digit, returning its numeric value.
Equations
Instances For
Parse a natural number (one or more digits).
Equations
- Parser.Utf8.nat = Parser.Utf8.digit >>=ᵍ fun (d : ℕ) => Parser.many Parser.Utf8.digit >>=ᵍ fun (ds : List ℕ) => gpure (List.foldl (fun (acc d : ℕ) => acc * 10 + d) d ds)
Instances For
Parse an integer (optional leading - followed by digits).
Equations
- Parser.Utf8.int = Parser.optional (Parser.Utf8.char '-') >>=ᵍ fun (neg : Option PUnit.{1}) => Parser.Utf8.nat >>=ᵍ fun (n : ℕ) => gpure (if neg.isSome = true then -↑n else ↑n)
Instances For
Equations
- Parser.Utf8.space = Parser.skipSatisfy fun (x : Char) => x == ' '
Instances For
Equations
- Parser.Utf8.tab = Parser.skipSatisfy fun (x : Char) => x == '\t'
Instances For
Equations
- Parser.Utf8.ASCII.lf = Parser.skipSatisfy fun (x : Char) => x == '\n'
Instances For
Equations
- Parser.Utf8.ASCII.cr = Parser.skipSatisfy fun (x : Char) => x == '\x0d'
Instances For
Match an ASCII uppercase letter.
Instances For
Match an ASCII lowercase letter.
Instances For
Match an ASCII letter.
Instances For
Match an ASCII letter or digit.
Instances For
Match an ASCII control character.
Equations
- Parser.Utf8.ASCII.control = Parser.satisfy fun (c : Char) => decide (c.val < 32) || c.val == 127
Instances For
Match a binary digit.
Equations
- Parser.Utf8.ASCII.binDigit = Parser.token fun (x : Char) => match x with | '0' => some false | '1' => some true | x => none
Instances For
Match an octal digit, returning its numeric value.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Match a hexadecimal digit, returning its numeric value.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Match a line terminator: LF or CRLF.
Equations
- Parser.Utf8.eol = Parser.skipOptional Parser.Utf8.ASCII.cr >>=ᵍ fun (__r : Unit) => Parser.Utf8.ASCII.lf