Copyright | (c) Marcus Völker 2017 |
---|---|
License | MIT |
Maintainer | marcus.voelker@rwth-aachen.de |
Safe Haskell | Safe |
Language | Haskell2010 |
This module implements LParse's atomic parsers, i.e., parsers that are not built up from other parsers.
Synopsis
- noop :: Parser r t ()
- full :: Parser r [t] [t]
- discard :: Parser r [t] ()
- eoi :: Parser r [t] ()
- tokenParse :: TokenStream s => (t -> a) -> Parser r (s t) a
- tokenReturn :: TokenStream s => Parser r (s a) a
- consume :: (Eq t, Show (s t), TokenStream s) => s t -> Parser r (s t) ()
- consumeSingle :: (Eq t, Show t, TokenStream s) => t -> Parser r (s t) ()
- digit :: Parser r String Integer
- letter :: Parser r String Char
- word :: Parser r String String
- integer :: Parser r String Integer
- sInteger :: Parser r String Integer
- peek :: TokenStream s => (t -> Bool) -> String -> Parser r (s t) ()
- success :: (t -> (a, t)) -> Parser r t a
- bDigit :: Integer -> Parser r Integer Integer
- bDigits :: Integer -> Parser r Integer [Integer]
Documentation
discard :: Parser r [t] () Source #
A parser that consumes the whole input and discards it, successfully
eoi :: Parser r [t] () Source #
A parser that parses nothing, but only succeeds if the input is empty
tokenParse :: TokenStream s => (t -> a) -> Parser r (s t) a Source #
Extracts the first token from the input and applies the given function to it
tokenReturn :: TokenStream s => Parser r (s a) a Source #
Consumes and returns the first token of the input
consume :: (Eq t, Show (s t), TokenStream s) => s t -> Parser r (s t) () Source #
Succeeds exactly if the input begins with the given sequence. On success, consumes that sequence
consumeSingle :: (Eq t, Show t, TokenStream s) => t -> Parser r (s t) () Source #
Succeeds exactly if the input begins with the given token. On success, consumes that token
word :: Parser r String String Source #
Extracts the first word (i.e. contiguous string of letters) from the input and returns it
integer :: Parser r String Integer Source #
Extracts the first integer (i.e. contiguous string of digits) from the input and returns it
sInteger :: Parser r String Integer Source #
Extracts the first signed integer (i.e. contiguous string of digits) from the input and returns it
peek :: TokenStream s => (t -> Bool) -> String -> Parser r (s t) () Source #
Succeeds if the first token matches the given function, without consuming it
success :: (t -> (a, t)) -> Parser r t a Source #
A parser that always succeeds with the given function