Class SourceIterator

java.lang.Object
foundry.veil.lib.anarres.cpp.SourceIterator
All Implemented Interfaces:
Iterator<Token>

public class SourceIterator extends Object implements Iterator<Token>
An Iterator for Sources, returning Tokens.
  • Constructor Details

    • SourceIterator

      public SourceIterator(@NotNull @NotNull Source s)
  • Method Details

    • hasNext

      public boolean hasNext()
      Returns true if the enclosed Source has more tokens.

      The EOF token is never returned by the iterator.

      Specified by:
      hasNext in interface Iterator<Token>
      Throws:
      IllegalStateException - if the Source throws a LexerException or IOException
    • next

      public Token next()
      Returns the next token from the enclosed Source.

      The EOF token is never returned by the iterator.

      Specified by:
      next in interface Iterator<Token>
      Throws:
      IllegalStateException - if the Source throws a LexerException or IOException
    • remove

      public void remove()
      Not supported.
      Specified by:
      remove in interface Iterator<Token>
      Throws:
      UnsupportedOperationException - unconditionally.