Class Token

java.lang.Object
team.unnamed.mocha.lexer.Token

public final class Token extends Object
Class representing a Molang token. Each token has some information set by the lexer (i.e. start/end position, token kind and optional value)
Since:
3.0.0
  • Constructor Details

    • Token

      public Token(@NotNull @NotNull TokenKind kind, @Nullable @Nullable String value, int start, int end)
  • Method Details

    • kind

      @NotNull public @NotNull TokenKind kind()
      Gets the token kind.
      Returns:
      The token kind
      Since:
      3.0.0
    • value

      public @UnknownNullability String value()
      Gets the token value. Null if this kind of tokens doesn't allow values.
      Returns:
      The token value
      Since:
      3.0.0
    • start

      public int start()
      Gets the start index of this token.
      Returns:
      The token start
      Since:
      3.0.0
    • end

      public int end()
      Gets the end index of this token.
      Returns:
      The token end
      Since:
      3.0.0
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object