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

Safe HaskellNone

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

Whitespace and comments (comments - not yet supported)

Lexeme parsers (as opposed to Raw parsers)

lexeme :: ParserTrafo a aSource

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

Raw parsers for numbers

Lexeme parsers for numbers

Parsers for Enums

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

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

Parenthesized parsers

listParser :: ParserTrafo a [a]Source

eg [1,2,3]

tupleParser :: ParserTrafo a [a]Source

eg (1,2,3)

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

Lexeme parsers for Date-s

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

Lexeme parser for quoted String-s

Read-compatability

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

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 :: ListLike state Char => P (Str Char state LineColPos) a -> state -> (a, [Error LineColPos])Source

The lower-level interface. Returns all errors.

runParser :: String -> P (Str Char String LineColPos) a -> String -> aSource

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