Generates a new TokenParser or SymbolParser that will chain parsers together one after the other unconditionally
in the order specified.
It will optionally execute some action on semantic data values returned by parsers
and return the semantic value returned by action.
At least one parser must be passed.
If at least one of the parsers fail, the ParseError will be returned and action
will not be executed.
If the ParseError needs to be handled, the chain parser can always be nested
in a map parser.
It can be used where there are multiple chains to be done at once, (ex: at grammar rules).
It is actually a simple fold operation on the chain parser with an optional action
on the end of them.
It is suggested in cases where chain nesting is used:
Generates a new TokenParser or SymbolParser that will chain
parsers
together one after the other unconditionally in the order specified. It will optionally execute someaction
on semantic data values returned byparsers
and return the semantic value returned byaction
. At least one parser must be passed. If at least one of theparsers
fail, the ParseError will be returned andaction
will not be executed. If the ParseError needs to be handled, the chain parser can always be nested in a map parser.It can be used where there are multiple chains to be done at once, (ex: at grammar rules). It is actually a simple fold operation on the chain parser with an optional
action
on the end of them.It is suggested in cases where chain nesting is used:
The
action
is made to simulate Bison's "actions" and can be used to define an Abstract Syntax Tree (AST) for the input by changing the semantic data.Returns
A new TokenParser or SymbolParser that will chain
parsers
and execute them along with an optionalaction
at the end of the chain.See