Class Lookahead2Iterator<E>

java.lang.Object
com.singularsys.jep.configurableparser.Lookahead2Iterator<E>
Direct Known Subclasses:
LookaheadNIterator

public class Lookahead2Iterator<E> extends Object
An iterator which stores the next two tokens.
  • Constructor Details

    • Lookahead2Iterator

      public Lookahead2Iterator()
      Default constructor. If this constructor is used then the setInputIterator(Iterator) method should be called.
      Since:
      3.5
    • Lookahead2Iterator

      public Lookahead2Iterator(List<E> input)
      Constructor when the list of tokens is known beforehand.
      Parameters:
      input - the list of tokens
    • Lookahead2Iterator

      public Lookahead2Iterator(Iterator<E> input)
      Decorator constructor around an iterator
      Parameters:
      input - the input iterator
  • Method Details

    • setInputIterator

      public void setInputIterator(Iterator<E> input)
      Should be called if the default constructor is used.
      Parameters:
      input - the new input iterator
      Since:
      3.5
    • peekNext

      public E peekNext()
    • nextnext

      public E nextnext()
    • prev

      public E prev()
      Return the token just consumed.
      Returns:
      the token, or null if no token consumed.
      Since:
      Jep 3.5
    • consume

      public void consume()
      Eat one token.
    • toString

      public String toString()
      Overrides:
      toString in class Object