2017-07-25 11:08:03 -07:00
|
|
|
package org.nwapw.abacus.tree;
|
|
|
|
|
2017-07-26 10:10:37 -07:00
|
|
|
/**
|
|
|
|
* Enum to represent the type of the token that has been matched
|
|
|
|
* by the lexer.
|
|
|
|
*/
|
2017-07-25 11:08:03 -07:00
|
|
|
public enum TokenType {
|
|
|
|
|
2017-07-27 12:53:58 -07:00
|
|
|
INTERNAL_FUNCTION_END(-1),
|
2017-08-25 19:48:56 -07:00
|
|
|
ANY(0), WHITESPACE(1), COMMA(2), VARIABLE(3), OP(4), TREE_VALUE_OP(4),
|
|
|
|
NUM(5), FUNCTION(6), TREE_VALUE_FUNCTION(6), OPEN_PARENTH(7), CLOSE_PARENTH(7);
|
2017-07-25 11:08:03 -07:00
|
|
|
|
2017-07-26 10:10:37 -07:00
|
|
|
/**
|
|
|
|
* The priority by which this token gets sorted.
|
|
|
|
*/
|
2017-07-25 11:08:03 -07:00
|
|
|
public final int priority;
|
|
|
|
|
2017-07-26 10:10:37 -07:00
|
|
|
/**
|
|
|
|
* Creates a new token type with the given priority.
|
2017-07-30 21:11:32 -07:00
|
|
|
*
|
2017-07-26 10:10:37 -07:00
|
|
|
* @param priority the priority of this token type.
|
|
|
|
*/
|
2017-07-30 21:11:32 -07:00
|
|
|
TokenType(int priority) {
|
2017-07-25 11:08:03 -07:00
|
|
|
this.priority = priority;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|