Handler
Attributes
- Graph
-
- Supertypes
Members list
Value members
Concrete methods
Signal the end of the data stream to this handler, forcing it to generate a result. Handlers may throw exceptions in response to this, such as a handler which wants the first event from an empty stream.
Signal the end of the data stream to this handler, forcing it to generate a result. Handlers may throw exceptions in response to this, such as a handler which wants the first event from an empty stream.
Further calls to step
or finish
after the first call to finish
will result in undefined behavior. The general assumption is that a handler should be discarded after its finish
method is called.
Attributes
- Returns
-
the final result of this parser
Advance the state of this handler by accepting a single input of type In
. If doing so would cause this parser to complete, return a Left
containing the output. Otherwise, return a Right
containing the next parser state.
Advance the state of this handler by accepting a single input of type In
. If doing so would cause this parser to complete, return a Left
containing the output. Otherwise, return a Right
containing the next parser state.
Handlers are assumed to be internally-mutable, so it is acceptable to simply update some internal state and then return Right(this)
, although in some cases it will be desirable to return a separate handler entirely.
Value parameters
- in
-
A single input event from a data stream
Attributes
- Returns
-
If the input would finish the parser, return a
Left
containing the result. Otherwise, return aRight
containing a Handler which represents the next parsing state. The handler in aRight
may be this handler, or a completely separate one.
Inherited methods
Wraps this handler as a "top level" handler, which will inject a SpacTraceElement (representing the current input or the "EOF" signal) to any exception is thrown by this handler when calling its step
or finish
methods.
Wraps this handler as a "top level" handler, which will inject a SpacTraceElement (representing the current input or the "EOF" signal) to any exception is thrown by this handler when calling its step
or finish
methods.
Used internally by Parser
's parse
methods.
Attributes
- Inherited from:
- Handler
Convenience function to call step
on a sequence of inputs all at once. If the step
returns a result, this method will return a Left
containing that result and the remainder of the inputs
that were not consumed. If the inputs
run out before the handler returns a result from a step
, this method will return a Right
containing the latest state of the handler. This method will not call the handler's finish()
.
Convenience function to call step
on a sequence of inputs all at once. If the step
returns a result, this method will return a Left
containing that result and the remainder of the inputs
that were not consumed. If the inputs
run out before the handler returns a result from a step
, this method will return a Right
containing the latest state of the handler. This method will not call the handler's finish()
.
In general, you won't call this method directly. Instead, use one of the Parser trait's parse
methods.
Type parameters
- C
-
An
Unconsable
collection, i.e.List
orcats.data.Chain
- In2
-
Subtype of
In
, orIn
(to satisfy contravariance)
Value parameters
- C
-
Evidence that the
inputs
has ahead/tail
split operation - inputs
-
A sequence of inputs
Attributes
- Returns
-
Either the handler's result paired with the remaining inputs, or the new handler state
- Inherited from:
- Handler