Fix plsql grammar
This commit is contained in:
1 parent
a7eacbb561
commit
c651e92ca5
1 file changed
+20
-7
@@ -27,6 +27,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
/**
|
||||
* Various fixes for INSERT INTO with records, implicit cursor attributes
|
||||
* and trim expression.
|
||||
*
|
||||
* Hugo Araya Nash 05/2019
|
||||
*====================================================================
|
||||
* Added support for XMLTABLE, XMLEXISTS, XMLCAST, XMLQUERY, CAST, XMLFOREST
|
||||
* and XMLELEMENT
|
||||
*
|
||||
@@ -1536,6 +1541,7 @@ ASTSimpleExpression SimpleExpression() :
|
||||
( "*" | Column() ) { sb.append(token.image); }
|
||||
|
|
||||
// Named Cursor: https://docs.oracle.com/en/database/oracle/oracle-database/18/lnpls/named-cursor-attribute.html#GUID-CD8D8415-FF19-4D81-99BA-7825FD40CC96
|
||||
// Implicit Cursor: https://docs.oracle.com/en/database/oracle/oracle-database/18/lnpls/implicit-cursor-attribute.html#GUID-5A938EE7-E8D2-468C-B60F-81898F110BE1
|
||||
LOOKAHEAD(3)
|
||||
Column() { sb.append(token.image); } "%" ( LOOKAHEAD({isKeyword("isopen")}) KEYWORD("ISOPEN")
|
||||
| LOOKAHEAD({isKeyword("found")}) KEYWORD("FOUND")
|
||||
@@ -2284,7 +2290,12 @@ ASTInsertIntoClause InsertIntoClause() :
|
||||
ASTValuesClause ValuesClause() :
|
||||
{}
|
||||
{
|
||||
<VALUES> [ "(" ( Expression() | <_DEFAULT> ) ( "," ( Expression() | <_DEFAULT> ) )* ")" | <IDENTIFIER> ]
|
||||
<VALUES>
|
||||
(
|
||||
"(" ( Expression() | <_DEFAULT> ) ( "," ( Expression() | <_DEFAULT> ) )* ")"
|
||||
|
|
||||
ID() // that's a record variable name
|
||||
)
|
||||
{ return jjtThis; }
|
||||
}
|
||||
ASTMultiTableInsert MultiTableInsert() :
|
||||
@@ -2905,12 +2916,14 @@ ASTTrimExpression TrimExpression() :
|
||||
{ PLSQLNode simpleNode = null; StringBuilder sb = new StringBuilder() ; }
|
||||
{
|
||||
(
|
||||
"(" { sb.append("(");}
|
||||
[ [ ( <LEADING> | <TRAILING> | <BOTH> ) { sb.append(" "); sb.append(token.toString()); } ]
|
||||
[ <CHARACTER_LITERAL> { sb.append(" "); sb.append(token.image); } ]
|
||||
( <FROM> ) { sb.append(token.image); } ]
|
||||
simpleNode = StringExpression() { sb.append(" "); sb.append(simpleNode.getImage()); }
|
||||
")" { sb.append(")");}
|
||||
"(" { sb.append("(");}
|
||||
[ LOOKAHEAD(2)
|
||||
[ ( <LEADING> | <TRAILING> | <BOTH> ) { sb.append(" "); sb.append(token.toString()); } ]
|
||||
[ simpleNode = StringExpression() { sb.append(" "); sb.append(simpleNode.getImage()); } ]
|
||||
( <FROM> ) { sb.append(" ").append(token.image); }
|
||||
]
|
||||
simpleNode = StringExpression() { sb.append(" "); sb.append(simpleNode.getImage()); }
|
||||
")" { sb.append(")");}
|
||||
)
|
||||
{
|
||||
jjtThis.setImage(sb.toString()); return jjtThis;
|
||||
|
||||
Reference in new issue
Block a user