haste-compiler-0.4.2: Haskell To ECMAScript compiler

Safe HaskellSafe-Inferred

Haste.Parsing

Description

Home-grown parser, just because.

Synopsis

Documentation

char :: Char -> Parse CharSource

Require a specific character.

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

Parse a character that matches a given predicate.

string :: String -> Parse StringSource

Require a specific string.

oneOf :: [Parse a] -> Parse aSource

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 StringSource

Parse zero or more characters of whitespace.

word :: Parse StringSource

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 IntSource

Parse an Int.

double :: Parse DoubleSource

Parse a floating point number.

positiveDouble :: Parse DoubleSource

Parse a non-negative floating point number.

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

Fail on unwanted input.

quotedString :: Char -> Parse StringSource

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 StringSource

Read the rest of the input.

lookahead :: Parse a -> Parse aSource

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

anyChar :: Parse CharSource

Read one character. Fails if end of stream.