Class Lexer.Token

java.lang.Object
com.github.zafarkhaja.semver.expr.Lexer.Token
Enclosing class:
Lexer

static class Lexer.Token extends Object
This class holds the information about lexemes in the input stream.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    (package private) static enum 
    Valid token types.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) final String
    The lexeme of this token.
    (package private) final int
    The position of this token.
    (package private) final Lexer.Token.Type
    The type of this token.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Token(Lexer.Token.Type type, String lexeme, int position)
    Constructs a Token instance with the type, lexeme and position.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    equals(Object other)
    int
    Returns the string representation of this token.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • type

      final Lexer.Token.Type type
      The type of this token.
    • lexeme

      final String lexeme
      The lexeme of this token.
    • position

      final int position
      The position of this token.
  • Constructor Details

    • Token

      Token(Lexer.Token.Type type, String lexeme, int position)
      Constructs a Token instance with the type, lexeme and position.
      Parameters:
      type - the type of this token
      lexeme - the lexeme of this token
      position - the position of this token
  • Method Details

    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Returns the string representation of this token.
      Overrides:
      toString in class Object
      Returns:
      the string representation of this token