File tree Expand file tree Collapse file tree 9 files changed +125
-2
lines changed
jjtree/net/sf/jsqlparser/parser
test/java/net/sf/jsqlparser/test/select Expand file tree Collapse file tree 9 files changed +125
-2
lines changed Original file line number Diff line number Diff line change 23
23
24
24
import net .sf .jsqlparser .expression .operators .arithmetic .Addition ;
25
25
import net .sf .jsqlparser .expression .operators .arithmetic .BitwiseAnd ;
26
+ import net .sf .jsqlparser .expression .operators .arithmetic .BitwiseLeftShift ;
26
27
import net .sf .jsqlparser .expression .operators .arithmetic .BitwiseOr ;
28
+ import net .sf .jsqlparser .expression .operators .arithmetic .BitwiseRightShift ;
27
29
import net .sf .jsqlparser .expression .operators .arithmetic .BitwiseXor ;
28
30
import net .sf .jsqlparser .expression .operators .arithmetic .Concat ;
29
31
import net .sf .jsqlparser .expression .operators .arithmetic .Division ;
52
54
53
55
public interface ExpressionVisitor {
54
56
57
+ public void visit (BitwiseRightShift aThis );
58
+
59
+ public void visit (BitwiseLeftShift aThis );
60
+
55
61
void visit (NullValue nullValue );
56
62
57
63
void visit (Function function );
Original file line number Diff line number Diff line change @@ -358,6 +358,16 @@ public void visit(NotExpression notExpr) {
358
358
notExpr .getExpression ().accept (this );
359
359
}
360
360
361
+ @ Override
362
+ public void visit (BitwiseRightShift expr ) {
363
+ visitBinaryExpression (expr );
364
+ }
365
+
366
+ @ Override
367
+ public void visit (BitwiseLeftShift expr ) {
368
+ visitBinaryExpression (expr );
369
+ }
370
+
361
371
protected void visitBinaryExpression (BinaryExpression expr ) {
362
372
expr .getLeftExpression ().accept (this );
363
373
expr .getRightExpression ().accept (this );
Original file line number Diff line number Diff line change
1
+ /*
2
+ * #%L
3
+ * JSQLParser library
4
+ * %%
5
+ * Copyright (C) 2004 - 2013 JSQLParser
6
+ * %%
7
+ * This program is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU Lesser General Public License as
9
+ * published by the Free Software Foundation, either version 2.1 of the
10
+ * License, or (at your option) any later version.
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ * GNU General Lesser Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU General Lesser Public
18
+ * License along with this program. If not, see
19
+ * <http://www.gnu.org/licenses/lgpl-2.1.html>.
20
+ * #L%
21
+ */
22
+ package net .sf .jsqlparser .expression .operators .arithmetic ;
23
+
24
+ import net .sf .jsqlparser .expression .BinaryExpression ;
25
+ import net .sf .jsqlparser .expression .ExpressionVisitor ;
26
+
27
+ public class BitwiseLeftShift extends BinaryExpression {
28
+
29
+ @ Override
30
+ public void accept (ExpressionVisitor expressionVisitor ) {
31
+ expressionVisitor .visit (this );
32
+ }
33
+
34
+ @ Override
35
+ public String getStringExpression () {
36
+ return "<<" ;
37
+ }
38
+ }
Original file line number Diff line number Diff line change
1
+ /*
2
+ * #%L
3
+ * JSQLParser library
4
+ * %%
5
+ * Copyright (C) 2004 - 2013 JSQLParser
6
+ * %%
7
+ * This program is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU Lesser General Public License as
9
+ * published by the Free Software Foundation, either version 2.1 of the
10
+ * License, or (at your option) any later version.
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ * GNU General Lesser Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU General Lesser Public
18
+ * License along with this program. If not, see
19
+ * <http://www.gnu.org/licenses/lgpl-2.1.html>.
20
+ * #L%
21
+ */
22
+ package net .sf .jsqlparser .expression .operators .arithmetic ;
23
+
24
+ import net .sf .jsqlparser .expression .BinaryExpression ;
25
+ import net .sf .jsqlparser .expression .ExpressionVisitor ;
26
+
27
+ public class BitwiseRightShift extends BinaryExpression {
28
+
29
+ @ Override
30
+ public void accept (ExpressionVisitor expressionVisitor ) {
31
+ expressionVisitor .visit (this );
32
+ }
33
+
34
+ @ Override
35
+ public String getStringExpression () {
36
+ return ">>" ;
37
+ }
38
+ }
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 61
61
import net .sf .jsqlparser .expression .WhenClause ;
62
62
import net .sf .jsqlparser .expression .operators .arithmetic .Addition ;
63
63
import net .sf .jsqlparser .expression .operators .arithmetic .BitwiseAnd ;
64
+ import net .sf .jsqlparser .expression .operators .arithmetic .BitwiseLeftShift ;
64
65
import net .sf .jsqlparser .expression .operators .arithmetic .BitwiseOr ;
66
+ import net .sf .jsqlparser .expression .operators .arithmetic .BitwiseRightShift ;
65
67
import net .sf .jsqlparser .expression .operators .arithmetic .BitwiseXor ;
66
68
import net .sf .jsqlparser .expression .operators .arithmetic .Concat ;
67
69
import net .sf .jsqlparser .expression .operators .arithmetic .Division ;
@@ -374,6 +376,16 @@ public void visit(NotExpression notExpr) {
374
376
notExpr .getExpression ().accept (this );
375
377
}
376
378
379
+ @ Override
380
+ public void visit (BitwiseRightShift expr ) {
381
+ visitBinaryExpression (expr );
382
+ }
383
+
384
+ @ Override
385
+ public void visit (BitwiseLeftShift expr ) {
386
+ visitBinaryExpression (expr );
387
+ }
388
+
377
389
public void visitBinaryExpression (BinaryExpression binaryExpression ) {
378
390
binaryExpression .getLeftExpression ().accept (this );
379
391
binaryExpression .getRightExpression ().accept (this );
Original file line number Diff line number Diff line change 62
62
import net .sf .jsqlparser .expression .WindowElement ;
63
63
import net .sf .jsqlparser .expression .operators .arithmetic .Addition ;
64
64
import net .sf .jsqlparser .expression .operators .arithmetic .BitwiseAnd ;
65
+ import net .sf .jsqlparser .expression .operators .arithmetic .BitwiseLeftShift ;
65
66
import net .sf .jsqlparser .expression .operators .arithmetic .BitwiseOr ;
67
+ import net .sf .jsqlparser .expression .operators .arithmetic .BitwiseRightShift ;
66
68
import net .sf .jsqlparser .expression .operators .arithmetic .BitwiseXor ;
67
69
import net .sf .jsqlparser .expression .operators .arithmetic .Concat ;
68
70
import net .sf .jsqlparser .expression .operators .arithmetic .Division ;
@@ -196,6 +198,16 @@ public void visit(NotExpression notExpr) {
196
198
notExpr .getExpression ().accept (this );
197
199
}
198
200
201
+ @ Override
202
+ public void visit (BitwiseRightShift expr ) {
203
+ visitBinaryExpression (expr , " >> " );
204
+ }
205
+
206
+ @ Override
207
+ public void visit (BitwiseLeftShift expr ) {
208
+ visitBinaryExpression (expr , " << " );
209
+ }
210
+
199
211
public void visitOldOracleJoinBinaryExpression (OldOracleJoinBinaryExpression expression , String operator ) {
200
212
if (expression .isNot ()) {
201
213
buffer .append (NOT );
Original file line number Diff line number Diff line change @@ -2247,6 +2247,10 @@ Expression BitwiseAndOr():
2247
2247
"|" { result = new BitwiseOr(); }
2248
2248
|
2249
2249
"&" { result = new BitwiseAnd(); }
2250
+ |
2251
+ "<<" { result = new BitwiseLeftShift(); }
2252
+ |
2253
+ ">>" { result = new BitwiseRightShift(); }
2250
2254
)
2251
2255
2252
2256
rightExpression=AdditiveExpression()
Original file line number Diff line number Diff line change @@ -2665,4 +2665,9 @@ public void testIssue512_2() throws JSQLParserException {
2665
2665
public void testIssue514 () throws JSQLParserException {
2666
2666
assertSqlCanBeParsedAndDeparsed ("SELECT listagg(c1, ';') WITHIN GROUP (PARTITION BY 1 ORDER BY 1) col FROM dual" );
2667
2667
}
2668
+
2669
+ public void testIssue508LeftRightBitwiseShift () throws JSQLParserException {
2670
+ assertSqlCanBeParsedAndDeparsed ("SELECT 1 << 1" );
2671
+ assertSqlCanBeParsedAndDeparsed ("SELECT 1 >> 1" );
2672
+ }
2668
2673
}
You can’t perform that action at this time.
0 commit comments