[plsql] added some additional info in userData
This commit is contained in:
@ -607,7 +607,11 @@ ASTFormalParameter FormalParameter() :
|
||||
(
|
||||
simpleNode = ID()
|
||||
// the order of outer "|" is important !
|
||||
( LOOKAHEAD(2) ( LOOKAHEAD(2) ( (<OUT>|(<IN> <OUT>)) (LOOKAHEAD(2) <NOCOPY> )? ) | <IN> ) )?
|
||||
|
||||
(<IN> {jjtThis.setIn(true); } )?
|
||||
(<OUT> {jjtThis.setOut(true); } )?
|
||||
(<NOCOPY> {jjtThis.setNoCopy(true); } )?
|
||||
|
||||
("..." | Datatype())
|
||||
( (":" "="|<_DEFAULT>) Expression() )?
|
||||
)
|
||||
@ -1157,8 +1161,18 @@ ASTReadPastNextOccurrence ReadPastNextOccurrence(String target) :
|
||||
ASTSqlStatement SqlStatement(String initiator, String terminator) :
|
||||
{}
|
||||
{
|
||||
(<SELECT>|<UPDATE>|<INSERT>|<DELETE>|<COMMIT>|<ROLLBACK>|<SAVEPOINT>|<SET><TRANSACTION>|<LOCK><TABLE>|<MERGE>|<WITH>)
|
||||
Skip2NextTerminator(initiator,terminator)
|
||||
(<SELECT>
|
||||
|<UPDATE>
|
||||
|<INSERT>
|
||||
|<DELETE>
|
||||
|<COMMIT>{jjtThis.setType(ASTSqlStatement.Type.COMMIT); }
|
||||
|<ROLLBACK>{jjtThis.setType(ASTSqlStatement.Type.ROLLBACK); }
|
||||
|<SAVEPOINT>{jjtThis.setType(ASTSqlStatement.Type.SAVEPOINT); }
|
||||
|<SET><TRANSACTION>{jjtThis.setType(ASTSqlStatement.Type.SET_TRANSACTION); }
|
||||
|<LOCK><TABLE>{jjtThis.setType(ASTSqlStatement.Type.LOCK_TABLE); }
|
||||
|<MERGE>{jjtThis.setType(ASTSqlStatement.Type.MERGE); }
|
||||
|<WITH>)
|
||||
Skip2NextTerminator(initiator, terminator)
|
||||
{
|
||||
return jjtThis ;
|
||||
}
|
||||
@ -2658,9 +2672,9 @@ ASTOpenStatement OpenStatement() :
|
||||
ASTFetchStatement FetchStatement() :
|
||||
{}
|
||||
{
|
||||
<FETCH> QualifiedName() [<BULK> <COLLECT>]
|
||||
<FETCH> QualifiedName() [<BULK> <COLLECT> {jjtThis.setBulkCollect(true); }]
|
||||
//MMUE 04/08/2005 <INTO> (LOOKAHEAD(functionCall()) functionCall() | QualifiedName()) ("," (LOOKAHEAD(functionCall()) functionCall() | QualifiedName()))* ";"
|
||||
<INTO> Expression() ("," Expression())* [<LIMIT> Expression()]
|
||||
<INTO> Expression() ("," Expression())* [<LIMIT> Expression(){jjtThis.setLimit(true);}]
|
||||
//
|
||||
{ return jjtThis ; }
|
||||
}
|
||||
|
@ -48,6 +48,7 @@
|
||||
<delete file="${target}/net/sourceforge/pmd/lang/plsql/ast/ASTCompoundCondition.java" />
|
||||
<delete file="${target}/net/sourceforge/pmd/lang/plsql/ast/ASTDatatype.java" />
|
||||
<delete file="${target}/net/sourceforge/pmd/lang/plsql/ast/ASTExtractExpression.java" />
|
||||
<delete file="${target}/net/sourceforge/pmd/lang/plsql/ast/ASTFetchStatement.java" />
|
||||
<delete file="${target}/net/sourceforge/pmd/lang/plsql/ast/ASTFormalParameter.java" />
|
||||
<delete file="${target}/net/sourceforge/pmd/lang/plsql/ast/ASTIfStatement.java" />
|
||||
<delete file="${target}/net/sourceforge/pmd/lang/plsql/ast/ASTInnerCrossJoinClause.java" />
|
||||
@ -68,6 +69,7 @@
|
||||
<delete file="${target}/net/sourceforge/pmd/lang/plsql/ast/ASTRegexpLikeCondition.java" />
|
||||
<delete file="${target}/net/sourceforge/pmd/lang/plsql/ast/ASTSelectIntoStatement.java" />
|
||||
<delete file="${target}/net/sourceforge/pmd/lang/plsql/ast/ASTSelectStatement.java" />
|
||||
<delete file="${target}/net/sourceforge/pmd/lang/plsql/ast/ASTSqlStatement.java" />
|
||||
<delete file="${target}/net/sourceforge/pmd/lang/plsql/ast/ASTStringLiteral.java" />
|
||||
<delete file="${target}/net/sourceforge/pmd/lang/plsql/ast/ASTSubqueryOperation.java" />
|
||||
<delete file="${target}/net/sourceforge/pmd/lang/plsql/ast/ASTTriggerTimingPointSection.java" />
|
||||
|
@ -0,0 +1,44 @@
|
||||
/**
|
||||
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
|
||||
*/
|
||||
|
||||
/* Generated By:JJTree: Do not edit this line. ASTFetchStatement.java Version 4.3 */
|
||||
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=true,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
|
||||
|
||||
package net.sourceforge.pmd.lang.plsql.ast;
|
||||
|
||||
public class ASTFetchStatement extends AbstractPLSQLNode {
|
||||
private boolean bulkcollect;
|
||||
private boolean limit;
|
||||
|
||||
public ASTFetchStatement(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public ASTFetchStatement(PLSQLParser p, int id) {
|
||||
super(p, id);
|
||||
}
|
||||
|
||||
void setBulkCollect(boolean bulkcollect) {
|
||||
this.bulkcollect = bulkcollect;
|
||||
}
|
||||
|
||||
public boolean isBulkCollect() {
|
||||
return this.bulkcollect;
|
||||
}
|
||||
|
||||
void setLimit(boolean limit) {
|
||||
this.limit = limit;
|
||||
}
|
||||
|
||||
public boolean isLimit() {
|
||||
return this.limit;
|
||||
}
|
||||
|
||||
/** Accept the visitor. **/
|
||||
@Override
|
||||
public Object jjtAccept(PLSQLParserVisitor visitor, Object data) {
|
||||
return visitor.visit(this, data);
|
||||
}
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=21460142c066935e7922d1df0416d9ce (do not edit this line) */
|
@ -8,6 +8,37 @@
|
||||
package net.sourceforge.pmd.lang.plsql.ast;
|
||||
|
||||
public class ASTFormalParameter extends net.sourceforge.pmd.lang.plsql.ast.AbstractPLSQLNode {
|
||||
|
||||
private boolean in;
|
||||
|
||||
private boolean out;
|
||||
|
||||
private boolean nocopy;
|
||||
|
||||
public boolean isIn() {
|
||||
return this.in;
|
||||
}
|
||||
|
||||
public void setIn(boolean in) {
|
||||
this.in = in;
|
||||
}
|
||||
|
||||
public boolean isOut() {
|
||||
return this.out;
|
||||
}
|
||||
|
||||
public void setOut(boolean out) {
|
||||
this.out = out;
|
||||
}
|
||||
|
||||
public boolean isNoCopy() {
|
||||
return this.nocopy;
|
||||
}
|
||||
|
||||
public void setNoCopy(boolean nocopy) {
|
||||
this.nocopy = nocopy;
|
||||
}
|
||||
|
||||
public ASTFormalParameter(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
@ -0,0 +1,38 @@
|
||||
/**
|
||||
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
|
||||
*/
|
||||
|
||||
/* Generated By:JJTree: Do not edit this line. ASTSqlStatement.java Version 4.3 */
|
||||
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=true,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
|
||||
|
||||
package net.sourceforge.pmd.lang.plsql.ast;
|
||||
|
||||
public class ASTSqlStatement extends AbstractPLSQLNode {
|
||||
|
||||
private Type type;
|
||||
|
||||
public enum Type { COMMIT, ROLLBACK, SAVEPOINT, SET_TRANSACTION, LOCK_TABLE, MERGE }
|
||||
|
||||
public ASTSqlStatement(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public ASTSqlStatement(PLSQLParser p, int id) {
|
||||
super(p, id);
|
||||
}
|
||||
|
||||
public void setType(Type type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
/** Accept the visitor. **/
|
||||
@Override
|
||||
public Object jjtAccept(PLSQLParserVisitor visitor, Object data) {
|
||||
return visitor.visit(this, data);
|
||||
}
|
||||
}
|
||||
/* JavaCC - OriginalChecksum=e5c8185ea2733334069ae5313aec7b81 (do not edit this line) */
|
@ -0,0 +1,50 @@
|
||||
/**
|
||||
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
|
||||
*/
|
||||
|
||||
package net.sourceforge.pmd.lang.plsql.ast;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import net.sourceforge.pmd.lang.plsql.AbstractPLSQLParserTst;
|
||||
|
||||
public class InOutNoCopyTest extends AbstractPLSQLParserTst {
|
||||
|
||||
@Test
|
||||
public void parseInOutNoCopy() {
|
||||
ASTInput input = plsql.parseResource("InOutNoCopy.pls");
|
||||
Assert.assertNotNull(input);
|
||||
List<ASTFormalParameter> params = input.findDescendantsOfType(ASTFormalParameter.class);
|
||||
Assert.assertEquals(18, params.size());
|
||||
//detailed check of first 6 test cases
|
||||
Assert.assertFalse(params.get(0).isIn());
|
||||
Assert.assertFalse(params.get(0).isOut());
|
||||
Assert.assertFalse(params.get(0).isNoCopy());
|
||||
Assert.assertTrue(params.get(1).isIn());
|
||||
Assert.assertFalse(params.get(1).isOut());
|
||||
Assert.assertFalse(params.get(1).isNoCopy());
|
||||
Assert.assertFalse(params.get(2).isIn());
|
||||
Assert.assertTrue(params.get(2).isOut());
|
||||
Assert.assertFalse(params.get(2).isNoCopy());
|
||||
Assert.assertTrue(params.get(3).isIn());
|
||||
Assert.assertTrue(params.get(3).isOut());
|
||||
Assert.assertFalse(params.get(3).isNoCopy());
|
||||
Assert.assertTrue(params.get(4).isIn());
|
||||
Assert.assertTrue(params.get(4).isOut());
|
||||
Assert.assertTrue(params.get(4).isNoCopy());
|
||||
Assert.assertFalse(params.get(5).isIn());
|
||||
Assert.assertTrue(params.get(5).isOut());
|
||||
Assert.assertTrue(params.get(5).isNoCopy());
|
||||
//piecemeal test of other test cases
|
||||
Assert.assertFalse(params.get(11).isIn());
|
||||
Assert.assertTrue(params.get(11).isOut());
|
||||
Assert.assertTrue(params.get(11).isNoCopy());
|
||||
Assert.assertTrue(params.get(16).isIn());
|
||||
Assert.assertTrue(params.get(16).isOut());
|
||||
Assert.assertTrue(params.get(16).isNoCopy());
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
create or replace procedure InOutNoCopyTest(blankParam varchar2,
|
||||
inParam in integer,
|
||||
outParam out varchar2,
|
||||
inOutParam in out date,
|
||||
inOutNoCopyParam in out nocopy clob,
|
||||
outNoCpyParam out nocopy blob)
|
||||
is
|
||||
begin
|
||||
null;
|
||||
end InOutNoCopyTest;
|
||||
/
|
||||
|
||||
create or replace package InOutNoCopyTestPck is
|
||||
|
||||
procedure InOutNoCopyTest(blankParam varchar2,
|
||||
inParam in integer,
|
||||
outParam out varchar2,
|
||||
inOutParam in out date,
|
||||
inOutNoCopyParam in out nocopy clob,
|
||||
outNoCpyParam out nocopy blob);
|
||||
|
||||
end InOutNoCopyTestPck;
|
||||
/
|
||||
|
||||
create or replace package body InOutNoCopyTestPck is
|
||||
|
||||
procedure InOutNoCopyTest(blankParam varchar2,
|
||||
inParam in integer,
|
||||
outParam out varchar2,
|
||||
inOutParam in out date,
|
||||
inOutNoCopyParam in out nocopy clob,
|
||||
outNoCpyParam out nocopy blob) is
|
||||
begin
|
||||
null;
|
||||
end;
|
||||
|
||||
end InOutNoCopyTestPck;
|
||||
/
|
Reference in New Issue
Block a user