diff --git a/pmd-plsql/etc/grammar/PldocAST.jjt b/pmd-plsql/etc/grammar/PldocAST.jjt index 819549733c..87715b4055 100644 --- a/pmd-plsql/etc/grammar/PldocAST.jjt +++ b/pmd-plsql/etc/grammar/PldocAST.jjt @@ -358,7 +358,7 @@ ASTPackageSpecification PackageSpecification() : } { ( - [ [ "REPLACE"] [ | ] ] + [ [ KEYWORD("REPLACE")] [ | ] ] simpleNode = ObjectNameDeclaration() ( @@ -389,7 +389,7 @@ ASTPackageBody PackageBody() : } { ( - [ [ "REPLACE"] [ | ] ] + [ [ KEYWORD("REPLACE")] [ | ] ] ( | ) simpleNode = ObjectNameDeclaration() ( @@ -491,7 +491,7 @@ ASTProgramUnit ProgramUnit() : { ( - [ [ "REPLACE"] [ | ] ] + [ [ KEYWORD("REPLACE")] [ | ] ] MethodDeclarator() @@ -1195,7 +1195,7 @@ void OrderByEntry() #void : { SqlExpression() [ | ] - [ ( "FIRST" | "LAST" ) ] + [ ( KEYWORD("FIRST") | "LAST" ) ] } /** @@ -1207,7 +1207,7 @@ ASTRowLimitingClause RowLimitingClause() : ( NumericLiteral() ( | ) | - ( "FIRST" | ) [ NumericLiteral() [ ] ] ( | ) ( | ) + ( KEYWORD("FIRST") | ) [ NumericLiteral() [ ] ] ( | ) ( | ) ) { return jjtThis; } } @@ -2147,7 +2147,7 @@ ASTMultiTableInsert MultiTableInsert() : ASTConditionalInsertClause ConditionalInsertClause() : {} { - [ | "FIRST" ] ( Condition() ( InsertIntoClause() [ ValuesClause() ] )+ )+ + [ | KEYWORD("FIRST") ] ( Condition() ( InsertIntoClause() [ ValuesClause() ] )+ )+ [ ( InsertIntoClause() [ ValuesClause() ] )+ ] { return jjtThis; } } @@ -3524,7 +3524,7 @@ ASTView View() : PLSQLNode simpleNode = null; } { - [ "REPLACE"] + [ KEYWORD("REPLACE")] [[] ] simpleNode = ObjectNameDeclaration() ["(" ViewColumn() ("," ViewColumn())* ")"] @@ -3541,7 +3541,7 @@ ASTSynonym Synonym() : PLSQLNode simpleNode = null; } { - [ "REPLACE"] + [ KEYWORD("REPLACE")] [] simpleNode = ObjectNameDeclaration() @@ -3556,7 +3556,7 @@ ASTDirectory Directory() : PLSQLNode simpleNode = null; } { - [ "REPLACE"] + [ KEYWORD("REPLACE")] simpleNode = ObjectNameDeclaration() @@ -3673,7 +3673,7 @@ ASTTypeSpecification TypeSpecification() : PLSQLNode simpleNode = null; } { - [ [ "REPLACE"] [ | ] ] + [ [ KEYWORD("REPLACE")] [ | ] ] simpleNode = ObjectNameDeclaration() [ @@ -3852,7 +3852,7 @@ ASTAlterTypeSpec AlterTypeSpec() : | */ [ - "REPLACE" + KEYWORD("REPLACE") ( LOOKAHEAD(2) // ( | ) ( @@ -4064,7 +4064,7 @@ ASTTriggerUnit TriggerUnit() : PLSQLNode simpleNode = null ; } { - [ [ "REPLACE"] [ | ] ] + [ [ KEYWORD("REPLACE")] [ | ] ] () simpleNode = ObjectNameDeclaration() @@ -4938,11 +4938,25 @@ void RESERVED_WORD() #void: {} | } +void KEYWORD(String id) #void: +{} +{ + + { + if (!token.image.equalsIgnoreCase(id)) { + String eol = System.getProperty("line.separator", "\n"); + throw new ParseException("Encountered \"" + token.image + "\" at line " + + token.beginLine + ", column " + token.beginColumn + "." + eol + + "Was expecting: " + id); + } + } +} + ASTKEYWORD_UNRESERVED KEYWORD_UNRESERVED (): {} { // PL/SQL UNRESERVED KEYWORDS - V$RESERVED.RESERVED='N' ( -"FIRST" | "REPLACE" | "REF" | "LAST" | "TRIM" | "OVER" | "UNBOUNDED" | "PRECEDING" | "FOLLOWING" | "WITHIN" | + "REF" | "LAST" | "TRIM" | "OVER" | "UNBOUNDED" | "PRECEDING" | "FOLLOWING" | "WITHIN" | "OVERFLOW" | "ERROR" | "WITHOUT" | "COUNT" | "VALUE" | "SUBPARTITION" | "LOG" | "ERRORS" | "REJECT" | "UNLIMITED" | |