Causes this handler to finalize and produce a result.
Causes this handler to finalize and produce a result.
This method should not be called if isFinished
is already true.
The final output of this parser
Causes this handler to process an error.
Causes this handler to process an error.
This method should not be called if isFinished == true
an error to be processed
An option containing the final output if
this handler became finished as a result
of processing the error
, or None
if
the handler is ready for more input.
Causes this handler to process an input element.
Causes this handler to process an input element.
This method should not be called if isFinished == true
An option containing the final output if
this handler became finished as a result
of processing the input
, or None
if
the handler is ready for more input.
Tells if this handler is finished.
Tells if this handler is finished.
If a handler is finished, its handleX
methods
should no longer be called. Doing so after the
handler finishes will cause undefined behavior.
Typically a handler should be discarded once it
is finished.
whether this handler is finished
Handler that forwards inputs to a first handler until that handler yields a result, at which point the result is used to create a second handler, to which all further inputs are forwarded until it yields a result.
Before the second handler is generated, the input "stack" is tracked so that it can be replayed to the second handler (so that it can acquire the correct context even though it was not available when the inputs forming that context were initially handled). The "stack" behavior is generalized with the
Stackable
typeclass.An example usage of this is to faciliate creation of a Parser for an XML element which starts with some "dictionary" element, followed by a large number of "data" objects that reference the dictionary. Normally, a user of xml-spac would have to choose between;
and
The input type
The first handler's result type
The second handler's result type