|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.parcinj.AbstractSymbol<P>
net.sf.parcinj.Optional<P>
public class Optional<P extends Processor>
Wraps a symbol which will be processed only if it matches the current token.
Constructor Summary | |
---|---|
Optional(Symbol<P> symbol)
Creates an instance for the specified symbol. |
Method Summary | |
---|---|
protected void |
doProcess(TokenIterator iterator,
P processor)
Processes the wrapped symbol if it matches the current token of the specified iterator. |
MatchingResult |
matches(Token token)
Returns MatchingResult.OK . |
Methods inherited from class net.sf.parcinj.AbstractSymbol |
---|
followedBy, oneOrMoreTimes, optional, or, process, zeroOrMoreTimes, zeroOrMoreTimesSeparatedBy |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Optional(Symbol<P> symbol)
Method Detail |
---|
public MatchingResult matches(Token token)
MatchingResult.OK
.
token
- Token to be checked. Will be null
if beyond last
token.protected final void doProcess(TokenIterator iterator, P processor) throws ParsingException
doProcess
in class AbstractSymbol<P extends Processor>
processor
- Processor
who does the actual processing.
ParsingException
- if a parsing error occurs.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |