Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- char :: e -> Char -> Parser e s ()
- char2 :: e -> Char -> Char -> Parser e s ()
- char3 :: e -> Char -> Char -> Char -> Parser e s ()
- char4 :: e -> Char -> Char -> Char -> Char -> Parser e s ()
- any :: e -> Parser e s Char
- any# :: e -> Parser e s Char#
- peek :: e -> Parser e s Char
- opt :: e -> Parser e s (Maybe Char)
- shortTrailedBy :: e -> Char -> Parser e s ShortText
- skipDigits :: Parser e s ()
- skipDigits1 :: e -> Parser e s ()
- skipChar :: Char -> Parser e s ()
- skipChar1 :: e -> Char -> Parser e s ()
- skipAlpha :: Parser e s ()
- skipAlpha1 :: e -> Parser e s ()
- skipTrailedBy :: e -> Char -> Parser e s ()
- decWord :: e -> Parser e s Word
- decWord8 :: e -> Parser e s Word8
- decWord16 :: e -> Parser e s Word16
- decWord32 :: e -> Parser e s Word32
Matching
char :: e -> Char -> Parser e s () Source #
Consume the next character, failing if it does not match the expected value or if there is no more input.
char2 :: e -> Char -> Char -> Parser e s () Source #
Consume the next two characters, failing if they do not match they expected values.
char2 e a b === char e a *> char e b
char3 :: e -> Char -> Char -> Char -> Parser e s () Source #
Consume the three characters, failing if they do not match they expected values.
char3 e a b c === char e a *> char e b *> char e c
char4 :: e -> Char -> Char -> Char -> Char -> Parser e s () Source #
Consume the four characters, failing if they do not match they expected values.
char4 e a b c d === char e a *> char e b *> char e c *> char e d
Get Character
peek :: e -> Parser e s Char Source #
Examine the next byte without consuming it, interpret it as an
ASCII-encoded character. This fails if the byte is above 0x7F
or
if the end of input has been reached.
opt :: e -> Parser e s (Maybe Char) Source #
Consume the next byte, interpreting it as an ASCII-encoded character.
Fails if the byte is above 0x7F
. Returns Nothing
if the
end of the input has been reached.
Match Many
shortTrailedBy :: e -> Char -> Parser e s ShortText Source #
Consume input through the next occurrence of the target
character and return the consumed input, excluding the
target character, as a ShortText
. This fails if it
encounters any bytes above 0x7F
.
Skip
skipDigits :: Parser e s () Source #
Skip the characters 0-9
until a non-digit is encountered.
This parser does not fail.
skipDigits1 :: e -> Parser e s () Source #
Variant of skipDigits
that requires at least one digit
to be present.
skipChar :: Char -> Parser e s () Source #
Skip the character any number of times. This succeeds even if the character was not present.
skipChar1 :: e -> Char -> Parser e s () Source #
Skip the character any number of times. It must occur at least once or else this will fail.
skipAlpha :: Parser e s () Source #
Skip uppercase and lowercase letters until a non-alpha character is encountered.
skipAlpha1 :: e -> Parser e s () Source #
Skip uppercase and lowercase letters until a non-alpha character is encountered.
skipTrailedBy :: e -> Char -> Parser e s () Source #
Consume input until the trailer is found. Then, consume the trailer as well. This fails if the trailer is not found or if any non-ASCII characters are encountered.
Numbers
decWord :: e -> Parser e s Word Source #
Parse a decimal-encoded number. If the number is too large to be represented by a machine word, this fails with the provided error message. This accepts any number of leading zeroes.
decWord8 :: e -> Parser e s Word8 Source #
Parse a decimal-encoded 8-bit word. If the number is larger than 255, this parser fails.