diff --git a/pmd-plsql/etc/grammar/PldocAST.jjt b/pmd-plsql/etc/grammar/PldocAST.jjt index 4b84bb8f59..ac927c36fa 100644 --- a/pmd-plsql/etc/grammar/PldocAST.jjt +++ b/pmd-plsql/etc/grammar/PldocAST.jjt @@ -1053,46 +1053,48 @@ void SkipPastNextOccurrence(String target) : { return; } } -/* - Read Tokens up to but not including the target Token.kind. -*/ +/** + * Read Tokens up to but not including the target Token.kind. + */ void Skip2NextTokenOccurrence(int target) : { - Token nextToken = getToken(1); - Token specToken = null ; - while (nextToken.kind!=target - && (null == nextToken.specialToken || nextToken.specialToken.kind!=target ) //In case the target is a Special Token - && nextToken.kind!=EOF) //SRT 20110521 - Prevent endless loop when target does not exist in the input stream - { - /* - Check if the target appears as a SpecialToken + Token nextToken = getToken(1); + Token specToken = null ; + while (nextToken.kind!=target + && (null == nextToken.specialToken || nextToken.specialToken.kind!=target ) //In case the target is a Special Token + && nextToken.kind!=EOF) //SRT 20110521 - Prevent endless loop when target does not exist in the input stream + { + /* + * Check if the target appears as a SpecialToken + * + * nextToken.specialToken points to the _LAST_ of any SpecialTokens before the current normal Token. + * + * It is the head of a doubly-linked list: + * + * The ${specialToken}.specialToken field POINTS BACKWARDS TOWARDS the FIRST occurring SpecialToken + * The ${specialToken}.next field POINTS FORWARDS to to the LAST occurring SpecialToken + * + * This means that if the program is interested in a specific SpecialToken, it must examine the linked list for every Token which has nexToken.specialToken != null. + */ + specToken = nextToken.specialToken; + if (null!= specToken) { + //Walk backwards through the list looking for this Token as a Special Token + while (specToken != null && specToken.kind != target) { + specToken = specToken.specialToken; + } + } - nextToken.specialToken points to the _LAST_ of any SpecialTokens before the current normal Token. + //We have found the target as a SpecialToken - break out of normal Token search + if (null != specToken && specToken.kind == target) { + break; + } - It is the head of a doubly-linked list: - - The ${specialToken}.specialToken field POINTS BACKWARDS TOWARDS the FIRST occurring SpecialToken - The ${specialToken}.next field POINTS FORWARDS to to the LAST occurring SpecialToken - - This means that if the program is interested in a specific SpecialToken, it must examine the linked list for every Token which has nexToken.specialToken != null. - - */ - specToken = nextToken.specialToken; - if (null!= specToken) - //Walk backwards through the list looking for this Token as a Special Token - while (specToken != null && specToken.kind != target) - specToken = specToken.specialToken; - - //We have found the target as a SpecialToken - break out of normal Token search - if (null != specToken && specToken.kind == target) - break; - - nextToken = getNextToken(); - nextToken = getToken(1); - } + nextToken = getNextToken(); + nextToken = getToken(1); + } } { - { return; } + { return; } } /* @@ -2864,6 +2866,10 @@ ASTCursorUnit CursorUnit() : { jjtThis.setImage(simpleNode.getImage()) ; return jjtThis ; } } +/** + * This is in plsql actually called CursorDeclaration + * or CursorDefinition. + */ ASTCursorBody CursorBody() : {} { CursorUnit()