public abstract static class Translet.Parser<R> extends Object
Constructor and Description |
---|
Parser() |
Modifier and Type | Method and Description |
---|---|
void |
executeStoring(Translet.State<R> s,
Event e,
Location<XMLDocumentIdentifier> loc,
MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> msg)
Execute the store operation represented by "this" parser.
|
boolean |
isTerminal()
Whether the parser does directly consume character data.
|
Set<Translet.State<R>> |
mparse(Set<? extends Translet.State<?>> inStates,
Set<Translet.Alternative> alternatives)
"*M*ultiple Parse" means to apply the parser to a set of incoming
Translet.State s, which represent the parsing situations reached so far. |
Format |
name(boolean full)
Returns a user-readable text representation.
|
abstract Format |
name(boolean full,
Map<Translet.Recursive,String> names)
Returns a user-readable text representation.
|
protected @Opt Translet.State<?> |
parseEpsilon(Translet.State<?> inState)
Find one parse result which consumes no characters.
|
protected abstract Set<Translet.State<R>> |
parseOneState(Translet.State<?> inState,
Set<Translet.Alternative> alternatives)
Calculate a set of possible successor states by applying this parser
to the incoming state and append all altenatives found underways to
the parameter "alternatives".
|
Translet.Parser<R> |
stripOpt()
Returns the first nested parser which is NOT an
Translet.OptionParser . |
String |
toString()
Returns a user-readable text representation.
|
String |
toString(boolean includeStoring)
Returns a user-readable text representation.
|
abstract String |
unparse(Object key)
Reverse the parsing process (as far as possible) and deliver a
string representation which when parsed delivered the parse result.
|
protected R |
wrapResult(int index,
Translet.State<?> resultState)
Only needed for disjunction parsers, simulates multiple inheritance
by creating an instance of a subclass of
CoTuple |
public boolean isTerminal()
Translet._CONST
, Translet._CAT
and Translet._REGEX
).public abstract String unparse(Object key)
public Translet.Parser<R> stripOpt()
Translet.OptionParser
.public Format name(boolean full)
full
- whether storing operators do appear in the rendering.public abstract Format name(boolean full, Map<Translet.Recursive,String> names)
full
- whether storage constructs do appear in the rendering.names
- a map for managing the renderings of recursive callspublic String toString(boolean includeStoring)
includeStoring
- whether storage constructs do appear in the rendering.names
- a map for managing the renderings of recursive callspublic String toString()
toString(boolean)
with the argument set to true.public void executeStoring(Translet.State<R> s, Event e, Location<XMLDocumentIdentifier> loc, MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> msg)
public final Set<Translet.State<R>> mparse(Set<? extends Translet.State<?>> inStates, Set<Translet.Alternative> alternatives)
Translet.State
s, which represent the parsing situations reached so far.
Executes parseOneState(Translet.State,Set)
for each incoming state.
Finally delivers one single set, the set union of all States resulting
from these calls.
@Opt protected @Opt Translet.State<?> parseEpsilon(Translet.State<?> inState)
instate
- the start state of parsingprotected abstract Set<Translet.State<R>> parseOneState(Translet.State<?> inState, Set<Translet.Alternative> alternatives)
protected R wrapResult(int index, Translet.State<?> resultState)
CoTuple
int
- the index of the co-tuple variantresultState
- the result object to be wrappedR
- a subtype of CoTuple
with the type R at the i-th position.