Safe Haskell | None |
---|---|
Language | Haskell2010 |
- module Hydrogen.Parsing
- oneOf :: Stream s m Char => [Char] -> ParsecT s u m Char
- noneOf :: Stream s m Char => [Char] -> ParsecT s u m Char
- spaces :: Stream s m Char => ParsecT s u m ()
- space :: Stream s m Char => ParsecT s u m Char
- newline :: (Monad m, Stream s m Char) => ParsecT s u m Char
- tab :: Stream s m Char => ParsecT s u m Char
- upper :: Stream s m Char => ParsecT s u m Char
- lower :: Stream s m Char => ParsecT s u m Char
- alphaNum :: Stream s m Char => ParsecT s u m Char
- letter :: Stream s m Char => ParsecT s u m Char
- digit :: Stream s m Char => ParsecT s u m Char
- hexDigit :: Stream s m Char => ParsecT s u m Char
- char :: Stream s m Char => Char -> ParsecT s u m Char
- anyChar :: Stream s m Char => ParsecT s u m Char
- satisfy :: Stream s m Char => (Char -> Bool) -> ParsecT s u m Char
- string :: Stream s m Char => String -> ParsecT s u m String
- number :: (Monad m, Stream s m Char, Read a, Num a, Integral a) => ParsecT s u m a
- positiveNumber :: (Monad m, Stream s m Char, Read a, Num a, Integral a) => ParsecT s u m a
- negativeNumber :: (Monad m, Stream s m Char, Read a, Num a, Integral a) => ParsecT s u m a
- decimal :: (Monad m, Stream s m Char, Read a, Num a, RealFrac a) => ParsecT s u m a
- name :: (Monad m, Stream s m Char) => ParsecT s u m String
- name_ :: (Monad m, Stream s m Char) => ParsecT s u m String
- keyword :: (Monad m, Stream s m Char) => String -> ParsecT s u m String
- keyword_ :: (Monad m, Stream s m Char) => String -> ParsecT s u m ()
- between' :: (Monad m, Stream s m Char) => Char -> Char -> ParsecT s u m t -> ParsecT s u m t
Documentation
module Hydrogen.Parsing
oneOf :: Stream s m Char => [Char] -> ParsecT s u m Char
oneOf cs
succeeds if the current character is in the supplied
list of characters cs
. Returns the parsed character. See also
satisfy
.
vowel = oneOf "aeiou"
noneOf :: Stream s m Char => [Char] -> ParsecT s u m Char
As the dual of oneOf
, noneOf cs
succeeds if the current
character not in the supplied list of characters cs
. Returns the
parsed character.
consonant = noneOf "aeiou"
spaces :: Stream s m Char => ParsecT s u m ()
Skips zero or more white space characters. See also skipMany
.
space :: Stream s m Char => ParsecT s u m Char
Parses a white space character (any character which satisfies isSpace
)
Returns the parsed character.
newline :: (Monad m, Stream s m Char) => ParsecT s u m Char Source
Parses end of line, which maybe ('\n' or '\r' or "rn").
Returns the newline character, '\r' in case of "rn".
upper :: Stream s m Char => ParsecT s u m Char
Parses an upper case letter (a character between 'A' and 'Z'). Returns the parsed character.
lower :: Stream s m Char => ParsecT s u m Char
Parses a lower case character (a character between 'a' and 'z'). Returns the parsed character.
alphaNum :: Stream s m Char => ParsecT s u m Char
Parses a letter or digit (a character between '0' and '9'). Returns the parsed character.
letter :: Stream s m Char => ParsecT s u m Char
Parses a letter (an upper case or lower case character). Returns the parsed character.
hexDigit :: Stream s m Char => ParsecT s u m Char
Parses a hexadecimal digit (a digit or a letter between 'a' and 'f' or 'A' and 'F'). Returns the parsed character.
char :: Stream s m Char => Char -> ParsecT s u m Char
char c
parses a single character c
. Returns the parsed
character (i.e. c
).
semiColon = char ';'
anyChar :: Stream s m Char => ParsecT s u m Char
This parser succeeds for any character. Returns the parsed character.
satisfy :: Stream s m Char => (Char -> Bool) -> ParsecT s u m Char
The parser satisfy f
succeeds for any character for which the
supplied function f
returns True
. Returns the character that is
actually parsed.
string :: Stream s m Char => String -> ParsecT s u m String
string s
parses a sequence of characters given by s
. Returns
the parsed string (i.e. s
).
divOrMod = string "div" <|> string "mod"
number :: (Monad m, Stream s m Char, Read a, Num a, Integral a) => ParsecT s u m a Source
Parses a negative or a positive number (indicated by an unary minus operator, does not accept an unary plus).
positiveNumber :: (Monad m, Stream s m Char, Read a, Num a, Integral a) => ParsecT s u m a Source
Parses a positive integral number.
negativeNumber :: (Monad m, Stream s m Char, Read a, Num a, Integral a) => ParsecT s u m a Source
Parses a negative integral number (indicated by an unary minus operator).
decimal :: (Monad m, Stream s m Char, Read a, Num a, RealFrac a) => ParsecT s u m a Source
Parses a decimal number