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 8523ca9
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;
@@ -729,7 +729,7 @@ public class CCJSqlParser extends AbstractJSqlParser<CCJSqlParser> {
729
729
else if (op == S_HASH_OPERATOR) { Intersects r = new Intersects(); r.setLeftExpression(left); r.setRightExpression(right); left = r; }
730
730
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; }
731
731
else if (op == K_DIV) { IntegerDivision r = new IntegerDivision(); r.setLeftExpression(left); r.setRightExpression(right); left = r; }
732
-
else if ("**".equals(t.image)) { left = new Exponentiation(left, right); }
732
+
else if (op == OP_POWER) { left = new Exponentiation(left, right); }
733
733
else if (op == OP_CONCAT) { Concat r = new Concat(); r.setLeftExpression(left); r.setRightExpression(right); left = r; }
734
734
else if (op == OP_PIPE) { BitwiseOr r = new BitwiseOr(); r.setLeftExpression(left); r.setRightExpression(right); left = r; }
735
735
else if (op == OP_LSHIFT) { BitwiseLeftShift r = new BitwiseLeftShift(); r.setLeftExpression(left); r.setRightExpression(right); left = r; }
@@ -3181,6 +3181,7 @@ TOKEN : /* Operators */
3181
3181
| <OP_CONCAT: "||">
3182
3182
| <OP_PIPE: "|">
3183
3183
| <OP_CARET: "^">
3184
+
| <OP_POWER: "**">
3184
3185
| <OP_SLASH: "/">
3185
3186
| <OP_LSHIFT: "<<">
3186
3187
| <OP_RSHIFT: ">>">
@@ -11458,36 +11459,24 @@ Expression MulChain():
11458
11459
Expression right;
11459
11460
}
11460
11461
{
11461
-
retval=PowerChain()
11462
+
retval=PrimaryExpression()
11462
11463
(
11463
11464
LOOKAHEAD(2)
11464
11465
(
11465
-
"*" right=PowerChain() {{ Multiplication r = new Multiplication(); r.setLeftExpression(retval); r.setRightExpression(right); retval = r; }}
11466
+
"*" right=PrimaryExpression() {{ Multiplication r = new Multiplication(); r.setLeftExpression(retval); r.setRightExpression(right); retval = r; }}
11466
11467
|
11467
-
<OP_SLASH> right=PowerChain() {{ Division r = new Division(); r.setLeftExpression(retval); r.setRightExpression(right); retval = r; }}
11468
+
<OP_SLASH> right=PrimaryExpression() {{ Division r = new Division(); r.setLeftExpression(retval); r.setRightExpression(right); retval = r; }}
11468
11469
|
11469
-
"%" right=PowerChain() {{ Modulo r = new Modulo(); r.setLeftExpression(retval); r.setRightExpression(right); retval = r; }}
11470
+
"%" right=PrimaryExpression() {{ Modulo r = new Modulo(); r.setLeftExpression(retval); r.setRightExpression(right); retval = r; }}
11470
11471
|
11471
-
<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; }}
11472
+
<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; }}
11472
11473
|
11473
-
<K_DIV> right=PowerChain() {{ IntegerDivision r = new IntegerDivision(); r.setLeftExpression(retval); r.setRightExpression(right); retval = r; }}
11474
+
<K_DIV> right=PrimaryExpression() {{ IntegerDivision r = new IntegerDivision(); r.setLeftExpression(retval); r.setRightExpression(right); retval = r; }}
11474
11475
)
11475
11476
)*
11476
11477
{ return retval; }
11477
11478
}
11478
11479
11479
-
/** DuckDB's exponentiation, above the multiplicative operators */
0 commit comments