diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/com/healthmarketscience/jackcess/impl/expr/Expressionator.java | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/main/java/com/healthmarketscience/jackcess/impl/expr/Expressionator.java b/src/main/java/com/healthmarketscience/jackcess/impl/expr/Expressionator.java index 96deb27..4988f3e 100644 --- a/src/main/java/com/healthmarketscience/jackcess/impl/expr/Expressionator.java +++ b/src/main/java/com/healthmarketscience/jackcess/impl/expr/Expressionator.java @@ -88,7 +88,8 @@ public class Expressionator setWordType(WordType.OP, "+", "-", "*", "/", "\\", "^", "&", "mod"); setWordType(WordType.COMP, "<", "<=", ">", ">=", "=", "<>"); setWordType(WordType.LOG_OP, "and", "or", "eqv", "xor", "imp"); - setWordType(WordType.CONST, "true", "false", "null"); + setWordType(WordType.CONST, "true", "false", "null", "on", "off", + "yes", "no"); setWordType(WordType.SPEC_OP_PREFIX, "is", "like", "between", "in", "not"); // "X is null", "X is not null", "X like P", "X between A and B", // "X not between A and B", "X in (A, B, C...)", "X not in (A, B, C...)", @@ -96,6 +97,11 @@ public class Expressionator setWordType(WordType.DELIM, ".", "!", ",", "(", ")"); } + private static final Collection<String> TRUE_STRS = + Arrays.asList("true", "yes", "on"); + private static final Collection<String> FALSE_STRS = + Arrays.asList("false", "no", "off"); + private interface OpType {} private enum UnaryOp implements OpType { @@ -961,11 +967,12 @@ public class Expressionator private static void parseConstExpression(Token firstTok, TokBuf buf) { Expr constExpr = null; - if("true".equalsIgnoreCase(firstTok.getValueStr())) { + String tokStr = firstTok.getValueStr().toLowerCase(); + if(TRUE_STRS.contains(tokStr)) { constExpr = TRUE_VALUE; - } else if("false".equalsIgnoreCase(firstTok.getValueStr())) { + } else if(FALSE_STRS.contains(tokStr)) { constExpr = FALSE_VALUE; - } else if("null".equalsIgnoreCase(firstTok.getValueStr())) { + } else if("null".equals(tokStr)) { constExpr = NULL_VALUE; } else { throw new ParseException("Unexpected CONST word " |