Package team.unnamed.mocha.lexer
Enum Class TokenKind
- All Implemented Interfaces:
Serializable,Comparable<TokenKind>,Constable
An enum of token kinds. Represents a single token kind.
Tokens are, commonly, a sequence of one or more continuous characters, like "??", "->", "!", "true", "1.0", "2.0", ...
Tokens do not have an specific behavior, they just group certain characters that can be used by the parser.
- Since:
- 3.0.0
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionDouble ampersand token (&&)Arrow token (->)The bang or exclamation symbol (!)Bang-eq token (!=)Double bar token (||)The "break" keywordColon symbol (:)Comma symbol (,)The "continue" keywordThe dot symbol (.)End-of-file token, means that the end was reachedEqual symbol (=)Equal-equal token (==)Error token, means that there was an error there'False' literal boolean tokenFloat literal token, has a string value of its content, which can be parsed to a floating-point numberGreater-than token (>)Greater-than-or-equal token (>=)Identifier token, has a string value of the identifier nameLeft-brace symbol "{"Left-bracket token "["Left-parenthesis symbol "("Less-than token (<)Less-than-or-equal token (<=)Plus symbol (+)Question symbol (?)Question-question token (??)Right-brace symbol "}"Right-bracket "]The "return" keywordRight-parenthesis symbol ")"Semicolon symbol (;)Slash symbol (/)Star symbol (*)String literal token, has a string value of its contentHyphen/sub symbol (-)'True' literal boolean token -
Method Summary
Modifier and TypeMethodDescriptionbooleanhasTag(@NotNull TokenKind.Tag tag) Determines if this token kind has a certain tag.static TokenKindReturns the enum constant of this class with the specified name.static TokenKind[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
EOF
End-of-file token, means that the end was reached -
ERROR
Error token, means that there was an error there -
IDENTIFIER
Identifier token, has a string value of the identifier name -
STRING
String literal token, has a string value of its content -
FLOAT
Float literal token, has a string value of its content, which can be parsed to a floating-point number -
TRUE
'True' literal boolean token -
FALSE
'False' literal boolean token -
BREAK
The "break" keyword -
CONTINUE
The "continue" keyword -
RETURN
The "return" keyword -
DOT
The dot symbol (.) -
BANG
The bang or exclamation symbol (!) -
AMPAMP
Double ampersand token (&&) -
BARBAR
Double bar token (||) -
LT
Less-than token (<) -
LTE
Less-than-or-equal token (<=) -
GT
Greater-than token (>) -
GTE
Greater-than-or-equal token (>=) -
EQ
Equal symbol (=) -
EQEQ
Equal-equal token (==) -
BANGEQ
Bang-eq token (!=) -
STAR
Star symbol (*) -
SLASH
Slash symbol (/) -
PLUS
Plus symbol (+) -
SUB
Hyphen/sub symbol (-) -
LPAREN
Left-parenthesis symbol "(" -
RPAREN
Right-parenthesis symbol ")" -
LBRACE
Left-brace symbol "{" -
RBRACE
Right-brace symbol "}" -
QUESQUES
Question-question token (??) -
QUES
Question symbol (?) -
COLON
Colon symbol (:) -
ARROW
Arrow token (->) -
LBRACKET
Left-bracket token "[" -
RBRACKET
Right-bracket "] -
COMMA
Comma symbol (,) -
SEMICOLON
Semicolon symbol (;)
-
-
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
-
hasTag
Determines if this token kind has a certain tag.- Parameters:
tag- The tag to check.- Returns:
- True if this token kind is tagged with the given tag
- Since:
- 3.0.0
-