haste-compiler-0.5.5.0: Haskell To ECMAScript compiler

Safe HaskellSafe
LanguageHaskell98

Haste.Parsing

Description

Home-grown parser, just because.

Synopsis

Documentation

char :: Char -> Parse Char

Require a specific character.

charP :: (Char -> Bool) -> Parse Char

Parse a character that matches a given predicate.

string :: String -> Parse String

Require a specific string.

oneOf :: [Parse a] -> Parse a

Apply the first matching parser.

possibly :: Parse a -> Parse (Maybe a)

Invoke a parser with the possibility of failure.

atLeast :: Int -> Parse a -> Parse [a]

Invoke a parser at least n times.

whitespace :: Parse String

Parse zero or more characters of whitespace.

word :: Parse String

Parse a non-empty word. A word is a string of at least one non-whitespace character.

words :: Parse [String]

Parse several words, separated by whitespace.

int :: Parse Int

Parse an Int.

double :: Parse Double

Parse a floating point number.

positiveDouble :: Parse Double

Parse a non-negative floating point number.

suchThat :: Parse a -> (a -> Bool) -> Parse a

Fail on unwanted input.

quotedString :: Char -> Parse String

A string quoted with the given quotation mark. Strings can contain escaped quotation marks; escape characters are stripped from the returned string.

skip :: Int -> Parse ()

Skip n characters from the input.

rest :: Parse String

Read the rest of the input.

lookahead :: Parse a -> Parse a

Run a parser with the current parsing state, but don't consume any input.

anyChar :: Parse Char

Read one character. Fails if end of stream.