public static class Translet.OptionParser<D> extends Translet.Parser<D>
Modifier and Type | Field and Description |
---|---|
protected D |
deflt
Default value, returned when sub-parser did not match.
|
protected boolean |
greedy
Whether parser behaves greedily or non-deterministically.
|
protected Translet.Parser<D> |
sub
The sub-parser to parse or ski.
|
Constructor and Description |
---|
OptionParser(Translet.Parser<D> sub,
D deflt,
boolean greedy)
Constructor called by the factory methods.
|
Modifier and Type | Method and Description |
---|---|
Format |
name(boolean full,
Map<Translet.Recursive,String> names)
Returns a user-readable text representation.
|
Set<Translet.State<D>> |
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<D> |
stripOpt()
Returns the first nested parser which is NOT an
Translet.OptionParser . |
String |
unparse(Object key)
Reverse the parsing process (as far as possible) and deliver a
string representation which when parsed delivered the parse result.
|
executeStoring, isTerminal, mparse, name, parseEpsilon, toString, toString, wrapResult
protected Translet.Parser<D> sub
protected boolean greedy
public OptionParser(Translet.Parser<D> sub, @Opt D deflt, boolean greedy)
public Translet.Parser<D> stripOpt()
Translet.Parser
Translet.OptionParser
.stripOpt
in class Translet.Parser<D>
public String unparse(Object key)
Translet.Parser
unparse
in class Translet.Parser<D>
public Set<Translet.State<D>> parseOneState(Translet.State<?> inState, Set<Translet.Alternative> alternatives)
Translet.Parser
parseOneState
in class Translet.Parser<D>
public Format name(boolean full, Map<Translet.Recursive,String> names)
[content]?
" for the non-greedy and .
"[content]?
_" for the greedy variant.name
in class Translet.Parser<D>
full
- whether storing operators do appear in the rendering.names
- map to handle recursive loops in the parser structure.