com.aptana.ide.editor.js.environment
Class LexemeListWalker

java.lang.Object
  extended by com.aptana.ide.editor.js.environment.LexemeListWalker
Direct Known Subclasses:
JSLexemeListWalker

public abstract class LexemeListWalker
extends java.lang.Object

An abstract class for traversing a list of lexemes and performing a specific operation on each lexeme.


Nested Class Summary
 class LexemeListWalker.AbortException
          Thrown if we wish to abort the walking operation
 
Field Summary
protected  int currentIndex
          The current index we are at
protected  LexemeList lexemeList
          The list of lexemes
protected  int llSize
          The cached LexemeList size
 
Constructor Summary
LexemeListWalker()
           
 
Method Summary
protected abstract  void onLexeme(Lexeme lexeme, int index)
          The method called on each lexeme
 int walkList(IParseState parseState, int startIndex)
          Walks the list of lexemes, calling "onLexeme" on each one
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lexemeList

protected LexemeList lexemeList
The list of lexemes


llSize

protected int llSize
The cached LexemeList size


currentIndex

protected int currentIndex
The current index we are at

Constructor Detail

LexemeListWalker

public LexemeListWalker()
Method Detail

walkList

public int walkList(IParseState parseState,
                    int startIndex)
Walks the list of lexemes, calling "onLexeme" on each one

Parameters:
parseState - The current parse state
startIndex - The lexeme list index at which to begin walking
Returns:
The ending index (generally the last index of the list)

onLexeme

protected abstract void onLexeme(Lexeme lexeme,
                                 int index)
                          throws LexemeListWalker.AbortException
The method called on each lexeme

Parameters:
lexeme - The lexeme to process
index - the index of the lexeme in the lexeme list
Throws:
LexemeListWalker.AbortException - An exception to throw if we wish to abort the walking operation