|
||||||||||
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.NonTerminalSymbol<P>
public class NonTerminalSymbol<P extends Processor>
Named wrapper of a Symbol
. The name will appear in the message text
of a ParsingException
. Matching is delegated to the wrapped symbol.
doProcess(TokenIterator, Processor)
is delegated to
Symbol.process(TokenIterator, Processor)
. There are hooks methods
invoked before (preProcess(Processor)
) and after (postProcess(Processor)
).
The wrapped symbol will be set by definedBy(Symbol)
. An
IllegalStateException
is thrown during parsing if the wrapped symbol
hasn't been set.
Constructor Summary | |
---|---|
NonTerminalSymbol(java.lang.String name)
Creates an instance with the specified name. |
Method Summary | |
---|---|
void |
definedBy(Symbol<P> symbol)
Sets the wrapped symbol. |
protected void |
doProcess(TokenIterator iterator,
P processor)
Processes tokens taken from the specified iterator without initial matching check. |
MatchingResult |
matches(Token token)
Returns true if the specified token matches. |
protected void |
postProcess(P processor)
Invoke processing at the specified processor after the wrapped symbol has been processed. |
protected void |
preProcess(P processor)
Invoke processing at the specified processor before the wrapped symbol will be processed. |
java.lang.String |
toString()
|
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, wait, wait, wait |
Constructor Detail |
---|
public NonTerminalSymbol(java.lang.String name)
Method Detail |
---|
public final void definedBy(Symbol<P> symbol)
public final MatchingResult matches(Token token)
Symbol
true
if the specified token matches.
token
- Token to be checked. Will be null
if beyond last
token.protected final void doProcess(TokenIterator iterator, P processor) throws ParsingException
AbstractSymbol
doProcess
in class AbstractSymbol<P extends Processor>
processor
- Processor
who does the actual processing.
ParsingException
- if a parsing error occurs.protected void preProcess(P processor)
protected void postProcess(P processor)
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |