Contents
java.lang.Object
com.hypixel.hytale.server.npc.util.expression.compile.Lexer<T>
Break a character string into tokens.
The lexer uses fixed code to tokenize identifiers, numbers and strings. Operators and other symbols are parsed using a graph structure built from a table of tokens. Each node of this graph has a character to match, a token value if the path to the node represents a valid token and a list of possible follower nodes. The lexer for an expression is only built once and then considered read only. Tokenising a string requires a LexerContext to keep position and tokens. The lexer skips white space between tokens.
-
Field Details
-
UNTERMINATED_STRING
- See Also:
-
INVALID_NUMBER_FORMAT
- See Also:
-
INVALID_CHARACTER_IN_EXPRESSION
- See Also:
-
-
Constructor Details
-
Lexer
Create a lexer from table of operators.- Parameters:
tokenEnd- Value to return at string endtokenIdent- Value to return for identifiertokenString- Value to return for a stringtokenNumber- Value to return for a (floating point) numberoperators- Stream of tokens to create lookup graph
-
-
Method Details
-
nextToken
Return next token in string.- Parameters:
context- Initialised LexerContext- Returns:
- Token value (tokenEnd at end of string)
- Throws:
ParseException- when no valid token was found
-