Class IteratorLexer

  • All Implemented Interfaces:
    Lexer

    public class IteratorLexer
    extends java.lang.Object
    implements Lexer
    A Lexer that wraps an iterator over an existing token stream.

    Used when parsing pre-processed constant expression initializers.

    • Constructor Summary

      Constructors 
      Constructor Description
      IteratorLexer​(SourceFile source, java.util.Iterator<com.google.turbine.parse.SavedToken> it)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String javadoc()
      Returns a saved javadoc comment.
      Token next()
      Returns the next token in the input stream, or EOF.
      int position()
      Returns the current position in the input.
      SourceFile source()
      Returns the source file for diagnostics.
      java.lang.String stringValue()
      Returns the string value of the current literal or identifier token.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • IteratorLexer

        public IteratorLexer​(SourceFile source,
                             java.util.Iterator<com.google.turbine.parse.SavedToken> it)
    • Method Detail

      • source

        public SourceFile source()
        Description copied from interface: Lexer
        Returns the source file for diagnostics.
        Specified by:
        source in interface Lexer
      • next

        public Token next()
        Description copied from interface: Lexer
        Returns the next token in the input stream, or EOF.
        Specified by:
        next in interface Lexer
      • stringValue

        public java.lang.String stringValue()
        Description copied from interface: Lexer
        Returns the string value of the current literal or identifier token.
        Specified by:
        stringValue in interface Lexer
      • position

        public int position()
        Description copied from interface: Lexer
        Returns the current position in the input.
        Specified by:
        position in interface Lexer
      • javadoc

        public java.lang.String javadoc()
        Description copied from interface: Lexer
        Returns a saved javadoc comment.
        Specified by:
        javadoc in interface Lexer