Package eu.bandm.tools.ramus.runtime2
Interface Parser.Input<D,T>
- Type Parameters:
D
- the type of source document identifiersT
- the type of token types; typically an enum type
public static interface Parser.Input<D,T>
Abstract interface of immutable parser input states. Each state is a
pointer into an immutable infinite sequence of tokens.
For actual, finite input the token sequence should be extended by a
potentially infinite repetition of distinguished end tokens
(typically of a reserved type EOF
) carrying no further information.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionconsume()
Advances by one step.boolean
Checks whether one or more lookahead tokens have been generated ahead.boolean
isStart()
FIXME: document this method, and cross-reference lookbehind.lookahead
(int k) Returns the token that lies a given number of steps ahead.Returns the token that lies one step behind.default Parser.Output<D,
T> transitionBy
(Update<SimpleMessage<D>> effect)
-
Method Details
-
lookahead
Returns the token that lies a given number of steps ahead.- Parameters:
k
- the number of steps to look ahead- Returns:
- the token that lies
k
steps ahead from this state. - Throws:
IllegalArgumentException
- ifk < 0
.
-
hasLookahead
boolean hasLookahead()Checks whether one or more lookahead tokens have been generated ahead.Modifications to the token source do only take effect immediately if this method returns
false
. -
isStart
boolean isStart()FIXME: document this method, and cross-reference lookbehind. -
lookbehind
Returns the token that lies one step behind.- Returns:
- the token immediately behind this state
- Throws:
IllegalStateException
- if this state points to the start of the token sequence.
-
consume
Parser.Input<D,T> consume()Advances by one step.- Returns:
- the input state pointing one step ahead in the token sequence.
-
transitionBy
-