Skip to content

Commit

Permalink
Merge pull request #221 from uklimaschewski/issue_217_string_operators
Browse files Browse the repository at this point in the history
#217 Strings as operators (e. g. AND, OR)
  • Loading branch information
uklimaschewski authored Aug 24, 2019
2 parents 99a3da4 + 9499435 commit 8845640
Show file tree
Hide file tree
Showing 2 changed files with 225 additions and 198 deletions.
8 changes: 7 additions & 1 deletion src/main/java/com/udojava/evalex/Expression.java
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,13 @@ && isHexDigit(
}
pos--;
}
token.type = ch == '(' ? TokenType.FUNCTION : TokenType.VARIABLE;
if (ch == '(') {
token.type = TokenType.FUNCTION;
} else if (operators.containsKey(token.surface)) {
token.type = TokenType.OPERATOR;
} else {
token.type = TokenType.VARIABLE;
}
} else if (ch == '(' || ch == ')' || ch == ',') {
if (ch == '(') {
token.type = TokenType.OPEN_PAREN;
Expand Down
Loading

0 comments on commit 8845640

Please sign in to comment.