lasercutter-0.1.0.0: A high-powered, single-pass tree parser.
Safe HaskellNone
LanguageHaskell2010

Lasercutter.Internal

Synopsis

Documentation

split :: bc -> Parser bc t a -> t -> Split bc t a Source #

Split a parser into a parser to run on the node's children, and how to reassemble those pieces into a parser for the current node.

Since: 0.1.0.0

ignoreChildren :: Parser bc t b -> Split bc t b Source #

There is no work to do for the children, so ignore them.

Since: 0.1.0.0

continue :: (Parser bc t a -> Parser bc t b) -> Split bc t a -> Split bc t b Source #

Append a continuation after a Split.

Since: 0.1.0.0

parseNode :: (Semigroup bc, IsTree t) => (t -> bc) -> bc -> Parser bc t a -> t -> Parser bc t a Source #

Parse the current node by splitting the parser, accumulating the results of each child, and then running the continuation.

Since: 0.1.0.0

parseChildren :: (IsTree t, Semigroup bc) => (t -> bc) -> bc -> Parser bc t a -> [t] -> [a] Source #

Run a parser on each child, accumulating the results.

Since: 0.1.0.0

getResult :: Parser bc t a -> Maybe a Source #

Extract a value from a parser. The way the applicative evaluates, all "combinator" effects are guaranteed to have been run by the time this function gets called.

Since: 0.1.0.0

runParser Source #

Arguments

:: (Monoid bc, IsTree t) 
=> (t -> bc)

A means of summarizing the current node for tracking breadcrumbs. If you don't need breadcrumbs, use const ().

-> t

The tree to parse.

-> Parser bc t a

How to parse the tree.

-> Maybe a 

Run a parser over a tree in a single pass.

Since: 0.1.0.0

mapBreadcrumbs :: (bc' -> bc) -> Parser bc t a -> Parser bc' t a Source #

Transformer the breadcrumbs of a Parser.

Since: 0.1.0.0