pinchot-0.24.0.0: Write grammars, not parsers

Safe HaskellNone
LanguageHaskell2010

Pinchot.Locator

Synopsis

Documentation

advanceChar :: Char -> Loc -> Loc Source #

Advances the location for Char values. Tabs advance to the next eight-column tab stop; newlines advance to the next line and reset the column number to 1. All other characters advance the column by 1.

locations :: Traversable t => t Char -> t (Char, Loc) Source #

Adds locations to a list of characters.

noLocations :: Functor f => f a -> f (a, ()) Source #

Takes a list of tokens and assigns empty locations.

locatedFullParses Source #

Arguments

:: (forall r. Grammar r (Prod r String (Char, Loc) (p Char Loc)))

Earley grammar with production that you want to parse.

-> [Char]

Source text

-> ([p Char Loc], Report String [(Char, Loc)])

A list of successful parses that when to the end of the source string, along with the Earley report showing possible errors.

Obtains all full Earley parses from a given input string, after assigning a location to every Char. Example: address.