Skip to content

Commit 3d7f55c

Browse files
committed
modified Condition production to be more performant
1 parent 9e26b76 commit 3d7f55c

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

src/main/jjtree/net/sf/jsqlparser/parser/JSqlParserCC.jjt

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -607,10 +607,10 @@ DeclareStatement Declare(): {
607607
(
608608
( <K_TABLE> "(" colDef = ColumnDefinition()
609609
{
610-
stmt.withUserVariable(userVariable)
611-
.withDeclareType(DeclareType.TABLE)
612-
.addColumnDefinition(colDef);
613-
}
610+
stmt.withUserVariable(userVariable)
611+
.withDeclareType(DeclareType.TABLE)
612+
.addColumnDefinition(colDef);
613+
}
614614
("," colDef = ColumnDefinition() { stmt.addColumnDefinition(colDef); })* ")"
615615
)
616616
|
@@ -1475,8 +1475,8 @@ PlainSelect PlainSelect() #PlainSelect:
14751475

14761476
[LOOKAHEAD(2) first = First() { plainSelect.setFirst(first); } ]
14771477

1478-
[
1479-
<K_ALL>
1478+
[ LOOKAHEAD(2)
1479+
( <K_ALL>
14801480
|
14811481
(
14821482
<K_DISTINCT> { Distinct distinct = new Distinct(); plainSelect.setDistinct(distinct); }
@@ -1494,6 +1494,7 @@ PlainSelect PlainSelect() #PlainSelect:
14941494
(
14951495
<K_SQL_NO_CACHE> { plainSelect.setMySqlSqlNoCache(true); }
14961496
)
1497+
)
14971498
]
14981499

14991500
[ LOOKAHEAD(2) top = Top() { plainSelect.setTop(top); } ]
@@ -2606,9 +2607,9 @@ Expression Condition():
26062607
{
26072608
[ LOOKAHEAD(2) (<K_NOT> { not=true; } | "!" { not=true; exclamationMarkNot=true; })]
26082609
(
2609-
LOOKAHEAD(SQLCondition()) result=SQLCondition()
2610-
| LOOKAHEAD(RegularCondition()) result=RegularCondition()
2611-
| result=SimpleExpression()
2610+
LOOKAHEAD(RegularCondition()) result=RegularCondition()
2611+
| result=SQLCondition()
2612+
//| result=SimpleExpression()
26122613
)
26132614

26142615
{ return not?new NotExpression(result, exclamationMarkNot):result; }
@@ -2687,13 +2688,13 @@ Expression SQLCondition():
26872688
(
26882689
result=ExistsExpression()
26892690
| LOOKAHEAD(InExpression()) result=InExpression()
2690-
| left = SimpleExpression()
2691-
(LOOKAHEAD(2) result=Between(left)
2691+
| left = SimpleExpression() { result = left; }
2692+
[ LOOKAHEAD(2) ((LOOKAHEAD(2) result=Between(left)
26922693
| LOOKAHEAD(IsNullExpression()) result=IsNullExpression(left)
26932694
| LOOKAHEAD(IsBooleanExpression()) result=IsBooleanExpression(left)
26942695
| LOOKAHEAD(2) result=LikeExpression(left)
26952696
| result=SimilarToExpression(left)
2696-
)
2697+
)) ]
26972698
)
26982699
{ return result; }
26992700
}

0 commit comments

Comments
 (0)