MissingH-1.2.0.2: Large utility library

Portabilityportable
Stabilityprovisional
MaintainerJohn Goerzen <jgoerzen@complete.org>
Safe HaskellNone

Text.ParserCombinators.Parsec.Utils

Contents

Description

Written by John Goerzen, jgoerzen@complete.org

Synopsis

Generalized Utilities

These functions are generalized versions of ones you might see in the Char parser.

togtok :: a -> GenParser b st (GeneralizedToken a)Source

Generate (return) a GeneralizedToken.

tokeng :: Show a => (a -> Maybe b) -> GeneralizedTokenParser a st bSource

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 aSource

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 aSource

Matches one item in a list and returns it.

noneOfg :: (Eq a, Show a) => [a] -> GeneralizedTokenParser a st aSource

Matches one item not in a list and returns it.

specificg :: (Eq a, Show a) => a -> GeneralizedTokenParser a st aSource

Matches one specific token and returns it.

allg :: Show a => GeneralizedTokenParser a st [a]Source

Matches all items and returns them

Other Utilities

notMatching :: GenParser a b c -> String -> GenParser a b ()Source

Running notMatching p msg will try to apply parser p. If it fails, returns (). If it succeds, cause a failure and raise the given error message. It will not consume input in either case.