dotparse-0.1.0.0: dot language parsing and printing.
Safe HaskellSafe-Inferred
LanguageGHC2021

DotParse.FlatParse.TH

Description

TH stage restriction guff for flatparsing

Synopsis

Documentation

ws :: Parser e () Source #

Consume whitespace.

token :: Parser e a -> Parser e a Source #

Consume whitespace after running a parser.

lineComment :: Parser e () Source #

Parse a line comment.

multilineComment :: Parser e () Source #

Parse a potentially nested multiline comment.

htmlLike :: Parser e String Source #

Parse a HTML-Like string by counting the angle brackets

isValidStartChar :: Char -> Bool Source #

First character of a dot identifier.

isValidChar :: Char -> Bool Source #

character of a dot identifier.

identStartChar :: Parser e Char Source #

Read a starting character of an identifier.

identChar :: Parser e Char Source #

Read a non-starting character of an identifier.

symbol :: String -> Q Exp Source #

Parse a non-keyword string.

keyword :: String -> Q Exp Source #

Parse a keyword string.

symbol' :: String -> Q Exp Source #

Parser a non-keyword string, throw precise error on failure.

keyword' :: String -> Q Exp Source #

Parse a keyword string, throw precise error on failure.

ident :: Parser e ByteString Source #

Parse an identifier.

ident' :: Parser Error ByteString Source #

Parse an identifier, throw a precise error on failure.

data Error Source #

A parsing error.

Constructors

Precise Pos ByteString

A precisely known error, like leaving out "in" from "let".

Imprecise Pos [ByteString]

An imprecise error, when we expect a number of different things, but parse something else.

Instances

Instances details
Show Error Source # 
Instance details

Defined in DotParse.FlatParse.TH

Methods

showsPrec :: Int -> Error -> ShowS #

show :: Error -> String #

showList :: [Error] -> ShowS #

Eq Error Source # 
Instance details

Defined in DotParse.FlatParse.TH

Methods

(==) :: Error -> Error -> Bool #

(/=) :: Error -> Error -> Bool #

errorPos :: Error -> Pos Source #

position of error

merge :: Error -> Error -> Error Source #

Merge two errors. Inner errors (which were thrown at points with more consumed inputs) are preferred. If errors are thrown at identical input positions, we prefer precise errors to imprecise ones.

The point of prioritizing inner and precise errors is to suppress the deluge of "expected" items, and instead try to point to a concrete issue to fix.

prettyError :: ByteString -> Error -> ByteString Source #

Pretty print an error. The ByteString input is the source file. The offending line from the source is displayed in the output.

cut :: Parser Error a -> [ByteString] -> Parser Error a Source #

Imprecise cut: we slap a list of items on inner errors.

cut' :: Parser Error a -> ByteString -> Parser Error a Source #

Precise cut: we propagate at most a single error.