Copyright | Copyright (C) 2004-2011 John Goerzen |
---|---|
License | BSD-3-Clause |
Stability | provisional |
Portability | portable |
Safe Haskell | Safe |
Language | Haskell2010 |
Written by John Goerzen, jgoerzen@complete.org
Synopsis
- type GeneralizedToken a = (SourcePos, a)
- type GeneralizedTokenParser a st b = GenParser (GeneralizedToken a) st b
- togtok :: a -> GenParser b st (GeneralizedToken a)
- tokeng :: Show a => (a -> Maybe b) -> GeneralizedTokenParser a st b
- satisfyg :: Show a => (a -> Bool) -> GeneralizedTokenParser a st a
- oneOfg :: (Eq a, Show a) => [a] -> GeneralizedTokenParser a st a
- noneOfg :: (Eq a, Show a) => [a] -> GeneralizedTokenParser a st a
- specificg :: (Eq a, Show a) => a -> GeneralizedTokenParser a st a
- allg :: Show a => GeneralizedTokenParser a st [a]
- notMatching :: GenParser a b c -> String -> GenParser a b ()
Generalized Utilities
These functions are generalized versions of ones you might see in the Char parser.
type GeneralizedToken a = (SourcePos, a) Source #
type GeneralizedTokenParser a st b = GenParser (GeneralizedToken a) st b Source #
togtok :: a -> GenParser b st (GeneralizedToken a) Source #
Generate (return) a GeneralizedToken
.
tokeng :: Show a => (a -> Maybe b) -> GeneralizedTokenParser a st b Source #
Retrieve the next token from a GeneralizedToken
stream.
The given function should return the value to use, or Nothing
to cause an error.
satisfyg :: Show a => (a -> Bool) -> GeneralizedTokenParser a st a Source #
A shortcut to tokeng
; the test here is just a function that returns
a Bool. If the result is true; return that value -- otherwise, an error.
oneOfg :: (Eq a, Show a) => [a] -> GeneralizedTokenParser a st a Source #
Matches one item in a list and returns it.
noneOfg :: (Eq a, Show a) => [a] -> GeneralizedTokenParser a st a Source #
Matches one item not in a list and returns it.
specificg :: (Eq a, Show a) => a -> GeneralizedTokenParser a st a Source #
Matches one specific token and returns it.
allg :: Show a => GeneralizedTokenParser a st [a] Source #
Matches all items and returns them