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 d79008a
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; }
@@ -3134,6 +3134,7 @@ TOKEN : /* Operators */
3134
3134
| <OP_CONCAT: "||">
3135
3135
| <OP_PIPE: "|">
3136
3136
| <OP_CARET: "^">
3137
+
| <OP_POWER: "**">
3137
3138
| <OP_SLASH: "/">
3138
3139
| <OP_LSHIFT: "<<">
3139
3140
| <OP_RSHIFT: ">>">
@@ -11395,36 +11396,24 @@ Expression MulChain():
11395
11396
Expression right;
11396
11397
}
11397
11398
{
11398
-
retval=PowerChain()
11399
+
retval=PrimaryExpression()
11399
11400
(
11400
11401
LOOKAHEAD(2)
11401
11402
(
11402
-
"*" right=PowerChain() {{ Multiplication r = new Multiplication(); r.setLeftExpression(retval); r.setRightExpression(right); retval = r; }}
11403
+
"*" right=PrimaryExpression() {{ Multiplication r = new Multiplication(); r.setLeftExpression(retval); r.setRightExpression(right); retval = r; }}
11403
11404
|
11404
-
<OP_SLASH> right=PowerChain() {{ Division r = new Division(); r.setLeftExpression(retval); r.setRightExpression(right); retval = r; }}
11405
+
<OP_SLASH> right=PrimaryExpression() {{ Division r = new Division(); r.setLeftExpression(retval); r.setRightExpression(right); retval = r; }}
11405
11406
|
11406
-
"%" right=PowerChain() {{ Modulo r = new Modulo(); r.setLeftExpression(retval); r.setRightExpression(right); retval = r; }}
11407
+
"%" right=PrimaryExpression() {{ Modulo r = new Modulo(); r.setLeftExpression(retval); r.setRightExpression(right); retval = r; }}
11407
11408
|
11408
-
<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; }}
11409
+
<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; }}
11409
11410
|
11410
-
<K_DIV> right=PowerChain() {{ IntegerDivision r = new IntegerDivision(); r.setLeftExpression(retval); r.setRightExpression(right); retval = r; }}
11411
+
<K_DIV> right=PrimaryExpression() {{ IntegerDivision r = new IntegerDivision(); r.setLeftExpression(retval); r.setRightExpression(right); retval = r; }}
11411
11412
)
11412
11413
)*
11413
11414
{ return retval; }
11414
11415
}
11415
11416
11416
-
/** DuckDB's exponentiation, above the multiplicative operators */
0 commit comments