uu-parsinglib-2.9.1.1: Fast, online, error-correcting, monadic, applicative, merging, permuting, interleaving, idiomatic parser combinators.

Safe HaskellNone
LanguageHaskell98

Text.ParserCombinators.UU.Utils

Contents

Description

This module provides some higher-level types and infrastructure to make it easier to use.

Synopsis

Single-char parsers

pAnySym :: (IsLocationUpdatedBy loc Char, ListLike state Char) => String -> P (Str Char state loc) Char #

Whitespace and comments (comments - not yet supported)

Lexeme parsers (as opposed to Raw parsers)

lexeme :: ParserTrafo a a #

Lexeme Parsers skip trailing whitespace (this terminology comes from Parsec)

pSymbol :: (IsLocationUpdatedBy loc Char, ListLike state Char) => String -> P (Str Char state loc) String #

Raw parsers for numbers

Lexeme parsers for numbers

pNatural :: Num a => Parser a #

pInteger :: Num a => Parser a #

Parsers for Enums

pEnumRaw :: forall a. (Enum a, Show a) => Parser a #

pEnum :: (Enum a, Show a) => Parser a #

Parenthesized parsers

listParser :: ParserTrafo a [a] #

eg [1,2,3]

tupleParser :: ParserTrafo a [a] #

eg (1,2,3)

pTuple :: (IsLocationUpdatedBy loc Char, ListLike state Char) => [P (Str Char state loc) a] -> P (Str Char state loc) [a] #

Lexeme parsers for Date-s

pDayMonthYear :: (Num d, Num y) => Parser (d, Int, y) #

Lexeme parser for quoted String-s

Read-compatability

parserReadsPrec :: Parser a -> Int -> ReadS a #

Converts a UU Parser into a read-style one.

This is intended to facilitate migration from read-style parsers to UU-based ones.

Basic facility for runninga parser, getting at most a single error message

execParser :: Parser a -> String -> (a, [Error LineColPos]) #

The lower-level interface. Returns all errors.

runParser :: String -> Parser a -> String -> a #

The higher-level interface. (Calls error with a simplified error). Runs the parser; if the complete input is accepted without problems return the result else fail with reporting unconsumed tokens