net.sf.parcinj
Class SequenceOfSeparatedSymbols<P extends Processor>

java.lang.Object
  extended by net.sf.parcinj.AbstractSymbol<P>
      extended by net.sf.parcinj.SequenceOfSeparatedSymbols<P>
All Implemented Interfaces:
Symbol<P>

public class SequenceOfSeparatedSymbols<P extends Processor>
extends AbstractSymbol<P>

Compound with two symbols where one symbol is a delimiter. The symbol can appears zero times or more. Between two successive symbols there has to be the delimiter.


Constructor Summary
SequenceOfSeparatedSymbols(Symbol<P> symbol, Symbol<P> delimiter)
          Creates an instance for the specified symbol and delimiter.
 
Method Summary
protected  void doProcess(TokenIterator iterator, P processor)
          Processes the wrapped symbol if it matches otherwise does nothing.
 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

SequenceOfSeparatedSymbols

public SequenceOfSeparatedSymbols(Symbol<P> symbol,
                                  Symbol<P> delimiter)
Creates an instance for the specified symbol and delimiter.

Method Detail

matches

public MatchingResult matches(Token token)
Returns MatchingResult.OK.

Parameters:
token - Token to be checked. Will be null if beyond last token.

doProcess

protected final void doProcess(TokenIterator iterator,
                               P processor)
                        throws ParsingException
Processes the wrapped symbol if it matches otherwise does nothing. Next the delimiter and the symbol are processed if the delimiter matches. This step is repeated as long as the delimiter matches.

Specified by:
doProcess in class AbstractSymbol<P extends Processor>
processor - Processor who does the actual processing.
Throws:
ParsingException - if a parsing error occurs.