From 5f8e7be3c5d81765c931e60f5442297fdbfe3bf0 Mon Sep 17 00:00:00 2001 From: hengsin Date: Fri, 5 Aug 2022 19:21:50 +0800 Subject: [PATCH] IDEMPIERE-5367 Logic expression IN doesn't works with quoted text (#1423) * IDEMPIERE-5367 Logic expression IN doesn't works with quoted text * IDEMPIERE-5367 Logic expression IN doesn't works with quoted text - Fixed equal not working for quoted text with comma (e.g 'A,R,S') --- org.adempiere.base/antlr/README.MD | 1 + org.adempiere.base/antlr/SimpleBoolean.g4 | 7 + .../expression/logic/EvaluationVisitor.java | 56 +++++++- .../expression/logic/SimpleBoolean.interp | 12 +- .../expression/logic/SimpleBoolean.tokens | 16 ++- .../logic/SimpleBooleanBaseVisitor.java | 14 ++ .../logic/SimpleBooleanLexer.interp | 17 ++- .../expression/logic/SimpleBooleanLexer.java | 107 +++++++++------ .../logic/SimpleBooleanLexer.tokens | 16 ++- .../expression/logic/SimpleBooleanParser.java | 122 ++++++++++++------ .../logic/SimpleBooleanVisitor.java | 14 ++ .../test/base/LogicExpressionTest.java | 38 ++++++ 12 files changed, 319 insertions(+), 101 deletions(-) create mode 100644 org.adempiere.base/antlr/README.MD diff --git a/org.adempiere.base/antlr/README.MD b/org.adempiere.base/antlr/README.MD new file mode 100644 index 0000000000..fa03d59242 --- /dev/null +++ b/org.adempiere.base/antlr/README.MD @@ -0,0 +1 @@ +Source generated with ANTLR 4 IDE for Eclipse, Antlr Tools 4.9.2 (antlr-4.9.2-complete.jar) and Generate parse tree visitor(-visitor) turn on. diff --git a/org.adempiere.base/antlr/SimpleBoolean.g4 b/org.adempiere.base/antlr/SimpleBoolean.g4 index 2c3d65ddae..8a5a6c364b 100644 --- a/org.adempiere.base/antlr/SimpleBoolean.g4 +++ b/org.adempiere.base/antlr/SimpleBoolean.g4 @@ -13,7 +13,9 @@ expression | left=expression op=binary right=expression #binaryExpression | bool #boolExpression | VARIABLE #contextVariables + | QCSVTEXT #quotedCSVText | QTEXT #quotedText + | DQCSVTEXT #doubleQuotedCSVText | DQTEXT #doubleQuotedText | TEXT #text | DECIMAL #decimalExpression @@ -47,7 +49,12 @@ LPAREN : '(' ; RPAREN : ')' ; DECIMAL : '-'? [0-9]+ ( '.' [0-9]+ )? ; VARIABLE : '@'(.*?)'@' ; +COMMA : ',' ; +QCOMMA : '\',' ; QTEXT : ['](.*?)['] ; +QCSVTEXT : [']~(['])*(QCOMMA)(QTEXT)(COMMA QTEXT)* ; +DQCOMMA : '",'; DQTEXT : ["](.*?)["] ; +DQCSVTEXT : ["]~(["])*(DQCOMMA)(DQTEXT)(COMMA DQTEXT)* ; TEXT : [a-zA-Z_0-9,]+ ; WS : [ \r\t\u000C\n]+ -> skip; diff --git a/org.adempiere.base/src/org/idempiere/expression/logic/EvaluationVisitor.java b/org.adempiere.base/src/org/idempiere/expression/logic/EvaluationVisitor.java index 2035bfe427..f70a9b63a5 100644 --- a/org.adempiere.base/src/org/idempiere/expression/logic/EvaluationVisitor.java +++ b/org.adempiere.base/src/org/idempiere/expression/logic/EvaluationVisitor.java @@ -26,6 +26,8 @@ package org.idempiere.expression.logic; import java.math.BigDecimal; import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -36,7 +38,9 @@ import org.idempiere.expression.logic.SimpleBooleanParser.BoolContext; import org.idempiere.expression.logic.SimpleBooleanParser.ComparatorContext; import org.idempiere.expression.logic.SimpleBooleanParser.ComparatorExpressionContext; import org.idempiere.expression.logic.SimpleBooleanParser.ContextVariablesContext; +import org.idempiere.expression.logic.SimpleBooleanParser.DoubleQuotedCSVTextContext; import org.idempiere.expression.logic.SimpleBooleanParser.DoubleQuotedTextContext; +import org.idempiere.expression.logic.SimpleBooleanParser.QuotedCSVTextContext; import org.idempiere.expression.logic.SimpleBooleanParser.QuotedTextContext; import org.idempiere.expression.logic.SimpleBooleanParser.TextContext; @@ -63,13 +67,21 @@ public class EvaluationVisitor extends SimpleBooleanBaseVisitor { return new BigDecimal(ctx.DECIMAL().getText()); } - + @Override + public Object visitQuotedCSVText(QuotedCSVTextContext ctx) { + return ctx.QCSVTEXT().getText(); + } @Override public Object visitQuotedText(QuotedTextContext ctx) { return ctx.QTEXT().getText().replaceAll("[']", ""); } + @Override + public Object visitDoubleQuotedCSVText(DoubleQuotedCSVTextContext ctx) { + return ctx.DQCSVTEXT().getText(); + } + @Override public Object visitDoubleQuotedText(DoubleQuotedTextContext ctx) { return ctx.DQTEXT().getText().replaceAll("[\"]", ""); @@ -142,9 +154,11 @@ public class EvaluationVisitor extends SimpleBooleanBaseVisitor { return Boolean.TRUE; if (left == null || right == null) return Boolean.FALSE; - if (left instanceof String && right instanceof String && !(ctx.right.getText().startsWith("'") && !(ctx.right.getText().startsWith("\"")))) { + if (left instanceof String && right instanceof String) { String rightText = (String) right; - if (rightText.indexOf(",") > 0) { + if (ctx.right.start.getType() == SimpleBooleanLexer.QCSVTEXT || ctx.right.start.getType() == SimpleBooleanLexer.DQCSVTEXT) { + return isIn((String)left, rightText); + } else if (ctx.right.start.getType() == SimpleBooleanLexer.TEXT && rightText.indexOf(",") > 0) { return isIn((String)left, rightText); } } @@ -173,11 +187,39 @@ public class EvaluationVisitor extends SimpleBooleanBaseVisitor { } private Boolean isIn(String left, String rightText) { - String[] values = rightText.split("[,]"); + List values = new ArrayList<>(); + char[] chars = rightText.toCharArray(); + Character quote = null; + StringBuilder value = new StringBuilder(); + for (char ec : chars) { + if (quote != null && quote.charValue() == ec) { + quote = null; + } if (ec == '"') { + if (quote == null) { + quote = Character.valueOf(ec); + } else { + value.append(ec); + } + } else if (ec == '\'') { + if (quote == null) { + quote = Character.valueOf(ec); + } else { + value.append(ec); + } + } else if (Character.isWhitespace(ec)) { + if (quote != null) + value.append(ec); + } else if (ec == ',') { + if (value.length() > 0) + values.add(value.toString()); + value = new StringBuilder(); + } else { + value.append(ec); + } + } + if (value.length() > 0) + values.add(value.toString()); for(String s : values) { - s = s.trim(); - if ((s.startsWith("'") && s.endsWith("'")) || (s.startsWith("\"") && s.endsWith("\""))) - s = s.substring(1, s.length()-1); if (left.equals(s)) return Boolean.TRUE; } diff --git a/org.adempiere.base/src/org/idempiere/expression/logic/SimpleBoolean.interp b/org.adempiere.base/src/org/idempiere/expression/logic/SimpleBoolean.interp index fe4359c9cc..add4d462ea 100644 --- a/org.adempiere.base/src/org/idempiere/expression/logic/SimpleBoolean.interp +++ b/org.adempiere.base/src/org/idempiere/expression/logic/SimpleBoolean.interp @@ -16,6 +16,11 @@ null ')' null null +',' +'\',' +null +null +'",' null null null @@ -39,8 +44,13 @@ LPAREN RPAREN DECIMAL VARIABLE +COMMA +QCOMMA QTEXT +QCSVTEXT +DQCOMMA DQTEXT +DQCSVTEXT TEXT WS @@ -53,4 +63,4 @@ bool atn: -[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 3, 22, 50, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 3, 2, 3, 2, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 3, 29, 10, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 7, 3, 39, 10, 3, 12, 3, 14, 3, 42, 11, 3, 3, 4, 3, 4, 3, 5, 3, 5, 3, 6, 3, 6, 3, 6, 2, 3, 4, 7, 2, 4, 6, 8, 10, 2, 5, 3, 2, 8, 14, 3, 2, 3, 4, 3, 2, 6, 7, 2, 53, 2, 12, 3, 2, 2, 2, 4, 28, 3, 2, 2, 2, 6, 43, 3, 2, 2, 2, 8, 45, 3, 2, 2, 2, 10, 47, 3, 2, 2, 2, 12, 13, 5, 4, 3, 2, 13, 14, 7, 2, 2, 3, 14, 3, 3, 2, 2, 2, 15, 16, 8, 3, 1, 2, 16, 17, 7, 15, 2, 2, 17, 18, 5, 4, 3, 2, 18, 19, 7, 16, 2, 2, 19, 29, 3, 2, 2, 2, 20, 21, 7, 5, 2, 2, 21, 29, 5, 4, 3, 11, 22, 29, 5, 10, 6, 2, 23, 29, 7, 18, 2, 2, 24, 29, 7, 19, 2, 2, 25, 29, 7, 20, 2, 2, 26, 29, 7, 21, 2, 2, 27, 29, 7, 17, 2, 2, 28, 15, 3, 2, 2, 2, 28, 20, 3, 2, 2, 2, 28, 22, 3, 2, 2, 2, 28, 23, 3, 2, 2, 2, 28, 24, 3, 2, 2, 2, 28, 25, 3, 2, 2, 2, 28, 26, 3, 2, 2, 2, 28, 27, 3, 2, 2, 2, 29, 40, 3, 2, 2, 2, 30, 31, 12, 10, 2, 2, 31, 32, 5, 6, 4, 2, 32, 33, 5, 4, 3, 11, 33, 39, 3, 2, 2, 2, 34, 35, 12, 9, 2, 2, 35, 36, 5, 8, 5, 2, 36, 37, 5, 4, 3, 10, 37, 39, 3, 2, 2, 2, 38, 30, 3, 2, 2, 2, 38, 34, 3, 2, 2, 2, 39, 42, 3, 2, 2, 2, 40, 38, 3, 2, 2, 2, 40, 41, 3, 2, 2, 2, 41, 5, 3, 2, 2, 2, 42, 40, 3, 2, 2, 2, 43, 44, 9, 2, 2, 2, 44, 7, 3, 2, 2, 2, 45, 46, 9, 3, 2, 2, 46, 9, 3, 2, 2, 2, 47, 48, 9, 4, 2, 2, 48, 11, 3, 2, 2, 2, 5, 28, 38, 40] \ No newline at end of file +[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 3, 27, 52, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 3, 2, 3, 2, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 3, 31, 10, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 7, 3, 41, 10, 3, 12, 3, 14, 3, 44, 11, 3, 3, 4, 3, 4, 3, 5, 3, 5, 3, 6, 3, 6, 3, 6, 2, 3, 4, 7, 2, 4, 6, 8, 10, 2, 5, 3, 2, 8, 14, 3, 2, 3, 4, 3, 2, 6, 7, 2, 57, 2, 12, 3, 2, 2, 2, 4, 30, 3, 2, 2, 2, 6, 45, 3, 2, 2, 2, 8, 47, 3, 2, 2, 2, 10, 49, 3, 2, 2, 2, 12, 13, 5, 4, 3, 2, 13, 14, 7, 2, 2, 3, 14, 3, 3, 2, 2, 2, 15, 16, 8, 3, 1, 2, 16, 17, 7, 15, 2, 2, 17, 18, 5, 4, 3, 2, 18, 19, 7, 16, 2, 2, 19, 31, 3, 2, 2, 2, 20, 21, 7, 5, 2, 2, 21, 31, 5, 4, 3, 13, 22, 31, 5, 10, 6, 2, 23, 31, 7, 18, 2, 2, 24, 31, 7, 22, 2, 2, 25, 31, 7, 21, 2, 2, 26, 31, 7, 25, 2, 2, 27, 31, 7, 24, 2, 2, 28, 31, 7, 26, 2, 2, 29, 31, 7, 17, 2, 2, 30, 15, 3, 2, 2, 2, 30, 20, 3, 2, 2, 2, 30, 22, 3, 2, 2, 2, 30, 23, 3, 2, 2, 2, 30, 24, 3, 2, 2, 2, 30, 25, 3, 2, 2, 2, 30, 26, 3, 2, 2, 2, 30, 27, 3, 2, 2, 2, 30, 28, 3, 2, 2, 2, 30, 29, 3, 2, 2, 2, 31, 42, 3, 2, 2, 2, 32, 33, 12, 12, 2, 2, 33, 34, 5, 6, 4, 2, 34, 35, 5, 4, 3, 13, 35, 41, 3, 2, 2, 2, 36, 37, 12, 11, 2, 2, 37, 38, 5, 8, 5, 2, 38, 39, 5, 4, 3, 12, 39, 41, 3, 2, 2, 2, 40, 32, 3, 2, 2, 2, 40, 36, 3, 2, 2, 2, 41, 44, 3, 2, 2, 2, 42, 40, 3, 2, 2, 2, 42, 43, 3, 2, 2, 2, 43, 5, 3, 2, 2, 2, 44, 42, 3, 2, 2, 2, 45, 46, 9, 2, 2, 2, 46, 7, 3, 2, 2, 2, 47, 48, 9, 3, 2, 2, 48, 9, 3, 2, 2, 2, 49, 50, 9, 4, 2, 2, 50, 11, 3, 2, 2, 2, 5, 30, 40, 42] \ No newline at end of file diff --git a/org.adempiere.base/src/org/idempiere/expression/logic/SimpleBoolean.tokens b/org.adempiere.base/src/org/idempiere/expression/logic/SimpleBoolean.tokens index 5d21840047..900a562eb6 100644 --- a/org.adempiere.base/src/org/idempiere/expression/logic/SimpleBoolean.tokens +++ b/org.adempiere.base/src/org/idempiere/expression/logic/SimpleBoolean.tokens @@ -14,10 +14,15 @@ LPAREN=13 RPAREN=14 DECIMAL=15 VARIABLE=16 -QTEXT=17 -DQTEXT=18 -TEXT=19 -WS=20 +COMMA=17 +QCOMMA=18 +QTEXT=19 +QCSVTEXT=20 +DQCOMMA=21 +DQTEXT=22 +DQCSVTEXT=23 +TEXT=24 +WS=25 '&'=1 '|'=2 '$!'=3 @@ -31,3 +36,6 @@ WS=20 '~'=12 '('=13 ')'=14 +','=17 +'\','=18 +'",'=21 diff --git a/org.adempiere.base/src/org/idempiere/expression/logic/SimpleBooleanBaseVisitor.java b/org.adempiere.base/src/org/idempiere/expression/logic/SimpleBooleanBaseVisitor.java index ffcbedec57..5f88c642f7 100644 --- a/org.adempiere.base/src/org/idempiere/expression/logic/SimpleBooleanBaseVisitor.java +++ b/org.adempiere.base/src/org/idempiere/expression/logic/SimpleBooleanBaseVisitor.java @@ -41,6 +41,13 @@ public class SimpleBooleanBaseVisitor extends AbstractParseTreeVisitor imp * {@link #visitChildren} on {@code ctx}.

*/ @Override public T visitBoolExpression(SimpleBooleanParser.BoolExpressionContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitDoubleQuotedCSVText(SimpleBooleanParser.DoubleQuotedCSVTextContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * @@ -48,6 +55,13 @@ public class SimpleBooleanBaseVisitor extends AbstractParseTreeVisitor imp * {@link #visitChildren} on {@code ctx}.

*/ @Override public T visitContextVariables(SimpleBooleanParser.ContextVariablesContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitQuotedCSVText(SimpleBooleanParser.QuotedCSVTextContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * diff --git a/org.adempiere.base/src/org/idempiere/expression/logic/SimpleBooleanLexer.interp b/org.adempiere.base/src/org/idempiere/expression/logic/SimpleBooleanLexer.interp index 2054819c2f..6e5a185329 100644 --- a/org.adempiere.base/src/org/idempiere/expression/logic/SimpleBooleanLexer.interp +++ b/org.adempiere.base/src/org/idempiere/expression/logic/SimpleBooleanLexer.interp @@ -16,6 +16,11 @@ null ')' null null +',' +'\',' +null +null +'",' null null null @@ -39,8 +44,13 @@ LPAREN RPAREN DECIMAL VARIABLE +COMMA +QCOMMA QTEXT +QCSVTEXT +DQCOMMA DQTEXT +DQCSVTEXT TEXT WS @@ -61,8 +71,13 @@ LPAREN RPAREN DECIMAL VARIABLE +COMMA +QCOMMA QTEXT +QCSVTEXT +DQCOMMA DQTEXT +DQCSVTEXT TEXT WS @@ -74,4 +89,4 @@ mode names: DEFAULT_MODE atn: -[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 2, 22, 136, 8, 1, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 4, 13, 9, 13, 4, 14, 9, 14, 4, 15, 9, 15, 4, 16, 9, 16, 4, 17, 9, 17, 4, 18, 9, 18, 4, 19, 9, 19, 4, 20, 9, 20, 4, 21, 9, 21, 3, 2, 3, 2, 3, 3, 3, 3, 3, 4, 3, 4, 3, 4, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 7, 3, 7, 3, 8, 3, 8, 3, 8, 3, 9, 3, 9, 3, 10, 3, 10, 3, 10, 3, 11, 3, 11, 3, 12, 3, 12, 3, 13, 3, 13, 3, 14, 3, 14, 3, 15, 3, 15, 3, 16, 5, 16, 83, 10, 16, 3, 16, 6, 16, 86, 10, 16, 13, 16, 14, 16, 87, 3, 16, 3, 16, 6, 16, 92, 10, 16, 13, 16, 14, 16, 93, 5, 16, 96, 10, 16, 3, 17, 3, 17, 7, 17, 100, 10, 17, 12, 17, 14, 17, 103, 11, 17, 3, 17, 3, 17, 3, 18, 3, 18, 7, 18, 109, 10, 18, 12, 18, 14, 18, 112, 11, 18, 3, 18, 3, 18, 3, 19, 3, 19, 7, 19, 118, 10, 19, 12, 19, 14, 19, 121, 11, 19, 3, 19, 3, 19, 3, 20, 6, 20, 126, 10, 20, 13, 20, 14, 20, 127, 3, 21, 6, 21, 131, 10, 21, 13, 21, 14, 21, 132, 3, 21, 3, 21, 5, 101, 110, 119, 2, 22, 3, 3, 5, 4, 7, 5, 9, 6, 11, 7, 13, 8, 15, 9, 17, 10, 19, 11, 21, 12, 23, 13, 25, 14, 27, 15, 29, 16, 31, 17, 33, 18, 35, 19, 37, 20, 39, 21, 41, 22, 3, 2, 8, 4, 2, 35, 35, 96, 96, 3, 2, 50, 59, 3, 2, 41, 41, 3, 2, 36, 36, 7, 2, 46, 46, 50, 59, 67, 92, 97, 97, 99, 124, 5, 2, 11, 12, 14, 15, 34, 34, 2, 144, 2, 3, 3, 2, 2, 2, 2, 5, 3, 2, 2, 2, 2, 7, 3, 2, 2, 2, 2, 9, 3, 2, 2, 2, 2, 11, 3, 2, 2, 2, 2, 13, 3, 2, 2, 2, 2, 15, 3, 2, 2, 2, 2, 17, 3, 2, 2, 2, 2, 19, 3, 2, 2, 2, 2, 21, 3, 2, 2, 2, 2, 23, 3, 2, 2, 2, 2, 25, 3, 2, 2, 2, 2, 27, 3, 2, 2, 2, 2, 29, 3, 2, 2, 2, 2, 31, 3, 2, 2, 2, 2, 33, 3, 2, 2, 2, 2, 35, 3, 2, 2, 2, 2, 37, 3, 2, 2, 2, 2, 39, 3, 2, 2, 2, 2, 41, 3, 2, 2, 2, 3, 43, 3, 2, 2, 2, 5, 45, 3, 2, 2, 2, 7, 47, 3, 2, 2, 2, 9, 50, 3, 2, 2, 2, 11, 55, 3, 2, 2, 2, 13, 61, 3, 2, 2, 2, 15, 63, 3, 2, 2, 2, 17, 66, 3, 2, 2, 2, 19, 68, 3, 2, 2, 2, 21, 71, 3, 2, 2, 2, 23, 73, 3, 2, 2, 2, 25, 75, 3, 2, 2, 2, 27, 77, 3, 2, 2, 2, 29, 79, 3, 2, 2, 2, 31, 82, 3, 2, 2, 2, 33, 97, 3, 2, 2, 2, 35, 106, 3, 2, 2, 2, 37, 115, 3, 2, 2, 2, 39, 125, 3, 2, 2, 2, 41, 130, 3, 2, 2, 2, 43, 44, 7, 40, 2, 2, 44, 4, 3, 2, 2, 2, 45, 46, 7, 126, 2, 2, 46, 6, 3, 2, 2, 2, 47, 48, 7, 38, 2, 2, 48, 49, 7, 35, 2, 2, 49, 8, 3, 2, 2, 2, 50, 51, 7, 118, 2, 2, 51, 52, 7, 116, 2, 2, 52, 53, 7, 119, 2, 2, 53, 54, 7, 103, 2, 2, 54, 10, 3, 2, 2, 2, 55, 56, 7, 104, 2, 2, 56, 57, 7, 99, 2, 2, 57, 58, 7, 110, 2, 2, 58, 59, 7, 117, 2, 2, 59, 60, 7, 103, 2, 2, 60, 12, 3, 2, 2, 2, 61, 62, 7, 64, 2, 2, 62, 14, 3, 2, 2, 2, 63, 64, 7, 64, 2, 2, 64, 65, 7, 63, 2, 2, 65, 16, 3, 2, 2, 2, 66, 67, 7, 62, 2, 2, 67, 18, 3, 2, 2, 2, 68, 69, 7, 62, 2, 2, 69, 70, 7, 63, 2, 2, 70, 20, 3, 2, 2, 2, 71, 72, 7, 63, 2, 2, 72, 22, 3, 2, 2, 2, 73, 74, 9, 2, 2, 2, 74, 24, 3, 2, 2, 2, 75, 76, 7, 128, 2, 2, 76, 26, 3, 2, 2, 2, 77, 78, 7, 42, 2, 2, 78, 28, 3, 2, 2, 2, 79, 80, 7, 43, 2, 2, 80, 30, 3, 2, 2, 2, 81, 83, 7, 47, 2, 2, 82, 81, 3, 2, 2, 2, 82, 83, 3, 2, 2, 2, 83, 85, 3, 2, 2, 2, 84, 86, 9, 3, 2, 2, 85, 84, 3, 2, 2, 2, 86, 87, 3, 2, 2, 2, 87, 85, 3, 2, 2, 2, 87, 88, 3, 2, 2, 2, 88, 95, 3, 2, 2, 2, 89, 91, 7, 48, 2, 2, 90, 92, 9, 3, 2, 2, 91, 90, 3, 2, 2, 2, 92, 93, 3, 2, 2, 2, 93, 91, 3, 2, 2, 2, 93, 94, 3, 2, 2, 2, 94, 96, 3, 2, 2, 2, 95, 89, 3, 2, 2, 2, 95, 96, 3, 2, 2, 2, 96, 32, 3, 2, 2, 2, 97, 101, 7, 66, 2, 2, 98, 100, 11, 2, 2, 2, 99, 98, 3, 2, 2, 2, 100, 103, 3, 2, 2, 2, 101, 102, 3, 2, 2, 2, 101, 99, 3, 2, 2, 2, 102, 104, 3, 2, 2, 2, 103, 101, 3, 2, 2, 2, 104, 105, 7, 66, 2, 2, 105, 34, 3, 2, 2, 2, 106, 110, 9, 4, 2, 2, 107, 109, 11, 2, 2, 2, 108, 107, 3, 2, 2, 2, 109, 112, 3, 2, 2, 2, 110, 111, 3, 2, 2, 2, 110, 108, 3, 2, 2, 2, 111, 113, 3, 2, 2, 2, 112, 110, 3, 2, 2, 2, 113, 114, 9, 4, 2, 2, 114, 36, 3, 2, 2, 2, 115, 119, 9, 5, 2, 2, 116, 118, 11, 2, 2, 2, 117, 116, 3, 2, 2, 2, 118, 121, 3, 2, 2, 2, 119, 120, 3, 2, 2, 2, 119, 117, 3, 2, 2, 2, 120, 122, 3, 2, 2, 2, 121, 119, 3, 2, 2, 2, 122, 123, 9, 5, 2, 2, 123, 38, 3, 2, 2, 2, 124, 126, 9, 6, 2, 2, 125, 124, 3, 2, 2, 2, 126, 127, 3, 2, 2, 2, 127, 125, 3, 2, 2, 2, 127, 128, 3, 2, 2, 2, 128, 40, 3, 2, 2, 2, 129, 131, 9, 7, 2, 2, 130, 129, 3, 2, 2, 2, 131, 132, 3, 2, 2, 2, 132, 130, 3, 2, 2, 2, 132, 133, 3, 2, 2, 2, 133, 134, 3, 2, 2, 2, 134, 135, 8, 21, 2, 2, 135, 42, 3, 2, 2, 2, 12, 2, 82, 87, 93, 95, 101, 110, 119, 127, 132, 3, 8, 2, 2] \ No newline at end of file +[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 2, 27, 188, 8, 1, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 4, 13, 9, 13, 4, 14, 9, 14, 4, 15, 9, 15, 4, 16, 9, 16, 4, 17, 9, 17, 4, 18, 9, 18, 4, 19, 9, 19, 4, 20, 9, 20, 4, 21, 9, 21, 4, 22, 9, 22, 4, 23, 9, 23, 4, 24, 9, 24, 4, 25, 9, 25, 4, 26, 9, 26, 3, 2, 3, 2, 3, 3, 3, 3, 3, 4, 3, 4, 3, 4, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 7, 3, 7, 3, 8, 3, 8, 3, 8, 3, 9, 3, 9, 3, 10, 3, 10, 3, 10, 3, 11, 3, 11, 3, 12, 3, 12, 3, 13, 3, 13, 3, 14, 3, 14, 3, 15, 3, 15, 3, 16, 5, 16, 93, 10, 16, 3, 16, 6, 16, 96, 10, 16, 13, 16, 14, 16, 97, 3, 16, 3, 16, 6, 16, 102, 10, 16, 13, 16, 14, 16, 103, 5, 16, 106, 10, 16, 3, 17, 3, 17, 7, 17, 110, 10, 17, 12, 17, 14, 17, 113, 11, 17, 3, 17, 3, 17, 3, 18, 3, 18, 3, 19, 3, 19, 3, 19, 3, 20, 3, 20, 7, 20, 124, 10, 20, 12, 20, 14, 20, 127, 11, 20, 3, 20, 3, 20, 3, 21, 3, 21, 7, 21, 133, 10, 21, 12, 21, 14, 21, 136, 11, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 7, 21, 143, 10, 21, 12, 21, 14, 21, 146, 11, 21, 3, 22, 3, 22, 3, 22, 3, 23, 3, 23, 7, 23, 153, 10, 23, 12, 23, 14, 23, 156, 11, 23, 3, 23, 3, 23, 3, 24, 3, 24, 7, 24, 162, 10, 24, 12, 24, 14, 24, 165, 11, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 7, 24, 172, 10, 24, 12, 24, 14, 24, 175, 11, 24, 3, 25, 6, 25, 178, 10, 25, 13, 25, 14, 25, 179, 3, 26, 6, 26, 183, 10, 26, 13, 26, 14, 26, 184, 3, 26, 3, 26, 5, 111, 125, 154, 2, 27, 3, 3, 5, 4, 7, 5, 9, 6, 11, 7, 13, 8, 15, 9, 17, 10, 19, 11, 21, 12, 23, 13, 25, 14, 27, 15, 29, 16, 31, 17, 33, 18, 35, 19, 37, 20, 39, 21, 41, 22, 43, 23, 45, 24, 47, 25, 49, 26, 51, 27, 3, 2, 8, 4, 2, 35, 35, 96, 96, 3, 2, 50, 59, 3, 2, 41, 41, 3, 2, 36, 36, 7, 2, 46, 46, 50, 59, 67, 92, 97, 97, 99, 124, 5, 2, 11, 12, 14, 15, 34, 34, 2, 200, 2, 3, 3, 2, 2, 2, 2, 5, 3, 2, 2, 2, 2, 7, 3, 2, 2, 2, 2, 9, 3, 2, 2, 2, 2, 11, 3, 2, 2, 2, 2, 13, 3, 2, 2, 2, 2, 15, 3, 2, 2, 2, 2, 17, 3, 2, 2, 2, 2, 19, 3, 2, 2, 2, 2, 21, 3, 2, 2, 2, 2, 23, 3, 2, 2, 2, 2, 25, 3, 2, 2, 2, 2, 27, 3, 2, 2, 2, 2, 29, 3, 2, 2, 2, 2, 31, 3, 2, 2, 2, 2, 33, 3, 2, 2, 2, 2, 35, 3, 2, 2, 2, 2, 37, 3, 2, 2, 2, 2, 39, 3, 2, 2, 2, 2, 41, 3, 2, 2, 2, 2, 43, 3, 2, 2, 2, 2, 45, 3, 2, 2, 2, 2, 47, 3, 2, 2, 2, 2, 49, 3, 2, 2, 2, 2, 51, 3, 2, 2, 2, 3, 53, 3, 2, 2, 2, 5, 55, 3, 2, 2, 2, 7, 57, 3, 2, 2, 2, 9, 60, 3, 2, 2, 2, 11, 65, 3, 2, 2, 2, 13, 71, 3, 2, 2, 2, 15, 73, 3, 2, 2, 2, 17, 76, 3, 2, 2, 2, 19, 78, 3, 2, 2, 2, 21, 81, 3, 2, 2, 2, 23, 83, 3, 2, 2, 2, 25, 85, 3, 2, 2, 2, 27, 87, 3, 2, 2, 2, 29, 89, 3, 2, 2, 2, 31, 92, 3, 2, 2, 2, 33, 107, 3, 2, 2, 2, 35, 116, 3, 2, 2, 2, 37, 118, 3, 2, 2, 2, 39, 121, 3, 2, 2, 2, 41, 130, 3, 2, 2, 2, 43, 147, 3, 2, 2, 2, 45, 150, 3, 2, 2, 2, 47, 159, 3, 2, 2, 2, 49, 177, 3, 2, 2, 2, 51, 182, 3, 2, 2, 2, 53, 54, 7, 40, 2, 2, 54, 4, 3, 2, 2, 2, 55, 56, 7, 126, 2, 2, 56, 6, 3, 2, 2, 2, 57, 58, 7, 38, 2, 2, 58, 59, 7, 35, 2, 2, 59, 8, 3, 2, 2, 2, 60, 61, 7, 118, 2, 2, 61, 62, 7, 116, 2, 2, 62, 63, 7, 119, 2, 2, 63, 64, 7, 103, 2, 2, 64, 10, 3, 2, 2, 2, 65, 66, 7, 104, 2, 2, 66, 67, 7, 99, 2, 2, 67, 68, 7, 110, 2, 2, 68, 69, 7, 117, 2, 2, 69, 70, 7, 103, 2, 2, 70, 12, 3, 2, 2, 2, 71, 72, 7, 64, 2, 2, 72, 14, 3, 2, 2, 2, 73, 74, 7, 64, 2, 2, 74, 75, 7, 63, 2, 2, 75, 16, 3, 2, 2, 2, 76, 77, 7, 62, 2, 2, 77, 18, 3, 2, 2, 2, 78, 79, 7, 62, 2, 2, 79, 80, 7, 63, 2, 2, 80, 20, 3, 2, 2, 2, 81, 82, 7, 63, 2, 2, 82, 22, 3, 2, 2, 2, 83, 84, 9, 2, 2, 2, 84, 24, 3, 2, 2, 2, 85, 86, 7, 128, 2, 2, 86, 26, 3, 2, 2, 2, 87, 88, 7, 42, 2, 2, 88, 28, 3, 2, 2, 2, 89, 90, 7, 43, 2, 2, 90, 30, 3, 2, 2, 2, 91, 93, 7, 47, 2, 2, 92, 91, 3, 2, 2, 2, 92, 93, 3, 2, 2, 2, 93, 95, 3, 2, 2, 2, 94, 96, 9, 3, 2, 2, 95, 94, 3, 2, 2, 2, 96, 97, 3, 2, 2, 2, 97, 95, 3, 2, 2, 2, 97, 98, 3, 2, 2, 2, 98, 105, 3, 2, 2, 2, 99, 101, 7, 48, 2, 2, 100, 102, 9, 3, 2, 2, 101, 100, 3, 2, 2, 2, 102, 103, 3, 2, 2, 2, 103, 101, 3, 2, 2, 2, 103, 104, 3, 2, 2, 2, 104, 106, 3, 2, 2, 2, 105, 99, 3, 2, 2, 2, 105, 106, 3, 2, 2, 2, 106, 32, 3, 2, 2, 2, 107, 111, 7, 66, 2, 2, 108, 110, 11, 2, 2, 2, 109, 108, 3, 2, 2, 2, 110, 113, 3, 2, 2, 2, 111, 112, 3, 2, 2, 2, 111, 109, 3, 2, 2, 2, 112, 114, 3, 2, 2, 2, 113, 111, 3, 2, 2, 2, 114, 115, 7, 66, 2, 2, 115, 34, 3, 2, 2, 2, 116, 117, 7, 46, 2, 2, 117, 36, 3, 2, 2, 2, 118, 119, 7, 41, 2, 2, 119, 120, 7, 46, 2, 2, 120, 38, 3, 2, 2, 2, 121, 125, 9, 4, 2, 2, 122, 124, 11, 2, 2, 2, 123, 122, 3, 2, 2, 2, 124, 127, 3, 2, 2, 2, 125, 126, 3, 2, 2, 2, 125, 123, 3, 2, 2, 2, 126, 128, 3, 2, 2, 2, 127, 125, 3, 2, 2, 2, 128, 129, 9, 4, 2, 2, 129, 40, 3, 2, 2, 2, 130, 134, 9, 4, 2, 2, 131, 133, 10, 4, 2, 2, 132, 131, 3, 2, 2, 2, 133, 136, 3, 2, 2, 2, 134, 132, 3, 2, 2, 2, 134, 135, 3, 2, 2, 2, 135, 137, 3, 2, 2, 2, 136, 134, 3, 2, 2, 2, 137, 138, 5, 37, 19, 2, 138, 144, 5, 39, 20, 2, 139, 140, 5, 35, 18, 2, 140, 141, 5, 39, 20, 2, 141, 143, 3, 2, 2, 2, 142, 139, 3, 2, 2, 2, 143, 146, 3, 2, 2, 2, 144, 142, 3, 2, 2, 2, 144, 145, 3, 2, 2, 2, 145, 42, 3, 2, 2, 2, 146, 144, 3, 2, 2, 2, 147, 148, 7, 36, 2, 2, 148, 149, 7, 46, 2, 2, 149, 44, 3, 2, 2, 2, 150, 154, 9, 5, 2, 2, 151, 153, 11, 2, 2, 2, 152, 151, 3, 2, 2, 2, 153, 156, 3, 2, 2, 2, 154, 155, 3, 2, 2, 2, 154, 152, 3, 2, 2, 2, 155, 157, 3, 2, 2, 2, 156, 154, 3, 2, 2, 2, 157, 158, 9, 5, 2, 2, 158, 46, 3, 2, 2, 2, 159, 163, 9, 5, 2, 2, 160, 162, 10, 5, 2, 2, 161, 160, 3, 2, 2, 2, 162, 165, 3, 2, 2, 2, 163, 161, 3, 2, 2, 2, 163, 164, 3, 2, 2, 2, 164, 166, 3, 2, 2, 2, 165, 163, 3, 2, 2, 2, 166, 167, 5, 43, 22, 2, 167, 173, 5, 45, 23, 2, 168, 169, 5, 35, 18, 2, 169, 170, 5, 45, 23, 2, 170, 172, 3, 2, 2, 2, 171, 168, 3, 2, 2, 2, 172, 175, 3, 2, 2, 2, 173, 171, 3, 2, 2, 2, 173, 174, 3, 2, 2, 2, 174, 48, 3, 2, 2, 2, 175, 173, 3, 2, 2, 2, 176, 178, 9, 6, 2, 2, 177, 176, 3, 2, 2, 2, 178, 179, 3, 2, 2, 2, 179, 177, 3, 2, 2, 2, 179, 180, 3, 2, 2, 2, 180, 50, 3, 2, 2, 2, 181, 183, 9, 7, 2, 2, 182, 181, 3, 2, 2, 2, 183, 184, 3, 2, 2, 2, 184, 182, 3, 2, 2, 2, 184, 185, 3, 2, 2, 2, 185, 186, 3, 2, 2, 2, 186, 187, 8, 26, 2, 2, 187, 52, 3, 2, 2, 2, 16, 2, 92, 97, 103, 105, 111, 125, 134, 144, 154, 163, 173, 179, 184, 3, 8, 2, 2] \ No newline at end of file diff --git a/org.adempiere.base/src/org/idempiere/expression/logic/SimpleBooleanLexer.java b/org.adempiere.base/src/org/idempiere/expression/logic/SimpleBooleanLexer.java index 45c454f9f6..190af39ec3 100644 --- a/org.adempiere.base/src/org/idempiere/expression/logic/SimpleBooleanLexer.java +++ b/org.adempiere.base/src/org/idempiere/expression/logic/SimpleBooleanLexer.java @@ -20,8 +20,8 @@ public class SimpleBooleanLexer extends Lexer { new PredictionContextCache(); public static final int AND=1, OR=2, NOT=3, TRUE=4, FALSE=5, GT=6, GE=7, LT=8, LE=9, EQ=10, NE=11, - RE=12, LPAREN=13, RPAREN=14, DECIMAL=15, VARIABLE=16, QTEXT=17, DQTEXT=18, - TEXT=19, WS=20; + RE=12, LPAREN=13, RPAREN=14, DECIMAL=15, VARIABLE=16, COMMA=17, QCOMMA=18, + QTEXT=19, QCSVTEXT=20, DQCOMMA=21, DQTEXT=22, DQCSVTEXT=23, TEXT=24, WS=25; public static String[] channelNames = { "DEFAULT_TOKEN_CHANNEL", "HIDDEN" }; @@ -33,8 +33,8 @@ public class SimpleBooleanLexer extends Lexer { private static String[] makeRuleNames() { return new String[] { "AND", "OR", "NOT", "TRUE", "FALSE", "GT", "GE", "LT", "LE", "EQ", "NE", - "RE", "LPAREN", "RPAREN", "DECIMAL", "VARIABLE", "QTEXT", "DQTEXT", "TEXT", - "WS" + "RE", "LPAREN", "RPAREN", "DECIMAL", "VARIABLE", "COMMA", "QCOMMA", "QTEXT", + "QCSVTEXT", "DQCOMMA", "DQTEXT", "DQCSVTEXT", "TEXT", "WS" }; } public static final String[] ruleNames = makeRuleNames(); @@ -42,15 +42,16 @@ public class SimpleBooleanLexer extends Lexer { private static String[] makeLiteralNames() { return new String[] { null, "'&'", "'|'", "'$!'", "'true'", "'false'", "'>'", "'>='", "'<'", - "'<='", "'='", null, "'~'", "'('", "')'" + "'<='", "'='", null, "'~'", "'('", "')'", null, null, "','", "'','", + null, null, "'\",'" }; } private static final String[] _LITERAL_NAMES = makeLiteralNames(); private static String[] makeSymbolicNames() { return new String[] { null, "AND", "OR", "NOT", "TRUE", "FALSE", "GT", "GE", "LT", "LE", "EQ", - "NE", "RE", "LPAREN", "RPAREN", "DECIMAL", "VARIABLE", "QTEXT", "DQTEXT", - "TEXT", "WS" + "NE", "RE", "LPAREN", "RPAREN", "DECIMAL", "VARIABLE", "COMMA", "QCOMMA", + "QTEXT", "QCSVTEXT", "DQCOMMA", "DQTEXT", "DQCSVTEXT", "TEXT", "WS" }; } private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames(); @@ -112,43 +113,65 @@ public class SimpleBooleanLexer extends Lexer { public ATN getATN() { return _ATN; } public static final String _serializedATN = - "\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\2\26\u0088\b\1\4\2"+ + "\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\2\33\u00bc\b\1\4\2"+ "\t\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\4\t\t\t\4\n\t\n\4"+ "\13\t\13\4\f\t\f\4\r\t\r\4\16\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22"+ - "\t\22\4\23\t\23\4\24\t\24\4\25\t\25\3\2\3\2\3\3\3\3\3\4\3\4\3\4\3\5\3"+ - "\5\3\5\3\5\3\5\3\6\3\6\3\6\3\6\3\6\3\6\3\7\3\7\3\b\3\b\3\b\3\t\3\t\3\n"+ - "\3\n\3\n\3\13\3\13\3\f\3\f\3\r\3\r\3\16\3\16\3\17\3\17\3\20\5\20S\n\20"+ - "\3\20\6\20V\n\20\r\20\16\20W\3\20\3\20\6\20\\\n\20\r\20\16\20]\5\20`\n"+ - "\20\3\21\3\21\7\21d\n\21\f\21\16\21g\13\21\3\21\3\21\3\22\3\22\7\22m\n"+ - "\22\f\22\16\22p\13\22\3\22\3\22\3\23\3\23\7\23v\n\23\f\23\16\23y\13\23"+ - "\3\23\3\23\3\24\6\24~\n\24\r\24\16\24\177\3\25\6\25\u0083\n\25\r\25\16"+ - "\25\u0084\3\25\3\25\5enw\2\26\3\3\5\4\7\5\t\6\13\7\r\b\17\t\21\n\23\13"+ - "\25\f\27\r\31\16\33\17\35\20\37\21!\22#\23%\24\'\25)\26\3\2\b\4\2##``"+ - "\3\2\62;\3\2))\3\2$$\7\2..\62;C\\aac|\5\2\13\f\16\17\"\"\2\u0090\2\3\3"+ - "\2\2\2\2\5\3\2\2\2\2\7\3\2\2\2\2\t\3\2\2\2\2\13\3\2\2\2\2\r\3\2\2\2\2"+ - "\17\3\2\2\2\2\21\3\2\2\2\2\23\3\2\2\2\2\25\3\2\2\2\2\27\3\2\2\2\2\31\3"+ - "\2\2\2\2\33\3\2\2\2\2\35\3\2\2\2\2\37\3\2\2\2\2!\3\2\2\2\2#\3\2\2\2\2"+ - "%\3\2\2\2\2\'\3\2\2\2\2)\3\2\2\2\3+\3\2\2\2\5-\3\2\2\2\7/\3\2\2\2\t\62"+ - "\3\2\2\2\13\67\3\2\2\2\r=\3\2\2\2\17?\3\2\2\2\21B\3\2\2\2\23D\3\2\2\2"+ - "\25G\3\2\2\2\27I\3\2\2\2\31K\3\2\2\2\33M\3\2\2\2\35O\3\2\2\2\37R\3\2\2"+ - "\2!a\3\2\2\2#j\3\2\2\2%s\3\2\2\2\'}\3\2\2\2)\u0082\3\2\2\2+,\7(\2\2,\4"+ - "\3\2\2\2-.\7~\2\2.\6\3\2\2\2/\60\7&\2\2\60\61\7#\2\2\61\b\3\2\2\2\62\63"+ - "\7v\2\2\63\64\7t\2\2\64\65\7w\2\2\65\66\7g\2\2\66\n\3\2\2\2\678\7h\2\2"+ - "89\7c\2\29:\7n\2\2:;\7u\2\2;<\7g\2\2<\f\3\2\2\2=>\7@\2\2>\16\3\2\2\2?"+ - "@\7@\2\2@A\7?\2\2A\20\3\2\2\2BC\7>\2\2C\22\3\2\2\2DE\7>\2\2EF\7?\2\2F"+ - "\24\3\2\2\2GH\7?\2\2H\26\3\2\2\2IJ\t\2\2\2J\30\3\2\2\2KL\7\u0080\2\2L"+ - "\32\3\2\2\2MN\7*\2\2N\34\3\2\2\2OP\7+\2\2P\36\3\2\2\2QS\7/\2\2RQ\3\2\2"+ - "\2RS\3\2\2\2SU\3\2\2\2TV\t\3\2\2UT\3\2\2\2VW\3\2\2\2WU\3\2\2\2WX\3\2\2"+ - "\2X_\3\2\2\2Y[\7\60\2\2Z\\\t\3\2\2[Z\3\2\2\2\\]\3\2\2\2][\3\2\2\2]^\3"+ - "\2\2\2^`\3\2\2\2_Y\3\2\2\2_`\3\2\2\2` \3\2\2\2ae\7B\2\2bd\13\2\2\2cb\3"+ - "\2\2\2dg\3\2\2\2ef\3\2\2\2ec\3\2\2\2fh\3\2\2\2ge\3\2\2\2hi\7B\2\2i\"\3"+ - "\2\2\2jn\t\4\2\2km\13\2\2\2lk\3\2\2\2mp\3\2\2\2no\3\2\2\2nl\3\2\2\2oq"+ - "\3\2\2\2pn\3\2\2\2qr\t\4\2\2r$\3\2\2\2sw\t\5\2\2tv\13\2\2\2ut\3\2\2\2"+ - "vy\3\2\2\2wx\3\2\2\2wu\3\2\2\2xz\3\2\2\2yw\3\2\2\2z{\t\5\2\2{&\3\2\2\2"+ - "|~\t\6\2\2}|\3\2\2\2~\177\3\2\2\2\177}\3\2\2\2\177\u0080\3\2\2\2\u0080"+ - "(\3\2\2\2\u0081\u0083\t\7\2\2\u0082\u0081\3\2\2\2\u0083\u0084\3\2\2\2"+ - "\u0084\u0082\3\2\2\2\u0084\u0085\3\2\2\2\u0085\u0086\3\2\2\2\u0086\u0087"+ - "\b\25\2\2\u0087*\3\2\2\2\f\2RW]_enw\177\u0084\3\b\2\2"; + "\t\22\4\23\t\23\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t\27\4\30\t\30\4\31"+ + "\t\31\4\32\t\32\3\2\3\2\3\3\3\3\3\4\3\4\3\4\3\5\3\5\3\5\3\5\3\5\3\6\3"+ + "\6\3\6\3\6\3\6\3\6\3\7\3\7\3\b\3\b\3\b\3\t\3\t\3\n\3\n\3\n\3\13\3\13\3"+ + "\f\3\f\3\r\3\r\3\16\3\16\3\17\3\17\3\20\5\20]\n\20\3\20\6\20`\n\20\r\20"+ + "\16\20a\3\20\3\20\6\20f\n\20\r\20\16\20g\5\20j\n\20\3\21\3\21\7\21n\n"+ + "\21\f\21\16\21q\13\21\3\21\3\21\3\22\3\22\3\23\3\23\3\23\3\24\3\24\7\24"+ + "|\n\24\f\24\16\24\177\13\24\3\24\3\24\3\25\3\25\7\25\u0085\n\25\f\25\16"+ + "\25\u0088\13\25\3\25\3\25\3\25\3\25\3\25\7\25\u008f\n\25\f\25\16\25\u0092"+ + "\13\25\3\26\3\26\3\26\3\27\3\27\7\27\u0099\n\27\f\27\16\27\u009c\13\27"+ + "\3\27\3\27\3\30\3\30\7\30\u00a2\n\30\f\30\16\30\u00a5\13\30\3\30\3\30"+ + "\3\30\3\30\3\30\7\30\u00ac\n\30\f\30\16\30\u00af\13\30\3\31\6\31\u00b2"+ + "\n\31\r\31\16\31\u00b3\3\32\6\32\u00b7\n\32\r\32\16\32\u00b8\3\32\3\32"+ + "\5o}\u009a\2\33\3\3\5\4\7\5\t\6\13\7\r\b\17\t\21\n\23\13\25\f\27\r\31"+ + "\16\33\17\35\20\37\21!\22#\23%\24\'\25)\26+\27-\30/\31\61\32\63\33\3\2"+ + "\b\4\2##``\3\2\62;\3\2))\3\2$$\7\2..\62;C\\aac|\5\2\13\f\16\17\"\"\2\u00c8"+ + "\2\3\3\2\2\2\2\5\3\2\2\2\2\7\3\2\2\2\2\t\3\2\2\2\2\13\3\2\2\2\2\r\3\2"+ + "\2\2\2\17\3\2\2\2\2\21\3\2\2\2\2\23\3\2\2\2\2\25\3\2\2\2\2\27\3\2\2\2"+ + "\2\31\3\2\2\2\2\33\3\2\2\2\2\35\3\2\2\2\2\37\3\2\2\2\2!\3\2\2\2\2#\3\2"+ + "\2\2\2%\3\2\2\2\2\'\3\2\2\2\2)\3\2\2\2\2+\3\2\2\2\2-\3\2\2\2\2/\3\2\2"+ + "\2\2\61\3\2\2\2\2\63\3\2\2\2\3\65\3\2\2\2\5\67\3\2\2\2\79\3\2\2\2\t<\3"+ + "\2\2\2\13A\3\2\2\2\rG\3\2\2\2\17I\3\2\2\2\21L\3\2\2\2\23N\3\2\2\2\25Q"+ + "\3\2\2\2\27S\3\2\2\2\31U\3\2\2\2\33W\3\2\2\2\35Y\3\2\2\2\37\\\3\2\2\2"+ + "!k\3\2\2\2#t\3\2\2\2%v\3\2\2\2\'y\3\2\2\2)\u0082\3\2\2\2+\u0093\3\2\2"+ + "\2-\u0096\3\2\2\2/\u009f\3\2\2\2\61\u00b1\3\2\2\2\63\u00b6\3\2\2\2\65"+ + "\66\7(\2\2\66\4\3\2\2\2\678\7~\2\28\6\3\2\2\29:\7&\2\2:;\7#\2\2;\b\3\2"+ + "\2\2<=\7v\2\2=>\7t\2\2>?\7w\2\2?@\7g\2\2@\n\3\2\2\2AB\7h\2\2BC\7c\2\2"+ + "CD\7n\2\2DE\7u\2\2EF\7g\2\2F\f\3\2\2\2GH\7@\2\2H\16\3\2\2\2IJ\7@\2\2J"+ + "K\7?\2\2K\20\3\2\2\2LM\7>\2\2M\22\3\2\2\2NO\7>\2\2OP\7?\2\2P\24\3\2\2"+ + "\2QR\7?\2\2R\26\3\2\2\2ST\t\2\2\2T\30\3\2\2\2UV\7\u0080\2\2V\32\3\2\2"+ + "\2WX\7*\2\2X\34\3\2\2\2YZ\7+\2\2Z\36\3\2\2\2[]\7/\2\2\\[\3\2\2\2\\]\3"+ + "\2\2\2]_\3\2\2\2^`\t\3\2\2_^\3\2\2\2`a\3\2\2\2a_\3\2\2\2ab\3\2\2\2bi\3"+ + "\2\2\2ce\7\60\2\2df\t\3\2\2ed\3\2\2\2fg\3\2\2\2ge\3\2\2\2gh\3\2\2\2hj"+ + "\3\2\2\2ic\3\2\2\2ij\3\2\2\2j \3\2\2\2ko\7B\2\2ln\13\2\2\2ml\3\2\2\2n"+ + "q\3\2\2\2op\3\2\2\2om\3\2\2\2pr\3\2\2\2qo\3\2\2\2rs\7B\2\2s\"\3\2\2\2"+ + "tu\7.\2\2u$\3\2\2\2vw\7)\2\2wx\7.\2\2x&\3\2\2\2y}\t\4\2\2z|\13\2\2\2{"+ + "z\3\2\2\2|\177\3\2\2\2}~\3\2\2\2}{\3\2\2\2~\u0080\3\2\2\2\177}\3\2\2\2"+ + "\u0080\u0081\t\4\2\2\u0081(\3\2\2\2\u0082\u0086\t\4\2\2\u0083\u0085\n"+ + "\4\2\2\u0084\u0083\3\2\2\2\u0085\u0088\3\2\2\2\u0086\u0084\3\2\2\2\u0086"+ + "\u0087\3\2\2\2\u0087\u0089\3\2\2\2\u0088\u0086\3\2\2\2\u0089\u008a\5%"+ + "\23\2\u008a\u0090\5\'\24\2\u008b\u008c\5#\22\2\u008c\u008d\5\'\24\2\u008d"+ + "\u008f\3\2\2\2\u008e\u008b\3\2\2\2\u008f\u0092\3\2\2\2\u0090\u008e\3\2"+ + "\2\2\u0090\u0091\3\2\2\2\u0091*\3\2\2\2\u0092\u0090\3\2\2\2\u0093\u0094"+ + "\7$\2\2\u0094\u0095\7.\2\2\u0095,\3\2\2\2\u0096\u009a\t\5\2\2\u0097\u0099"+ + "\13\2\2\2\u0098\u0097\3\2\2\2\u0099\u009c\3\2\2\2\u009a\u009b\3\2\2\2"+ + "\u009a\u0098\3\2\2\2\u009b\u009d\3\2\2\2\u009c\u009a\3\2\2\2\u009d\u009e"+ + "\t\5\2\2\u009e.\3\2\2\2\u009f\u00a3\t\5\2\2\u00a0\u00a2\n\5\2\2\u00a1"+ + "\u00a0\3\2\2\2\u00a2\u00a5\3\2\2\2\u00a3\u00a1\3\2\2\2\u00a3\u00a4\3\2"+ + "\2\2\u00a4\u00a6\3\2\2\2\u00a5\u00a3\3\2\2\2\u00a6\u00a7\5+\26\2\u00a7"+ + "\u00ad\5-\27\2\u00a8\u00a9\5#\22\2\u00a9\u00aa\5-\27\2\u00aa\u00ac\3\2"+ + "\2\2\u00ab\u00a8\3\2\2\2\u00ac\u00af\3\2\2\2\u00ad\u00ab\3\2\2\2\u00ad"+ + "\u00ae\3\2\2\2\u00ae\60\3\2\2\2\u00af\u00ad\3\2\2\2\u00b0\u00b2\t\6\2"+ + "\2\u00b1\u00b0\3\2\2\2\u00b2\u00b3\3\2\2\2\u00b3\u00b1\3\2\2\2\u00b3\u00b4"+ + "\3\2\2\2\u00b4\62\3\2\2\2\u00b5\u00b7\t\7\2\2\u00b6\u00b5\3\2\2\2\u00b7"+ + "\u00b8\3\2\2\2\u00b8\u00b6\3\2\2\2\u00b8\u00b9\3\2\2\2\u00b9\u00ba\3\2"+ + "\2\2\u00ba\u00bb\b\32\2\2\u00bb\64\3\2\2\2\20\2\\agio}\u0086\u0090\u009a"+ + "\u00a3\u00ad\u00b3\u00b8\3\b\2\2"; public static final ATN _ATN = new ATNDeserializer().deserialize(_serializedATN.toCharArray()); static { diff --git a/org.adempiere.base/src/org/idempiere/expression/logic/SimpleBooleanLexer.tokens b/org.adempiere.base/src/org/idempiere/expression/logic/SimpleBooleanLexer.tokens index 5d21840047..900a562eb6 100644 --- a/org.adempiere.base/src/org/idempiere/expression/logic/SimpleBooleanLexer.tokens +++ b/org.adempiere.base/src/org/idempiere/expression/logic/SimpleBooleanLexer.tokens @@ -14,10 +14,15 @@ LPAREN=13 RPAREN=14 DECIMAL=15 VARIABLE=16 -QTEXT=17 -DQTEXT=18 -TEXT=19 -WS=20 +COMMA=17 +QCOMMA=18 +QTEXT=19 +QCSVTEXT=20 +DQCOMMA=21 +DQTEXT=22 +DQCSVTEXT=23 +TEXT=24 +WS=25 '&'=1 '|'=2 '$!'=3 @@ -31,3 +36,6 @@ WS=20 '~'=12 '('=13 ')'=14 +','=17 +'\','=18 +'",'=21 diff --git a/org.adempiere.base/src/org/idempiere/expression/logic/SimpleBooleanParser.java b/org.adempiere.base/src/org/idempiere/expression/logic/SimpleBooleanParser.java index b2f711ee71..8cf2760e4c 100644 --- a/org.adempiere.base/src/org/idempiere/expression/logic/SimpleBooleanParser.java +++ b/org.adempiere.base/src/org/idempiere/expression/logic/SimpleBooleanParser.java @@ -20,8 +20,8 @@ public class SimpleBooleanParser extends Parser { new PredictionContextCache(); public static final int AND=1, OR=2, NOT=3, TRUE=4, FALSE=5, GT=6, GE=7, LT=8, LE=9, EQ=10, NE=11, - RE=12, LPAREN=13, RPAREN=14, DECIMAL=15, VARIABLE=16, QTEXT=17, DQTEXT=18, - TEXT=19, WS=20; + RE=12, LPAREN=13, RPAREN=14, DECIMAL=15, VARIABLE=16, COMMA=17, QCOMMA=18, + QTEXT=19, QCSVTEXT=20, DQCOMMA=21, DQTEXT=22, DQCSVTEXT=23, TEXT=24, WS=25; public static final int RULE_parse = 0, RULE_expression = 1, RULE_comparator = 2, RULE_binary = 3, RULE_bool = 4; @@ -35,15 +35,16 @@ public class SimpleBooleanParser extends Parser { private static String[] makeLiteralNames() { return new String[] { null, "'&'", "'|'", "'$!'", "'true'", "'false'", "'>'", "'>='", "'<'", - "'<='", "'='", null, "'~'", "'('", "')'" + "'<='", "'='", null, "'~'", "'('", "')'", null, null, "','", "'','", + null, null, "'\",'" }; } private static final String[] _LITERAL_NAMES = makeLiteralNames(); private static String[] makeSymbolicNames() { return new String[] { null, "AND", "OR", "NOT", "TRUE", "FALSE", "GT", "GE", "LT", "LE", "EQ", - "NE", "RE", "LPAREN", "RPAREN", "DECIMAL", "VARIABLE", "QTEXT", "DQTEXT", - "TEXT", "WS" + "NE", "RE", "LPAREN", "RPAREN", "DECIMAL", "VARIABLE", "COMMA", "QCOMMA", + "QTEXT", "QCSVTEXT", "DQCOMMA", "DQTEXT", "DQCSVTEXT", "TEXT", "WS" }; } private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames(); @@ -187,6 +188,15 @@ public class SimpleBooleanParser extends Parser { else return visitor.visitChildren(this); } } + public static class DoubleQuotedCSVTextContext extends ExpressionContext { + public TerminalNode DQCSVTEXT() { return getToken(SimpleBooleanParser.DQCSVTEXT, 0); } + public DoubleQuotedCSVTextContext(ExpressionContext ctx) { copyFrom(ctx); } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof SimpleBooleanVisitor ) return ((SimpleBooleanVisitor)visitor).visitDoubleQuotedCSVText(this); + else return visitor.visitChildren(this); + } + } public static class ContextVariablesContext extends ExpressionContext { public TerminalNode VARIABLE() { return getToken(SimpleBooleanParser.VARIABLE, 0); } public ContextVariablesContext(ExpressionContext ctx) { copyFrom(ctx); } @@ -196,6 +206,15 @@ public class SimpleBooleanParser extends Parser { else return visitor.visitChildren(this); } } + public static class QuotedCSVTextContext extends ExpressionContext { + public TerminalNode QCSVTEXT() { return getToken(SimpleBooleanParser.QCSVTEXT, 0); } + public QuotedCSVTextContext(ExpressionContext ctx) { copyFrom(ctx); } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof SimpleBooleanVisitor ) return ((SimpleBooleanVisitor)visitor).visitQuotedCSVText(this); + else return visitor.visitChildren(this); + } + } public static class NotExpressionContext extends ExpressionContext { public TerminalNode NOT() { return getToken(SimpleBooleanParser.NOT, 0); } public ExpressionContext expression() { @@ -284,7 +303,7 @@ public class SimpleBooleanParser extends Parser { int _alt; enterOuterAlt(_localctx, 1); { - setState(26); + setState(28); _errHandler.sync(this); switch (_input.LA(1)) { case LPAREN: @@ -309,7 +328,7 @@ public class SimpleBooleanParser extends Parser { setState(18); match(NOT); setState(19); - expression(9); + expression(11); } break; case TRUE: @@ -331,21 +350,39 @@ public class SimpleBooleanParser extends Parser { match(VARIABLE); } break; + case QCSVTEXT: + { + _localctx = new QuotedCSVTextContext(_localctx); + _ctx = _localctx; + _prevctx = _localctx; + setState(22); + match(QCSVTEXT); + } + break; case QTEXT: { _localctx = new QuotedTextContext(_localctx); _ctx = _localctx; _prevctx = _localctx; - setState(22); + setState(23); match(QTEXT); } break; + case DQCSVTEXT: + { + _localctx = new DoubleQuotedCSVTextContext(_localctx); + _ctx = _localctx; + _prevctx = _localctx; + setState(24); + match(DQCSVTEXT); + } + break; case DQTEXT: { _localctx = new DoubleQuotedTextContext(_localctx); _ctx = _localctx; _prevctx = _localctx; - setState(23); + setState(25); match(DQTEXT); } break; @@ -354,7 +391,7 @@ public class SimpleBooleanParser extends Parser { _localctx = new TextContext(_localctx); _ctx = _localctx; _prevctx = _localctx; - setState(24); + setState(26); match(TEXT); } break; @@ -363,7 +400,7 @@ public class SimpleBooleanParser extends Parser { _localctx = new DecimalExpressionContext(_localctx); _ctx = _localctx; _prevctx = _localctx; - setState(25); + setState(27); match(DECIMAL); } break; @@ -371,7 +408,7 @@ public class SimpleBooleanParser extends Parser { throw new NoViableAltException(this); } _ctx.stop = _input.LT(-1); - setState(38); + setState(40); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input,2,_ctx); while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { @@ -379,7 +416,7 @@ public class SimpleBooleanParser extends Parser { if ( _parseListeners!=null ) triggerExitRuleEvent(); _prevctx = _localctx; { - setState(36); + setState(38); _errHandler.sync(this); switch ( getInterpreter().adaptivePredict(_input,1,_ctx) ) { case 1: @@ -387,12 +424,12 @@ public class SimpleBooleanParser extends Parser { _localctx = new ComparatorExpressionContext(new ExpressionContext(_parentctx, _parentState)); ((ComparatorExpressionContext)_localctx).left = _prevctx; pushNewRecursionContext(_localctx, _startState, RULE_expression); - setState(28); - if (!(precpred(_ctx, 8))) throw new FailedPredicateException(this, "precpred(_ctx, 8)"); - setState(29); - ((ComparatorExpressionContext)_localctx).op = comparator(); setState(30); - ((ComparatorExpressionContext)_localctx).right = expression(9); + if (!(precpred(_ctx, 10))) throw new FailedPredicateException(this, "precpred(_ctx, 10)"); + setState(31); + ((ComparatorExpressionContext)_localctx).op = comparator(); + setState(32); + ((ComparatorExpressionContext)_localctx).right = expression(11); } break; case 2: @@ -400,18 +437,18 @@ public class SimpleBooleanParser extends Parser { _localctx = new BinaryExpressionContext(new ExpressionContext(_parentctx, _parentState)); ((BinaryExpressionContext)_localctx).left = _prevctx; pushNewRecursionContext(_localctx, _startState, RULE_expression); - setState(32); - if (!(precpred(_ctx, 7))) throw new FailedPredicateException(this, "precpred(_ctx, 7)"); - setState(33); - ((BinaryExpressionContext)_localctx).op = binary(); setState(34); - ((BinaryExpressionContext)_localctx).right = expression(8); + if (!(precpred(_ctx, 9))) throw new FailedPredicateException(this, "precpred(_ctx, 9)"); + setState(35); + ((BinaryExpressionContext)_localctx).op = binary(); + setState(36); + ((BinaryExpressionContext)_localctx).right = expression(10); } break; } } } - setState(40); + setState(42); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input,2,_ctx); } @@ -454,7 +491,7 @@ public class SimpleBooleanParser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(41); + setState(43); _la = _input.LA(1); if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << GT) | (1L << GE) | (1L << LT) | (1L << LE) | (1L << EQ) | (1L << NE) | (1L << RE))) != 0)) ) { _errHandler.recoverInline(this); @@ -498,7 +535,7 @@ public class SimpleBooleanParser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(43); + setState(45); _la = _input.LA(1); if ( !(_la==AND || _la==OR) ) { _errHandler.recoverInline(this); @@ -542,7 +579,7 @@ public class SimpleBooleanParser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(45); + setState(47); _la = _input.LA(1); if ( !(_la==TRUE || _la==FALSE) ) { _errHandler.recoverInline(this); @@ -575,28 +612,29 @@ public class SimpleBooleanParser extends Parser { private boolean expression_sempred(ExpressionContext _localctx, int predIndex) { switch (predIndex) { case 0: - return precpred(_ctx, 8); + return precpred(_ctx, 10); case 1: - return precpred(_ctx, 7); + return precpred(_ctx, 9); } return true; } public static final String _serializedATN = - "\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3\26\62\4\2\t\2\4\3"+ + "\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3\33\64\4\2\t\2\4\3"+ "\t\3\4\4\t\4\4\5\t\5\4\6\t\6\3\2\3\2\3\2\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3"+ - "\3\3\3\3\3\3\3\3\3\3\3\5\3\35\n\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\7\3"+ - "\'\n\3\f\3\16\3*\13\3\3\4\3\4\3\5\3\5\3\6\3\6\3\6\2\3\4\7\2\4\6\b\n\2"+ - "\5\3\2\b\16\3\2\3\4\3\2\6\7\2\65\2\f\3\2\2\2\4\34\3\2\2\2\6+\3\2\2\2\b"+ - "-\3\2\2\2\n/\3\2\2\2\f\r\5\4\3\2\r\16\7\2\2\3\16\3\3\2\2\2\17\20\b\3\1"+ - "\2\20\21\7\17\2\2\21\22\5\4\3\2\22\23\7\20\2\2\23\35\3\2\2\2\24\25\7\5"+ - "\2\2\25\35\5\4\3\13\26\35\5\n\6\2\27\35\7\22\2\2\30\35\7\23\2\2\31\35"+ - "\7\24\2\2\32\35\7\25\2\2\33\35\7\21\2\2\34\17\3\2\2\2\34\24\3\2\2\2\34"+ - "\26\3\2\2\2\34\27\3\2\2\2\34\30\3\2\2\2\34\31\3\2\2\2\34\32\3\2\2\2\34"+ - "\33\3\2\2\2\35(\3\2\2\2\36\37\f\n\2\2\37 \5\6\4\2 !\5\4\3\13!\'\3\2\2"+ - "\2\"#\f\t\2\2#$\5\b\5\2$%\5\4\3\n%\'\3\2\2\2&\36\3\2\2\2&\"\3\2\2\2\'"+ - "*\3\2\2\2(&\3\2\2\2()\3\2\2\2)\5\3\2\2\2*(\3\2\2\2+,\t\2\2\2,\7\3\2\2"+ - "\2-.\t\3\2\2.\t\3\2\2\2/\60\t\4\2\2\60\13\3\2\2\2\5\34&("; + "\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\5\3\37\n\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3"+ + "\3\3\7\3)\n\3\f\3\16\3,\13\3\3\4\3\4\3\5\3\5\3\6\3\6\3\6\2\3\4\7\2\4\6"+ + "\b\n\2\5\3\2\b\16\3\2\3\4\3\2\6\7\29\2\f\3\2\2\2\4\36\3\2\2\2\6-\3\2\2"+ + "\2\b/\3\2\2\2\n\61\3\2\2\2\f\r\5\4\3\2\r\16\7\2\2\3\16\3\3\2\2\2\17\20"+ + "\b\3\1\2\20\21\7\17\2\2\21\22\5\4\3\2\22\23\7\20\2\2\23\37\3\2\2\2\24"+ + "\25\7\5\2\2\25\37\5\4\3\r\26\37\5\n\6\2\27\37\7\22\2\2\30\37\7\26\2\2"+ + "\31\37\7\25\2\2\32\37\7\31\2\2\33\37\7\30\2\2\34\37\7\32\2\2\35\37\7\21"+ + "\2\2\36\17\3\2\2\2\36\24\3\2\2\2\36\26\3\2\2\2\36\27\3\2\2\2\36\30\3\2"+ + "\2\2\36\31\3\2\2\2\36\32\3\2\2\2\36\33\3\2\2\2\36\34\3\2\2\2\36\35\3\2"+ + "\2\2\37*\3\2\2\2 !\f\f\2\2!\"\5\6\4\2\"#\5\4\3\r#)\3\2\2\2$%\f\13\2\2"+ + "%&\5\b\5\2&\'\5\4\3\f\')\3\2\2\2( \3\2\2\2($\3\2\2\2),\3\2\2\2*(\3\2\2"+ + "\2*+\3\2\2\2+\5\3\2\2\2,*\3\2\2\2-.\t\2\2\2.\7\3\2\2\2/\60\t\3\2\2\60"+ + "\t\3\2\2\2\61\62\t\4\2\2\62\13\3\2\2\2\5\36(*"; public static final ATN _ATN = new ATNDeserializer().deserialize(_serializedATN.toCharArray()); static { diff --git a/org.adempiere.base/src/org/idempiere/expression/logic/SimpleBooleanVisitor.java b/org.adempiere.base/src/org/idempiere/expression/logic/SimpleBooleanVisitor.java index 723f6f01d3..fe2f0ad114 100644 --- a/org.adempiere.base/src/org/idempiere/expression/logic/SimpleBooleanVisitor.java +++ b/org.adempiere.base/src/org/idempiere/expression/logic/SimpleBooleanVisitor.java @@ -39,6 +39,13 @@ public interface SimpleBooleanVisitor extends ParseTreeVisitor { * @return the visitor result */ T visitBoolExpression(SimpleBooleanParser.BoolExpressionContext ctx); + /** + * Visit a parse tree produced by the {@code doubleQuotedCSVText} + * labeled alternative in {@link SimpleBooleanParser#expression}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitDoubleQuotedCSVText(SimpleBooleanParser.DoubleQuotedCSVTextContext ctx); /** * Visit a parse tree produced by the {@code contextVariables} * labeled alternative in {@link SimpleBooleanParser#expression}. @@ -46,6 +53,13 @@ public interface SimpleBooleanVisitor extends ParseTreeVisitor { * @return the visitor result */ T visitContextVariables(SimpleBooleanParser.ContextVariablesContext ctx); + /** + * Visit a parse tree produced by the {@code quotedCSVText} + * labeled alternative in {@link SimpleBooleanParser#expression}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitQuotedCSVText(SimpleBooleanParser.QuotedCSVTextContext ctx); /** * Visit a parse tree produced by the {@code notExpression} * labeled alternative in {@link SimpleBooleanParser#expression}. diff --git a/org.idempiere.test/src/org/idempiere/test/base/LogicExpressionTest.java b/org.idempiere.test/src/org/idempiere/test/base/LogicExpressionTest.java index d595788433..17229ded24 100644 --- a/org.idempiere.test/src/org/idempiere/test/base/LogicExpressionTest.java +++ b/org.idempiere.test/src/org/idempiere/test/base/LogicExpressionTest.java @@ -96,6 +96,15 @@ public class LogicExpressionTest extends AbstractTestCase { assertTrue(LogicEvaluator.evaluateLogic(evaluatee, expr)); Env.setContext(Env.getCtx(), "$Element_AY", "N"); assertFalse(LogicEvaluator.evaluateLogic(evaluatee, expr)); + + expr = "@LineType@=\"C\"&@CalculationType@='A,R,S'"; + Env.setContext(Env.getCtx(), "LineType", "C"); + Env.setContext(Env.getCtx(), "CalculationType", "B"); + assertFalse(LogicEvaluator.evaluateLogic(evaluatee, expr)); + Env.setContext(Env.getCtx(), "CalculationType", "A"); + assertFalse(LogicEvaluator.evaluateLogic(evaluatee, expr)); + Env.setContext(Env.getCtx(), "CalculationType", "A,R,S"); + assertTrue(LogicEvaluator.evaluateLogic(evaluatee, expr)); } @Test @@ -129,6 +138,35 @@ public class LogicExpressionTest extends AbstractTestCase { @Test public void testIn() { String expr = "@LineType@=C&@CalculationType@=A,R,S"; + testInARS(expr); + expr = "@LineType@='C'&@CalculationType@='A','R','S'"; + testInARS(expr); + expr = "@LineType@=\"C\"&@CalculationType@=\"A\",\"R\",\"S\""; + testInARS(expr); + + expr = "@Name@='Name 1','Name 2','Name 3'"; + testInName123(expr); + expr = "@Name@=\"Name 1\",\"Name 2\",\"Name 3\""; + testInName123(expr); + } + + private void testInName123(String expr) { + Env.setContext(Env.getCtx(), "Name", (String)null); + assertFalse(LegacyLogicEvaluator.evaluateLogic(evaluatee, expr)); + Env.setContext(Env.getCtx(), "Name", "Name 2"); + assertTrue(LegacyLogicEvaluator.evaluateLogic(evaluatee, expr)); + Env.setContext(Env.getCtx(), "Name", "Name 4"); + assertFalse(LegacyLogicEvaluator.evaluateLogic(evaluatee, expr)); + + Env.setContext(Env.getCtx(), "Name", (String)null); + assertFalse(LogicEvaluator.evaluateLogic(evaluatee, expr)); + Env.setContext(Env.getCtx(), "Name", "Name 2"); + assertTrue(LogicEvaluator.evaluateLogic(evaluatee, expr)); + Env.setContext(Env.getCtx(), "Name", "Name 4"); + assertFalse(LogicEvaluator.evaluateLogic(evaluatee, expr)); + } + + private void testInARS(String expr) { Env.setContext(Env.getCtx(), "LineType", (String)null); Env.setContext(Env.getCtx(), "CalculationType", (String)null); assertFalse(LegacyLogicEvaluator.evaluateLogic(evaluatee, expr));