public static class Translet.State<R> extends Object
Translet.Parser
, delivered Result, and the preceding state, thus
forming a kind of parse tree in post order notation:
_______/ ----------- Parser(SEQU) ________________________/ ______/ ^ Parser Parser | ^ ^ | | |.parser | +------------+ .pre +------------+ .pre +------------+ | State | <---- | State | <----- | State | +------------+ +------------+ +------------+ |.s |.pos v v "toConsume"State objects are added (a) when input characters are consumed, (b) when functions are applied for further result generation, or (c) when a storage action must be memorized for later execution.
".s" is constant and always simply copied, to be accessible by the terminal symbol parsing functions; ".pos" is advancing and reflects the situation AFTER ".parser" has consumed.
Parsing is executed in a breadth-first search, so that finally different successful parsing trees can coexist. All STORING operations are not yet performed but done ex-parte-post, after one of these solutions has been selected.
Modifier and Type | Field and Description |
---|---|
(package private) int |
depth
FIXME ????
|
static Predicate<Translet.State> |
p_atEnd |
(package private) Translet.Parser<R> |
parser
The translet parser which has consumed to produce this state.
|
(package private) int |
pos
The position after parsing.
|
(package private) @Opt Translet.State<?> |
pre
The preceding state.
|
(package private) R |
result |
(package private) String |
s
The input data on which all parsers operate.
|
Modifier and Type | Method and Description |
---|---|
boolean |
atEnd()
Return whether parsing has reached the end of the input string.
|
String |
consumed()
Returns the character input consumed DIRECTLY by the parser of this state,
i.e.
|
void |
executeStoring(Event e,
Location<XMLDocumentIdentifier> loc,
MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> msg)
Step back through the chain of parser states and execute all store operation.
|
static Translet.State<Object> |
initState(String s,
int pos)
Create an initial state with only the input data, no parser or result yet.
|
String |
lookingAt()
Return the current rest of the input string.
|
String |
simpleString()
Deliver printable representation only of this state.
|
<N,M extends N> |
succ(Translet.Parser<N> parser,
int pos,
M result)
Return a new State, which is successor of "this", and
in which "parser" has delivered "result" and consumed input up to "pos".
|
<N,M extends N> |
succ(Translet.Parser<N> parser,
M result)
Return a new State, which is successor of "this", and
in which "parser" has delivered "result", but no input has been consumed.
|
String |
toString()
Deliver printable representation of the whole chain of states ending here.
|
final Translet.Parser<R> parser
@Opt final @Opt Translet.State<?> pre
final String s
final int pos
final int depth
public static final Predicate<Translet.State> p_atEnd
public static Translet.State<Object> initState(String s, int pos)
public <N,M extends N> Translet.State<N> succ(Translet.Parser<N> parser, M result)
public <N,M extends N> Translet.State<N> succ(Translet.Parser<N> parser, int pos, M result)
public void executeStoring(Event e, Location<XMLDocumentIdentifier> loc, MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> msg)
Translet.Parser.executeStoring(Translet.State,Event,Location,MessageReceiver)
.
Only the instances of some dedicated parser classes really execute storing.e
- the event which is used as key for all the data mapsloc
- the location of the whole expression, used in all error messages generated
by storing.msg
- drain of error messages.public boolean atEnd()
public String consumed()
public String lookingAt()
public String simpleString()