1
0
mirror of https://github.com/DanilaFe/abacus synced 2024-11-17 08:03:09 -08:00

Change lexer tokenizer to recognize tree value functions.

This commit is contained in:
Danila Fedorin 2017-08-25 01:03:12 -07:00
parent 40c80db914
commit ac19c7b230
2 changed files with 7 additions and 1 deletions

View File

@ -53,6 +53,9 @@ public class LexerTokenizer implements Tokenizer<Match<TokenType>>, PluginListen
for (String function : manager.getAllFunctions()) {
lexer.register(Pattern.sanitize(function), TokenType.FUNCTION);
}
for (String function : manager.getAllTreeValueFunctions()){
lexer.register(Pattern.sanitize(function), TokenType.TREE_VALUE_FUNCTION);
}
}
@Override
@ -63,6 +66,9 @@ public class LexerTokenizer implements Tokenizer<Match<TokenType>>, PluginListen
for (String function : manager.getAllFunctions()) {
lexer.unregister(Pattern.sanitize(function), TokenType.FUNCTION);
}
for (String function : manager.getAllTreeValueFunctions()){
lexer.unregister(Pattern.sanitize(function), TokenType.TREE_VALUE_FUNCTION);
}
}
}

View File

@ -7,7 +7,7 @@ package org.nwapw.abacus.tree;
public enum TokenType {
INTERNAL_FUNCTION_END(-1),
ANY(0), WHITESPACE(1), COMMA(2), OP(3), NUM(4), VARIABLE(5), FUNCTION(6), OPEN_PARENTH(7), CLOSE_PARENTH(8);
ANY(0), WHITESPACE(1), COMMA(2), OP(3), NUM(4), VARIABLE(5), FUNCTION(6), TREE_VALUE_FUNCTION(6), OPEN_PARENTH(7), CLOSE_PARENTH(8);
/**
* The priority by which this token gets sorted.