Class Lexer.Token

  • Enclosing class:
    Lexer

    public static class Lexer.Token
    extends Object
    Lexer token object.
    • Constructor Detail

      • Token

        public Token​(String streamName,
                     int type,
                     String lexeme,
                     int lineNumber,
                     int charIndex)
    • Method Detail

      • getStreamName

        public String getStreamName()
        Returns:
        the name of the stream that this token came from.
      • getLineNumber

        public int getLineNumber()
        Returns:
        the line number within the stream that this token appeared.
      • getCharIndex

        public int getCharIndex()
        Returns:
        the character index that this token starts on.
      • getLexeme

        public String getLexeme()
        Returns:
        this token's lexeme.
      • setLexeme

        public void setLexeme​(String lexeme)
        Sets this token's lexeme.
        Parameters:
        lexeme - the new lexeme.
      • getType

        public int getType()
        Returns:
        this token's type.
      • setType

        public void setType​(int type)
        Sets this token's type.
        Parameters:
        type - a type corresponding to a type in the lexer or lexer kernel.