Safe Haskell | None |
---|---|
Language | Haskell2010 |
Parsing.
- data Report e i = Report {
- position :: Int
- expected :: [e]
- unconsumed :: i
- data Result s e i a
- type Parser e i a = forall s. i -> ST s (Result s e i a)
- parser :: ListLike i t => (forall r. Grammar r (Prod r e t a)) -> Parser e i a
- allParses :: Parser e i a -> i -> ([(a, Int)], Report e i)
- fullParses :: ListLike i t => Parser e i a -> i -> ([a], Report e i)
- report :: Parser e i a -> i -> Report e i
Documentation
A parsing report, which contains fields that are useful for presenting errors to the user if a parse is deemed a failure. Note however that we get a report even when we successfully parse something.
Report | |
|
The result of a parse.
Ended (Report e i) | The parser ended. |
Parsed (ST s [a]) Int i (ST s (Result s e i a)) | The parser parsed a number of |
parser :: ListLike i t => (forall r. Grammar r (Prod r e t a)) -> Parser e i a Source #
Create a parser from the given grammar.
allParses :: Parser e i a -> i -> ([(a, Int)], Report e i) Source #
Return all parses from the result of a given parser. The result may
contain partial parses. The Int
s are the position at which a result was
produced.
The elements of the returned list of results are sorted by their position in ascending order. If there are multiple results at the same position they are returned in an unspecified order.