Skip to content

Commit

Permalink
- extract syntax integrated into jj file
Browse files Browse the repository at this point in the history
  • Loading branch information
wumpz committed Sep 15, 2012
1 parent db90438 commit 7a50b96
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/main/javacc/net/sf/jsqlparser/parser/JSqlParserCC.jj
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ TOKEN: /* SQL Keywords. prefixed with K_ to avoid name clashes */
| <K_MINUS:"MINUS">
| <K_OVER:"OVER">
| <K_PARTITION:"PARTITION">
| <K_EXTRACT:"EXTRACT">
}


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

| LOOKAHEAD(AnalyticExpression()) retval=AnalyticExpression()

| LOOKAHEAD(ExtractExpression()) retval=ExtractExpression()

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

Expand Down Expand Up @@ -1480,6 +1483,19 @@ AnalyticExpression AnalyticExpression() :
}
}

ExtractExpression ExtractExpression() :
{
ExtractExpression retval = new ExtractExpression();
Token token = null;
Expression expr = null;
}
{
<K_EXTRACT> "(" token=<S_IDENTIFIER> { retval.setName(token.image); } <K_FROM> expr=PrimaryExpression() ")"
{
return retval;
}
}

CastExpression CastExpression():
{
CastExpression retval = new CastExpression();
Expand Down

0 comments on commit 7a50b96

Please sign in to comment.