Skip to content

Commit 7a50b96

Browse files
committed
- extract syntax integrated into jj file
1 parent db90438 commit 7a50b96

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/main/javacc/net/sf/jsqlparser/parser/JSqlParserCC.jj

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ TOKEN: /* SQL Keywords. prefixed with K_ to avoid name clashes */
225225
| <K_MINUS:"MINUS">
226226
| <K_OVER:"OVER">
227227
| <K_PARTITION:"PARTITION">
228+
| <K_EXTRACT:"EXTRACT">
228229
}
229230

230231

@@ -1426,6 +1427,8 @@ Expression PrimaryExpression():
14261427
| "?" { retval = new JdbcParameter(); }
14271428

14281429
| LOOKAHEAD(AnalyticExpression()) retval=AnalyticExpression()
1430+
1431+
| LOOKAHEAD(ExtractExpression()) retval=ExtractExpression()
14291432

14301433
| LOOKAHEAD([ "+" | "-"] Function()) [ "+" | "-" { isInverse = true; }] retval=Function()
14311434

@@ -1480,6 +1483,19 @@ AnalyticExpression AnalyticExpression() :
14801483
}
14811484
}
14821485

1486+
ExtractExpression ExtractExpression() :
1487+
{
1488+
ExtractExpression retval = new ExtractExpression();
1489+
Token token = null;
1490+
Expression expr = null;
1491+
}
1492+
{
1493+
<K_EXTRACT> "(" token=<S_IDENTIFIER> { retval.setName(token.image); } <K_FROM> expr=PrimaryExpression() ")"
1494+
{
1495+
return retval;
1496+
}
1497+
}
1498+
14831499
CastExpression CastExpression():
14841500
{
14851501
CastExpression retval = new CastExpression();

0 commit comments

Comments
 (0)