haste-compiler-0.4.4: Haskell To ECMAScript compiler

Safe HaskellSafe-Inferred
LanguageHaskell98

Haste.Parsing

Description

Home-grown parser, just because.

Synopsis

Documentation

char :: Char -> Parse Char Source

Require a specific character.

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

Parse a character that matches a given predicate.

string :: String -> Parse String Source

Require a specific string.

oneOf :: [Parse a] -> Parse a Source

Apply the first matching parser.

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

Invoke a parser with the possibility of failure.

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

Invoke a parser at least n times.

whitespace :: Parse String Source

Parse zero or more characters of whitespace.

word :: Parse String Source

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

words :: Parse [String] Source

Parse several words, separated by whitespace.

int :: Parse Int Source

Parse an Int.

double :: Parse Double Source

Parse a floating point number.

positiveDouble :: Parse Double Source

Parse a non-negative floating point number.

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

Fail on unwanted input.

quotedString :: Char -> Parse String Source

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 () Source

Skip n characters from the input.

rest :: Parse String Source

Read the rest of the input.

lookahead :: Parse a -> Parse a Source

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

anyChar :: Parse Char Source

Read one character. Fails if end of stream.