Enum Class TokenType
- All Implemented Interfaces:
Serializable, Comparable<TokenType>, Constable
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:
-
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E> -
Enum Constant Summary
Enum Constants -
Method Summary
-
Enum Constant Details
-
NUMBER
-
STRING
-
BOOLEAN_TRUE
-
BOOLEAN_FALSE
-
NULL
-
IDENTIFIER
-
PLUS
-
MINUS
-
STAR
-
SLASH
-
PERCENT
-
POWER
-
EQ
-
NE
-
LT
-
LE
-
GT
-
GE
-
AND
-
OR
-
NOT
-
ASSIGN
-
MATCHES
-
INSTANCEOF
-
LPAREN
-
RPAREN
-
LBRACKET
-
RBRACKET
-
LBRACE
-
RBRACE
-
DOT
-
SAFE_NAV
-
COMMA
-
COLON
-
QUESTION
-
HASH
-
PROJECT
-
FILTER
-
EOF
-
-
Method Details
-
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
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 nameNullPointerException- if the argument is null
-