Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data Result n t c
- = ParseError
- | ParseSuccess (ParsedResult n t c)
- data ParsedResult n t c = ParsedResult {
- prParseTree :: TreeSet n t c
- prAmbiguities :: [LocAmbiguity n t c]
- parse :: (Ord n, Ord t) => Grammar n t c -> n -> [c] -> Result n t c
- pparse :: (Ord n, Ord t) => Grammar n t c -> n -> [c] -> Pretty (Result n t c)
Documentation
Result of parse
.
ParseError | |
ParseSuccess (ParsedResult n t c) |
Instances
(PrettyPrint n, PrettyPrint c) => PrettyPrint (Result n t c) Source # | |
Defined in Little.Earley.Internal.Result prettyPrint :: Result n t c -> String Source # |
data ParsedResult n t c Source #
Successful result of parse
.
ParsedResult | |
|
pparse :: (Ord n, Ord t) => Grammar n t c -> n -> [c] -> Pretty (Result n t c) Source #
Wrapped parse
with a pretty-printed result. Use this in the REPL.
Example
pparse
arithG SUM "1+2*3"
Output:
+-----+--SUM #1---+ | | | SUM #0 | +PRODUCT #1-+ | | | | | PRODUCT #0 | PRODUCT #0 | | | | | | | FACTOR #0 | FACTOR #0 | FACTOR #0 | | | | | NUMBER #0 | NUMBER #0 | NUMBER #0 | | | | | ----------------------------------- 1 + 2 * 3