You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 0b2a6d0
Browse filesBrowse the repository at this point in the historyBrowse files
Keep the operator spelling of LIKE in step with the model
- The `~~` spelling is now derived from the keyword and `NOT`, so
`setNot` or `setLikeKeyWord` no longer leave a stale operator, and
`PRIOR` and `BINARY` are printed with it. `!~~~` and `null` are
rejected.
- A sign is also separated from an operand when either is `~`: DuckDB
and PostgreSQL read `-~1` as one unknown operator.
- `**` is the `OP_POWER` token; the `MulChain` alternative was never
reached.
- `visit(Exponentiation)` is a default method, so existing
`ExpressionVisitor` implementations keep compiling.
Copy file name to clipboardExpand all lines: src/main/jjtree/net/sf/jsqlparser/parser/JSqlParserCC.jjt
+9-20Lines changed: 9 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -688,7 +688,7 @@ public class CCJSqlParser extends AbstractJSqlParser<CCJSqlParser> {
688
688
|| (op == OP_CONCAT && Dialect.POSTGRESQL.name()
689
689
.equals(getAsString(Feature.dialect)))) prec = 4;
690
690
else if (op == OP_SLASH || op == OP_CARET || op == K_DIV) prec = 6;
691
-
else if ("**".equals(t.image)) prec = 7;
691
+
else if (op == OP_POWER) prec = 7;
692
692
else if (op == S_HASH_OPERATOR) prec = 5;
693
693
else if (op == OP_CONCAT || op == OP_PIPE
694
694
|| op == OP_LSHIFT || op == OP_RSHIFT) prec = 5;
@@ -727,7 +727,7 @@ public class CCJSqlParser extends AbstractJSqlParser<CCJSqlParser> {
727
727
else if (op == S_HASH_OPERATOR) { Intersects r = new Intersects(); r.setLeftExpression(left); r.setRightExpression(right); left = r; }
728
728
else if (op == OP_CARET) { net.sf.jsqlparser.expression.operators.arithmetic.BitwiseXor r = new net.sf.jsqlparser.expression.operators.arithmetic.BitwiseXor(); r.setLeftExpression(left); r.setRightExpression(right); left = r; }
729
729
else if (op == K_DIV) { IntegerDivision r = new IntegerDivision(); r.setLeftExpression(left); r.setRightExpression(right); left = r; }
730
-
else if ("**".equals(t.image)) { left = new Exponentiation(left, right); }
730
+
else if (op == OP_POWER) { left = new Exponentiation(left, right); }
731
731
else if (op == OP_CONCAT) { Concat r = new Concat(); r.setLeftExpression(left); r.setRightExpression(right); left = r; }
732
732
else if (op == OP_PIPE) { BitwiseOr r = new BitwiseOr(); r.setLeftExpression(left); r.setRightExpression(right); left = r; }
733
733
else if (op == OP_LSHIFT) { BitwiseLeftShift r = new BitwiseLeftShift(); r.setLeftExpression(left); r.setRightExpression(right); left = r; }
@@ -3065,6 +3065,7 @@ TOKEN : /* Operators */
3065
3065
| <OP_CONCAT: "||">
3066
3066
| <OP_PIPE: "|">
3067
3067
| <OP_CARET: "^">
3068
+
| <OP_POWER: "**">
3068
3069
| <OP_SLASH: "/">
3069
3070
| <OP_LSHIFT: "<<">
3070
3071
| <OP_RSHIFT: ">>">
@@ -11307,36 +11308,24 @@ Expression MulChain():
11307
11308
Expression right;
11308
11309
}
11309
11310
{
11310
-
retval=PowerChain()
11311
+
retval=PrimaryExpression()
11311
11312
(
11312
11313
LOOKAHEAD(2)
11313
11314
(
11314
-
"*" right=PowerChain() {{ Multiplication r = new Multiplication(); r.setLeftExpression(retval); r.setRightExpression(right); retval = r; }}
11315
+
"*" right=PrimaryExpression() {{ Multiplication r = new Multiplication(); r.setLeftExpression(retval); r.setRightExpression(right); retval = r; }}
11315
11316
|
11316
-
<OP_SLASH> right=PowerChain() {{ Division r = new Division(); r.setLeftExpression(retval); r.setRightExpression(right); retval = r; }}
11317
+
<OP_SLASH> right=PrimaryExpression() {{ Division r = new Division(); r.setLeftExpression(retval); r.setRightExpression(right); retval = r; }}
11317
11318
|
11318
-
"%" right=PowerChain() {{ Modulo r = new Modulo(); r.setLeftExpression(retval); r.setRightExpression(right); retval = r; }}
11319
+
"%" right=PrimaryExpression() {{ Modulo r = new Modulo(); r.setLeftExpression(retval); r.setRightExpression(right); retval = r; }}
11319
11320
|
11320
-
<OP_CARET> right=PowerChain() {{ net.sf.jsqlparser.expression.operators.arithmetic.BitwiseXor r = new net.sf.jsqlparser.expression.operators.arithmetic.BitwiseXor(); r.setLeftExpression(retval); r.setRightExpression(right); retval = r; }}
11321
+
<OP_CARET> right=PrimaryExpression() {{ net.sf.jsqlparser.expression.operators.arithmetic.BitwiseXor r = new net.sf.jsqlparser.expression.operators.arithmetic.BitwiseXor(); r.setLeftExpression(retval); r.setRightExpression(right); retval = r; }}
11321
11322
|
11322
-
<K_DIV> right=PowerChain() {{ IntegerDivision r = new IntegerDivision(); r.setLeftExpression(retval); r.setRightExpression(right); retval = r; }}
11323
+
<K_DIV> right=PrimaryExpression() {{ IntegerDivision r = new IntegerDivision(); r.setLeftExpression(retval); r.setRightExpression(right); retval = r; }}
11323
11324
)
11324
11325
)*
11325
11326
{ return retval; }
11326
11327
}
11327
11328
11328
-
/** DuckDB's exponentiation, above the multiplicative operators */
0 commit comments