Enum Class TokenType

java.lang.Object
java.lang.Enum<TokenType>
cloud.opencode.base.expression.parser.TokenType
All Implemented Interfaces:
Serializable, Comparable<TokenType>, Constable

public enum TokenType extends Enum<TokenType>
Token Type Enum 词法单元类型枚举

Represents the types of tokens in expression parsing.

表示表达式解析中的词法单元类型。

Features | 主要功能:

  • Literal types: NUMBER, STRING, BOOLEAN, NULL - 字面量类型
  • Operators: arithmetic, comparison, logical, assignment - 运算符: 算术、比较、逻辑、赋值
  • Punctuation: parentheses, brackets, braces, dot, comma - 标点: 括号、方括号、花括号、点、逗号
  • Special: SAFE_NAV, FILTER, PROJECT, MATCHES, INSTANCEOF - 特殊: 空安全导航、过滤、投影、匹配、instanceof

Usage Examples | 使用示例:

Token token = Token.of(TokenType.NUMBER, 42, 0, 2);
if (token.is(TokenType.NUMBER)) {
    Number value = token.numberValue();
}

Security | 安全性:

  • Thread-safe: Yes, immutable enum - 线程安全: 是,不可变枚举
  • Null-safe: N/A - 空值安全: 不适用
Since:
JDK 25, opencode-base-expression V1.0.0
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Enum Constant Details

    • NUMBER

      public static final TokenType NUMBER
    • STRING

      public static final TokenType STRING
    • BOOLEAN_TRUE

      public static final TokenType BOOLEAN_TRUE
    • BOOLEAN_FALSE

      public static final TokenType BOOLEAN_FALSE
    • NULL

      public static final TokenType NULL
    • IDENTIFIER

      public static final TokenType IDENTIFIER
    • PLUS

      public static final TokenType PLUS
    • MINUS

      public static final TokenType MINUS
    • STAR

      public static final TokenType STAR
    • SLASH

      public static final TokenType SLASH
    • PERCENT

      public static final TokenType PERCENT
    • POWER

      public static final TokenType POWER
    • EQ

      public static final TokenType EQ
    • NE

      public static final TokenType NE
    • LT

      public static final TokenType LT
    • LE

      public static final TokenType LE
    • GT

      public static final TokenType GT
    • GE

      public static final TokenType GE
    • AND

      public static final TokenType AND
    • OR

      public static final TokenType OR
    • NOT

      public static final TokenType NOT
    • ASSIGN

      public static final TokenType ASSIGN
    • MATCHES

      public static final TokenType MATCHES
    • INSTANCEOF

      public static final TokenType INSTANCEOF
    • IN

      public static final TokenType IN
    • BETWEEN

      public static final TokenType BETWEEN
    • BIT_AND

      public static final TokenType BIT_AND
    • BIT_OR

      public static final TokenType BIT_OR
    • BIT_XOR

      public static final TokenType BIT_XOR
    • BIT_NOT

      public static final TokenType BIT_NOT
    • LSHIFT

      public static final TokenType LSHIFT
    • RSHIFT

      public static final TokenType RSHIFT
    • ARROW

      public static final TokenType ARROW
    • ELVIS

      public static final TokenType ELVIS
    • MAP_LBRACE

      public static final TokenType MAP_LBRACE
    • LPAREN

      public static final TokenType LPAREN
    • RPAREN

      public static final TokenType RPAREN
    • LBRACKET

      public static final TokenType LBRACKET
    • RBRACKET

      public static final TokenType RBRACKET
    • LBRACE

      public static final TokenType LBRACE
    • RBRACE

      public static final TokenType RBRACE
    • DOT

      public static final TokenType DOT
    • SAFE_NAV

      public static final TokenType SAFE_NAV
    • COMMA

      public static final TokenType COMMA
    • COLON

      public static final TokenType COLON
    • QUESTION

      public static final TokenType QUESTION
    • HASH

      public static final TokenType HASH
    • PROJECT

      public static final TokenType PROJECT
    • FILTER

      public static final TokenType FILTER
    • EOF

      public static final TokenType EOF
  • Method Details

    • values

      public static TokenType[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static TokenType valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null