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 Source

Whitespace and comments (comments - not yet supported)

Lexeme parsers (as opposed to Raw parsers)

lexeme :: ParserTrafo a a Source

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 a Source

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

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 a Source

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]) Source

The lower-level interface. Returns all errors.

runParser :: String -> Parser a -> String -> a Source

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