pinchot-0.20.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 :: FoldableLL full Char => full -> Seq (Char, Loc) Source #

Takes any ListLike value based on Char (Seq, Text, String, etc.) and creates a Seq which pairs each Char with its location. Example: locatedFullParses.

noLocations :: FoldableLL full item => full -> Seq (item, ()) Source #

Breaks a ListLike into a Seq but does not assign locations.

locatedFullParses Source #

Arguments

:: FoldableLL full Char 
=> (forall r. Grammar r (Prod r String (Char, Loc) (p Char Loc)))

Earley grammar with production that you want to parse.

-> full

Source text, e.g. String, Text, etc.

-> ([p Char Loc], Report String (Seq (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.