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 2323
2424import net .sf .jsqlparser .expression .operators .arithmetic .Addition ;
2525import net .sf .jsqlparser .expression .operators .arithmetic .BitwiseAnd ;
26+ import net .sf .jsqlparser .expression .operators .arithmetic .BitwiseLeftShift ;
2627import net .sf .jsqlparser .expression .operators .arithmetic .BitwiseOr ;
28+ import net .sf .jsqlparser .expression .operators .arithmetic .BitwiseRightShift ;
2729import net .sf .jsqlparser .expression .operators .arithmetic .BitwiseXor ;
2830import net .sf .jsqlparser .expression .operators .arithmetic .Concat ;
2931import net .sf .jsqlparser .expression .operators .arithmetic .Division ;
5254
5355public interface ExpressionVisitor {
5456
57+ public void visit (BitwiseRightShift aThis );
58+
59+ public void visit (BitwiseLeftShift aThis );
60+
5561 void visit (NullValue nullValue );
5662
5763 void visit (Function function );
Original file line number Diff line number Diff line change @@ -358,6 +358,16 @@ public void visit(NotExpression notExpr) {
358358 notExpr .getExpression ().accept (this );
359359 }
360360
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+
361371 protected void visitBinaryExpression (BinaryExpression expr ) {
362372 expr .getLeftExpression ().accept (this );
363373 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 6161import net .sf .jsqlparser .expression .WhenClause ;
6262import net .sf .jsqlparser .expression .operators .arithmetic .Addition ;
6363import net .sf .jsqlparser .expression .operators .arithmetic .BitwiseAnd ;
64+ import net .sf .jsqlparser .expression .operators .arithmetic .BitwiseLeftShift ;
6465import net .sf .jsqlparser .expression .operators .arithmetic .BitwiseOr ;
66+ import net .sf .jsqlparser .expression .operators .arithmetic .BitwiseRightShift ;
6567import net .sf .jsqlparser .expression .operators .arithmetic .BitwiseXor ;
6668import net .sf .jsqlparser .expression .operators .arithmetic .Concat ;
6769import net .sf .jsqlparser .expression .operators .arithmetic .Division ;
@@ -374,6 +376,16 @@ public void visit(NotExpression notExpr) {
374376 notExpr .getExpression ().accept (this );
375377 }
376378
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+
377389 public void visitBinaryExpression (BinaryExpression binaryExpression ) {
378390 binaryExpression .getLeftExpression ().accept (this );
379391 binaryExpression .getRightExpression ().accept (this );
Original file line number Diff line number Diff line change 6262import net .sf .jsqlparser .expression .WindowElement ;
6363import net .sf .jsqlparser .expression .operators .arithmetic .Addition ;
6464import net .sf .jsqlparser .expression .operators .arithmetic .BitwiseAnd ;
65+ import net .sf .jsqlparser .expression .operators .arithmetic .BitwiseLeftShift ;
6566import net .sf .jsqlparser .expression .operators .arithmetic .BitwiseOr ;
67+ import net .sf .jsqlparser .expression .operators .arithmetic .BitwiseRightShift ;
6668import net .sf .jsqlparser .expression .operators .arithmetic .BitwiseXor ;
6769import net .sf .jsqlparser .expression .operators .arithmetic .Concat ;
6870import net .sf .jsqlparser .expression .operators .arithmetic .Division ;
@@ -196,6 +198,16 @@ public void visit(NotExpression notExpr) {
196198 notExpr .getExpression ().accept (this );
197199 }
198200
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+
199211 public void visitOldOracleJoinBinaryExpression (OldOracleJoinBinaryExpression expression , String operator ) {
200212 if (expression .isNot ()) {
201213 buffer .append (NOT );
Original file line number Diff line number Diff line change @@ -2247,6 +2247,10 @@ Expression BitwiseAndOr():
22472247 "|" { result = new BitwiseOr(); }
22482248 |
22492249 "&" { result = new BitwiseAnd(); }
2250+ |
2251+ "<<" { result = new BitwiseLeftShift(); }
2252+ |
2253+ ">>" { result = new BitwiseRightShift(); }
22502254 )
22512255
22522256 rightExpression=AdditiveExpression()
Original file line number Diff line number Diff line change @@ -2665,4 +2665,9 @@ public void testIssue512_2() throws JSQLParserException {
26652665 public void testIssue514 () throws JSQLParserException {
26662666 assertSqlCanBeParsedAndDeparsed ("SELECT listagg(c1, ';') WITHIN GROUP (PARTITION BY 1 ORDER BY 1) col FROM dual" );
26672667 }
2668+
2669+ public void testIssue508LeftRightBitwiseShift () throws JSQLParserException {
2670+ assertSqlCanBeParsedAndDeparsed ("SELECT 1 << 1" );
2671+ assertSqlCanBeParsedAndDeparsed ("SELECT 1 >> 1" );
2672+ }
26682673}
You can’t perform that action at this time.
0 commit comments