hectoparsec-0.1.0.0: Flexible and powerful parser combinators
Copyright(c) comp 2020
LicenseMIT
Maintaineronecomputer00@gmail.com
Stabilitystable
Portabilityportable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Hectoparsec.Debug

Description

Combinators and functions for debugging ParserT.

Synopsis

Re-exports

Debug combinators

pdbg :: (Stream s, Show (Token s), Show (Chunk s), Show e, Show l, Show a) => String -> ParserT s e l m a -> ParserT s e l m a Source #

Wraps a parser with trace for debugging, showing the parser state before and after the parser.

A parser can either consume or not consume tokens, and it can succeed with a parsed value or fail with an error.

(<??>) :: (Stream s, Show (Token s), Show (Chunk s), Show e, Show l, Show a) => ParserT s e l m a -> String -> ParserT s e l m a infix 0 Source #

Infix version of flip pdbg.

Debug printers

parseTest :: (Show (Token s), Show (Chunk s), Show e, Show l, Show a) => Parser s e l a -> s -> IO () Source #

Runs a parser and prints the output or error to the console.

fmtP :: (Show (Token s), Show (Chunk s), Show e, Show l, Show a) => Either (ParseError s e l) a -> String Source #

Formats the result of running a parser for debugging purposes.

fmtE :: (Show (Token s), Show (Chunk s), Show e, Show l) => ParseError s e l -> String Source #

Formats the errors from a parser for debugging purposes.