From f5be685068e0ee32ba1abaa7a0c05196b18ec640 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Thu, 21 Apr 2022 11:26:30 +0200 Subject: [PATCH] [plsql] Convert ParenthesisGroupTest to be a tree dump test --- .../lang/plsql/ast/ParenthesisGroupTest.java | 32 ++- .../pmd/lang/plsql/ast/ParenthesisGroup0.txt | 250 ++++++++++++++++++ .../pmd/lang/plsql/ast/ParenthesisGroup1.txt | 250 ++++++++++++++++++ .../pmd/lang/plsql/ast/ParenthesisGroup2.txt | 150 +++++++++++ 4 files changed, 670 insertions(+), 12 deletions(-) create mode 100644 pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/ParenthesisGroup0.txt create mode 100644 pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/ParenthesisGroup1.txt create mode 100644 pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/ParenthesisGroup2.txt diff --git a/pmd-plsql/src/test/java/net/sourceforge/pmd/lang/plsql/ast/ParenthesisGroupTest.java b/pmd-plsql/src/test/java/net/sourceforge/pmd/lang/plsql/ast/ParenthesisGroupTest.java index edfefb1614..b93bc5f7ec 100644 --- a/pmd-plsql/src/test/java/net/sourceforge/pmd/lang/plsql/ast/ParenthesisGroupTest.java +++ b/pmd-plsql/src/test/java/net/sourceforge/pmd/lang/plsql/ast/ParenthesisGroupTest.java @@ -4,29 +4,37 @@ package net.sourceforge.pmd.lang.plsql.ast; -import org.junit.Assert; import org.junit.Test; -import net.sourceforge.pmd.lang.plsql.AbstractPLSQLParserTst; +import net.sourceforge.pmd.lang.ast.test.BaseParsingHelper; +import net.sourceforge.pmd.lang.ast.test.BaseTreeDumpTest; +import net.sourceforge.pmd.lang.ast.test.RelevantAttributePrinter; +import net.sourceforge.pmd.lang.plsql.PlsqlParsingHelper; -public class ParenthesisGroupTest extends AbstractPLSQLParserTst { +public class ParenthesisGroupTest extends BaseTreeDumpTest { + + public ParenthesisGroupTest() { + super(new RelevantAttributePrinter(), ".pls"); + } + + @Override + public BaseParsingHelper getParser() { + return PlsqlParsingHelper.WITH_PROCESSING.withResourceContext(getClass()); + } @Test public void parseParenthesisGroup0() { - ASTInput input = plsql.parseResource("ParenthesisGroup0.pls"); - Assert.assertNotNull(input); + doTest("ParenthesisGroup0"); } - + @Test public void parseParenthesisGroup1() { - ASTInput input = plsql.parseResource("ParenthesisGroup1.pls"); - Assert.assertNotNull(input); + doTest("ParenthesisGroup1"); } - + @Test public void parseParenthesisGroup2() { - ASTInput input = plsql.parseResource("ParenthesisGroup2.pls"); - Assert.assertNotNull(input); + doTest("ParenthesisGroup2"); } - + } diff --git a/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/ParenthesisGroup0.txt b/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/ParenthesisGroup0.txt new file mode 100644 index 0000000000..0602c49949 --- /dev/null +++ b/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/ParenthesisGroup0.txt @@ -0,0 +1,250 @@ ++- Input[@CanonicalImage = null, @ExcludedLinesCount = 0, @ExcludedRangesCount = 0, @Sourcecode = "CREATE OR REPLACE PROCEDURE EXAMPLE_PROCEDURE IS + -- + CURSOR c_example IS + SELECT a.owner, u.object_name, p.aggregate + FROM (USER_OBJECTS u) INNER JOIN (ALL_OBJECTS a) ON + u.object_name = a.object_name AND u.object_type = a.object_type AND u.object_id = a.object_id + INNER JOIN (ALL_PROCEDURES p) ON + p.owner = a.owner AND p.object_name = a.object_name AND p.object_type = a.object_type + WHERE a.owner = USER; + -- +BEGIN + -- + FOR l_object IN c_example LOOP + -- + DBMS_OUTPUT.Put_Line(l_object.owner); + DBMS_OUTPUT.Put_Line(l_object.object_name); + DBMS_OUTPUT.Put_Line(l_object.aggregate); + -- + END LOOP; + -- +END EXAMPLE_PROCEDURE; +"] + +- Global[@CanonicalImage = null] + +- ProgramUnit[@CanonicalImage = null, @MethodName = "EXAMPLE_PROCEDURE", @Name = "EXAMPLE_PROCEDURE", @ObjectName = null] + +- MethodDeclarator[@CanonicalImage = "EXAMPLE_PROCEDURE", @Image = "EXAMPLE_PROCEDURE", @ParameterCount = 1] + | +- ObjectNameDeclaration[@CanonicalImage = "EXAMPLE_PROCEDURE", @Image = "EXAMPLE_PROCEDURE"] + | +- ID[@CanonicalImage = "EXAMPLE_PROCEDURE", @Image = "EXAMPLE_PROCEDURE"] + +- DeclarativeSection[@CanonicalImage = null] + | +- DeclarativeUnit[@CanonicalImage = null] + | +- CursorSpecification[@CanonicalImage = null] + | +- CursorUnit[@CanonicalImage = "C_EXAMPLE", @Image = "c_example"] + | +- ID[@CanonicalImage = "C_EXAMPLE", @Image = "c_example"] + | +- SelectStatement[@All = false, @CanonicalImage = null, @Distinct = false, @Unique = false] + | +- SelectList[@CanonicalImage = null] + | | +- SqlExpression[@CanonicalImage = "A.OWNER", @Image = "a.owner"] + | | | +- PrimaryPrefix[@CanonicalImage = "A.OWNER", @Image = "a.owner", @SelfModifier = false] + | | | +- SimpleExpression[@CanonicalImage = "A.OWNER", @Image = "a.owner"] + | | | +- TableName[@CanonicalImage = "A", @Image = "a"] + | | | | +- ID[@CanonicalImage = "A", @Image = "a"] + | | | | +- KEYWORD_UNRESERVED[@CanonicalImage = "A", @Image = "a"] + | | | +- Column[@CanonicalImage = "OWNER", @Image = "owner"] + | | | +- ID[@CanonicalImage = "OWNER", @Image = "owner"] + | | +- SqlExpression[@CanonicalImage = "U.OBJECT_NAME", @Image = "u.object_name"] + | | | +- PrimaryPrefix[@CanonicalImage = "U.OBJECT_NAME", @Image = "u.object_name", @SelfModifier = false] + | | | +- SimpleExpression[@CanonicalImage = "U.OBJECT_NAME", @Image = "u.object_name"] + | | | +- TableName[@CanonicalImage = "U", @Image = "u"] + | | | | +- ID[@CanonicalImage = "U", @Image = "u"] + | | | +- Column[@CanonicalImage = "OBJECT_NAME", @Image = "object_name"] + | | | +- ID[@CanonicalImage = "OBJECT_NAME", @Image = "object_name"] + | | +- SqlExpression[@CanonicalImage = "P.AGGREGATE", @Image = "p.aggregate"] + | | +- PrimaryPrefix[@CanonicalImage = "P.AGGREGATE", @Image = "p.aggregate", @SelfModifier = false] + | | +- SimpleExpression[@CanonicalImage = "P.AGGREGATE", @Image = "p.aggregate"] + | | +- TableName[@CanonicalImage = "P", @Image = "p"] + | | | +- ID[@CanonicalImage = "P", @Image = "p"] + | | +- Column[@CanonicalImage = "AGGREGATE", @Image = "aggregate"] + | | +- ID[@CanonicalImage = "AGGREGATE", @Image = "aggregate"] + | | +- KEYWORD_UNRESERVED[@CanonicalImage = "AGGREGATE", @Image = "aggregate"] + | +- FromClause[@CanonicalImage = null] + | | +- JoinClause[@CanonicalImage = null] + | | +- TableReference[@CanonicalImage = null] + | | | +- TableName[@CanonicalImage = "USER_OBJECTS", @Image = "USER_OBJECTS"] + | | | | +- ID[@CanonicalImage = "USER_OBJECTS", @Image = "USER_OBJECTS"] + | | | +- TableAlias[@CanonicalImage = "U", @Image = "u"] + | | | | +- ID[@CanonicalImage = "U", @Image = "u"] + | | | +- TableAlias[@CanonicalImage = "INNER", @Image = "INNER"] + | | | +- ID[@CanonicalImage = "INNER", @Image = "INNER"] + | | | +- KEYWORD_UNRESERVED[@CanonicalImage = "INNER", @Image = "INNER"] + | | +- InnerCrossJoinClause[@CanonicalImage = null, @Cross = false, @Natural = false] + | | | +- TableReference[@CanonicalImage = null] + | | | | +- TableName[@CanonicalImage = "ALL_OBJECTS", @Image = "ALL_OBJECTS"] + | | | | | +- ID[@CanonicalImage = "ALL_OBJECTS", @Image = "ALL_OBJECTS"] + | | | | +- TableAlias[@CanonicalImage = "A", @Image = "a"] + | | | | +- ID[@CanonicalImage = "A", @Image = "a"] + | | | | +- KEYWORD_UNRESERVED[@CanonicalImage = "A", @Image = "a"] + | | | +- ConditionalAndExpression[@CanonicalImage = "U.OBJECT_NAME = A.OBJECT_NAME AND U.OBJECT_TYPE = A.OBJECT_TYPE AND U.OBJECT_ID = A.OBJECT_ID", @Image = "u.object_name = a.object_name AND u.object_type = a.object_type AND u.object_id = a.object_id"] + | | | +- EqualityExpression[@CanonicalImage = "U.OBJECT_NAME = A.OBJECT_NAME", @Image = "u.object_name = a.object_name"] + | | | | +- PrimaryPrefix[@CanonicalImage = "U.OBJECT_NAME", @Image = "u.object_name", @SelfModifier = false] + | | | | | +- SimpleExpression[@CanonicalImage = "U.OBJECT_NAME", @Image = "u.object_name"] + | | | | | +- TableName[@CanonicalImage = "U", @Image = "u"] + | | | | | | +- ID[@CanonicalImage = "U", @Image = "u"] + | | | | | +- Column[@CanonicalImage = "OBJECT_NAME", @Image = "object_name"] + | | | | | +- ID[@CanonicalImage = "OBJECT_NAME", @Image = "object_name"] + | | | | +- PrimaryPrefix[@CanonicalImage = "A.OBJECT_NAME", @Image = "a.object_name", @SelfModifier = false] + | | | | +- SimpleExpression[@CanonicalImage = "A.OBJECT_NAME", @Image = "a.object_name"] + | | | | +- TableName[@CanonicalImage = "A", @Image = "a"] + | | | | | +- ID[@CanonicalImage = "A", @Image = "a"] + | | | | | +- KEYWORD_UNRESERVED[@CanonicalImage = "A", @Image = "a"] + | | | | +- Column[@CanonicalImage = "OBJECT_NAME", @Image = "object_name"] + | | | | +- ID[@CanonicalImage = "OBJECT_NAME", @Image = "object_name"] + | | | +- EqualityExpression[@CanonicalImage = "U.OBJECT_TYPE = A.OBJECT_TYPE", @Image = "u.object_type = a.object_type"] + | | | | +- PrimaryPrefix[@CanonicalImage = "U.OBJECT_TYPE", @Image = "u.object_type", @SelfModifier = false] + | | | | | +- SimpleExpression[@CanonicalImage = "U.OBJECT_TYPE", @Image = "u.object_type"] + | | | | | +- TableName[@CanonicalImage = "U", @Image = "u"] + | | | | | | +- ID[@CanonicalImage = "U", @Image = "u"] + | | | | | +- Column[@CanonicalImage = "OBJECT_TYPE", @Image = "object_type"] + | | | | | +- ID[@CanonicalImage = "OBJECT_TYPE", @Image = "object_type"] + | | | | +- PrimaryPrefix[@CanonicalImage = "A.OBJECT_TYPE", @Image = "a.object_type", @SelfModifier = false] + | | | | +- SimpleExpression[@CanonicalImage = "A.OBJECT_TYPE", @Image = "a.object_type"] + | | | | +- TableName[@CanonicalImage = "A", @Image = "a"] + | | | | | +- ID[@CanonicalImage = "A", @Image = "a"] + | | | | | +- KEYWORD_UNRESERVED[@CanonicalImage = "A", @Image = "a"] + | | | | +- Column[@CanonicalImage = "OBJECT_TYPE", @Image = "object_type"] + | | | | +- ID[@CanonicalImage = "OBJECT_TYPE", @Image = "object_type"] + | | | +- EqualityExpression[@CanonicalImage = "U.OBJECT_ID = A.OBJECT_ID", @Image = "u.object_id = a.object_id"] + | | | +- PrimaryPrefix[@CanonicalImage = "U.OBJECT_ID", @Image = "u.object_id", @SelfModifier = false] + | | | | +- SimpleExpression[@CanonicalImage = "U.OBJECT_ID", @Image = "u.object_id"] + | | | | +- TableName[@CanonicalImage = "U", @Image = "u"] + | | | | | +- ID[@CanonicalImage = "U", @Image = "u"] + | | | | +- Column[@CanonicalImage = "OBJECT_ID", @Image = "object_id"] + | | | | +- ID[@CanonicalImage = "OBJECT_ID", @Image = "object_id"] + | | | +- PrimaryPrefix[@CanonicalImage = "A.OBJECT_ID", @Image = "a.object_id", @SelfModifier = false] + | | | +- SimpleExpression[@CanonicalImage = "A.OBJECT_ID", @Image = "a.object_id"] + | | | +- TableName[@CanonicalImage = "A", @Image = "a"] + | | | | +- ID[@CanonicalImage = "A", @Image = "a"] + | | | | +- KEYWORD_UNRESERVED[@CanonicalImage = "A", @Image = "a"] + | | | +- Column[@CanonicalImage = "OBJECT_ID", @Image = "object_id"] + | | | +- ID[@CanonicalImage = "OBJECT_ID", @Image = "object_id"] + | | +- InnerCrossJoinClause[@CanonicalImage = null, @Cross = false, @Natural = false] + | | +- TableReference[@CanonicalImage = null] + | | | +- TableName[@CanonicalImage = "ALL_PROCEDURES", @Image = "ALL_PROCEDURES"] + | | | | +- ID[@CanonicalImage = "ALL_PROCEDURES", @Image = "ALL_PROCEDURES"] + | | | +- TableAlias[@CanonicalImage = "P", @Image = "p"] + | | | +- ID[@CanonicalImage = "P", @Image = "p"] + | | +- ConditionalAndExpression[@CanonicalImage = "P.OWNER = A.OWNER AND P.OBJECT_NAME = A.OBJECT_NAME AND P.OBJECT_TYPE = A.OBJECT_TYPE", @Image = "p.owner = a.owner AND p.object_name = a.object_name AND p.object_type = a.object_type"] + | | +- EqualityExpression[@CanonicalImage = "P.OWNER = A.OWNER", @Image = "p.owner = a.owner"] + | | | +- PrimaryPrefix[@CanonicalImage = "P.OWNER", @Image = "p.owner", @SelfModifier = false] + | | | | +- SimpleExpression[@CanonicalImage = "P.OWNER", @Image = "p.owner"] + | | | | +- TableName[@CanonicalImage = "P", @Image = "p"] + | | | | | +- ID[@CanonicalImage = "P", @Image = "p"] + | | | | +- Column[@CanonicalImage = "OWNER", @Image = "owner"] + | | | | +- ID[@CanonicalImage = "OWNER", @Image = "owner"] + | | | +- PrimaryPrefix[@CanonicalImage = "A.OWNER", @Image = "a.owner", @SelfModifier = false] + | | | +- SimpleExpression[@CanonicalImage = "A.OWNER", @Image = "a.owner"] + | | | +- TableName[@CanonicalImage = "A", @Image = "a"] + | | | | +- ID[@CanonicalImage = "A", @Image = "a"] + | | | | +- KEYWORD_UNRESERVED[@CanonicalImage = "A", @Image = "a"] + | | | +- Column[@CanonicalImage = "OWNER", @Image = "owner"] + | | | +- ID[@CanonicalImage = "OWNER", @Image = "owner"] + | | +- EqualityExpression[@CanonicalImage = "P.OBJECT_NAME = A.OBJECT_NAME", @Image = "p.object_name = a.object_name"] + | | | +- PrimaryPrefix[@CanonicalImage = "P.OBJECT_NAME", @Image = "p.object_name", @SelfModifier = false] + | | | | +- SimpleExpression[@CanonicalImage = "P.OBJECT_NAME", @Image = "p.object_name"] + | | | | +- TableName[@CanonicalImage = "P", @Image = "p"] + | | | | | +- ID[@CanonicalImage = "P", @Image = "p"] + | | | | +- Column[@CanonicalImage = "OBJECT_NAME", @Image = "object_name"] + | | | | +- ID[@CanonicalImage = "OBJECT_NAME", @Image = "object_name"] + | | | +- PrimaryPrefix[@CanonicalImage = "A.OBJECT_NAME", @Image = "a.object_name", @SelfModifier = false] + | | | +- SimpleExpression[@CanonicalImage = "A.OBJECT_NAME", @Image = "a.object_name"] + | | | +- TableName[@CanonicalImage = "A", @Image = "a"] + | | | | +- ID[@CanonicalImage = "A", @Image = "a"] + | | | | +- KEYWORD_UNRESERVED[@CanonicalImage = "A", @Image = "a"] + | | | +- Column[@CanonicalImage = "OBJECT_NAME", @Image = "object_name"] + | | | +- ID[@CanonicalImage = "OBJECT_NAME", @Image = "object_name"] + | | +- EqualityExpression[@CanonicalImage = "P.OBJECT_TYPE = A.OBJECT_TYPE", @Image = "p.object_type = a.object_type"] + | | +- PrimaryPrefix[@CanonicalImage = "P.OBJECT_TYPE", @Image = "p.object_type", @SelfModifier = false] + | | | +- SimpleExpression[@CanonicalImage = "P.OBJECT_TYPE", @Image = "p.object_type"] + | | | +- TableName[@CanonicalImage = "P", @Image = "p"] + | | | | +- ID[@CanonicalImage = "P", @Image = "p"] + | | | +- Column[@CanonicalImage = "OBJECT_TYPE", @Image = "object_type"] + | | | +- ID[@CanonicalImage = "OBJECT_TYPE", @Image = "object_type"] + | | +- PrimaryPrefix[@CanonicalImage = "A.OBJECT_TYPE", @Image = "a.object_type", @SelfModifier = false] + | | +- SimpleExpression[@CanonicalImage = "A.OBJECT_TYPE", @Image = "a.object_type"] + | | +- TableName[@CanonicalImage = "A", @Image = "a"] + | | | +- ID[@CanonicalImage = "A", @Image = "a"] + | | | +- KEYWORD_UNRESERVED[@CanonicalImage = "A", @Image = "a"] + | | +- Column[@CanonicalImage = "OBJECT_TYPE", @Image = "object_type"] + | | +- ID[@CanonicalImage = "OBJECT_TYPE", @Image = "object_type"] + | +- WhereClause[@CanonicalImage = null] + | +- Condition[@CanonicalImage = null] + | +- CompoundCondition[@CanonicalImage = null, @Type = null] + | +- ComparisonCondition[@CanonicalImage = null, @Operator = "="] + | +- SqlExpression[@CanonicalImage = "A.OWNER", @Image = "a.owner"] + | | +- PrimaryPrefix[@CanonicalImage = "A.OWNER", @Image = "a.owner", @SelfModifier = false] + | | +- SimpleExpression[@CanonicalImage = "A.OWNER", @Image = "a.owner"] + | | +- TableName[@CanonicalImage = "A", @Image = "a"] + | | | +- ID[@CanonicalImage = "A", @Image = "a"] + | | | +- KEYWORD_UNRESERVED[@CanonicalImage = "A", @Image = "a"] + | | +- Column[@CanonicalImage = "OWNER", @Image = "owner"] + | | +- ID[@CanonicalImage = "OWNER", @Image = "owner"] + | +- SqlExpression[@CanonicalImage = "USER", @Image = "USER"] + | +- PrimaryPrefix[@CanonicalImage = "USER", @Image = "USER", @SelfModifier = false] + | +- SimpleExpression[@CanonicalImage = "USER", @Image = "USER"] + | +- Column[@CanonicalImage = "USER", @Image = "USER"] + | +- ID[@CanonicalImage = "USER", @Image = "USER"] + | +- KEYWORD_UNRESERVED[@CanonicalImage = "USER", @Image = "USER"] + +- Statement[@CanonicalImage = null] + | +- UnlabelledStatement[@CanonicalImage = null] + | +- ForStatement[@CanonicalImage = null] + | +- ForIndex[@CanonicalImage = "L_OBJECT", @Image = "l_object"] + | | +- ID[@CanonicalImage = "L_OBJECT", @Image = "l_object"] + | +- Expression[@CanonicalImage = "C_EXAMPLE", @Image = "c_example"] + | | +- PrimaryPrefix[@CanonicalImage = "C_EXAMPLE", @Image = "c_example", @SelfModifier = false] + | | +- SimpleExpression[@CanonicalImage = "C_EXAMPLE", @Image = "c_example"] + | | +- Column[@CanonicalImage = "C_EXAMPLE", @Image = "c_example"] + | | +- ID[@CanonicalImage = "C_EXAMPLE", @Image = "c_example"] + | +- Statement[@CanonicalImage = null] + | | +- UnlabelledStatement[@CanonicalImage = null] + | | +- Expression[@CanonicalImage = "DBMS_OUTPUT.PUT_LINE", @Image = "DBMS_OUTPUT.Put_Line"] + | | +- PrimaryPrefix[@CanonicalImage = "DBMS_OUTPUT.PUT_LINE", @Image = "DBMS_OUTPUT.Put_Line", @SelfModifier = false] + | | +- FunctionCall[@CanonicalImage = "DBMS_OUTPUT.PUT_LINE", @Image = "DBMS_OUTPUT.Put_Line"] + | | +- FunctionName[@CanonicalImage = "DBMS_OUTPUT.PUT_LINE", @Image = "DBMS_OUTPUT.Put_Line"] + | | | +- ID[@CanonicalImage = "DBMS_OUTPUT", @Image = "DBMS_OUTPUT"] + | | | +- ID[@CanonicalImage = "PUT_LINE", @Image = "Put_Line"] + | | +- Arguments[@ArgumentCount = 1, @CanonicalImage = null] + | | +- ArgumentList[@CanonicalImage = null] + | | +- Argument[@CanonicalImage = null] + | | +- Expression[@CanonicalImage = "L_OBJECT.OWNER", @Image = "l_object.owner"] + | | +- PrimaryPrefix[@CanonicalImage = "L_OBJECT.OWNER", @Image = "l_object.owner", @SelfModifier = false] + | | +- SimpleExpression[@CanonicalImage = "L_OBJECT.OWNER", @Image = "l_object.owner"] + | | +- TableName[@CanonicalImage = "L_OBJECT", @Image = "l_object"] + | | | +- ID[@CanonicalImage = "L_OBJECT", @Image = "l_object"] + | | +- Column[@CanonicalImage = "OWNER", @Image = "owner"] + | | +- ID[@CanonicalImage = "OWNER", @Image = "owner"] + | +- Statement[@CanonicalImage = null] + | | +- UnlabelledStatement[@CanonicalImage = null] + | | +- Expression[@CanonicalImage = "DBMS_OUTPUT.PUT_LINE", @Image = "DBMS_OUTPUT.Put_Line"] + | | +- PrimaryPrefix[@CanonicalImage = "DBMS_OUTPUT.PUT_LINE", @Image = "DBMS_OUTPUT.Put_Line", @SelfModifier = false] + | | +- FunctionCall[@CanonicalImage = "DBMS_OUTPUT.PUT_LINE", @Image = "DBMS_OUTPUT.Put_Line"] + | | +- FunctionName[@CanonicalImage = "DBMS_OUTPUT.PUT_LINE", @Image = "DBMS_OUTPUT.Put_Line"] + | | | +- ID[@CanonicalImage = "DBMS_OUTPUT", @Image = "DBMS_OUTPUT"] + | | | +- ID[@CanonicalImage = "PUT_LINE", @Image = "Put_Line"] + | | +- Arguments[@ArgumentCount = 1, @CanonicalImage = null] + | | +- ArgumentList[@CanonicalImage = null] + | | +- Argument[@CanonicalImage = null] + | | +- Expression[@CanonicalImage = "L_OBJECT.OBJECT_NAME", @Image = "l_object.object_name"] + | | +- PrimaryPrefix[@CanonicalImage = "L_OBJECT.OBJECT_NAME", @Image = "l_object.object_name", @SelfModifier = false] + | | +- SimpleExpression[@CanonicalImage = "L_OBJECT.OBJECT_NAME", @Image = "l_object.object_name"] + | | +- TableName[@CanonicalImage = "L_OBJECT", @Image = "l_object"] + | | | +- ID[@CanonicalImage = "L_OBJECT", @Image = "l_object"] + | | +- Column[@CanonicalImage = "OBJECT_NAME", @Image = "object_name"] + | | +- ID[@CanonicalImage = "OBJECT_NAME", @Image = "object_name"] + | +- Statement[@CanonicalImage = null] + | +- UnlabelledStatement[@CanonicalImage = null] + | +- Expression[@CanonicalImage = "DBMS_OUTPUT.PUT_LINE", @Image = "DBMS_OUTPUT.Put_Line"] + | +- PrimaryPrefix[@CanonicalImage = "DBMS_OUTPUT.PUT_LINE", @Image = "DBMS_OUTPUT.Put_Line", @SelfModifier = false] + | +- FunctionCall[@CanonicalImage = "DBMS_OUTPUT.PUT_LINE", @Image = "DBMS_OUTPUT.Put_Line"] + | +- FunctionName[@CanonicalImage = "DBMS_OUTPUT.PUT_LINE", @Image = "DBMS_OUTPUT.Put_Line"] + | | +- ID[@CanonicalImage = "DBMS_OUTPUT", @Image = "DBMS_OUTPUT"] + | | +- ID[@CanonicalImage = "PUT_LINE", @Image = "Put_Line"] + | +- Arguments[@ArgumentCount = 1, @CanonicalImage = null] + | +- ArgumentList[@CanonicalImage = null] + | +- Argument[@CanonicalImage = null] + | +- Expression[@CanonicalImage = "L_OBJECT.AGGREGATE", @Image = "l_object.aggregate"] + | +- PrimaryPrefix[@CanonicalImage = "L_OBJECT.AGGREGATE", @Image = "l_object.aggregate", @SelfModifier = false] + | +- SimpleExpression[@CanonicalImage = "L_OBJECT.AGGREGATE", @Image = "l_object.aggregate"] + | +- TableName[@CanonicalImage = "L_OBJECT", @Image = "l_object"] + | | +- ID[@CanonicalImage = "L_OBJECT", @Image = "l_object"] + | +- Column[@CanonicalImage = "AGGREGATE", @Image = "aggregate"] + | +- ID[@CanonicalImage = "AGGREGATE", @Image = "aggregate"] + | +- KEYWORD_UNRESERVED[@CanonicalImage = "AGGREGATE", @Image = "aggregate"] + +- ID[@CanonicalImage = "EXAMPLE_PROCEDURE", @Image = "EXAMPLE_PROCEDURE"] diff --git a/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/ParenthesisGroup1.txt b/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/ParenthesisGroup1.txt new file mode 100644 index 0000000000..1d77da1f68 --- /dev/null +++ b/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/ParenthesisGroup1.txt @@ -0,0 +1,250 @@ ++- Input[@CanonicalImage = null, @ExcludedLinesCount = 0, @ExcludedRangesCount = 0, @Sourcecode = "CREATE OR REPLACE PROCEDURE EXAMPLE_PROCEDURE IS + -- + CURSOR c_example IS + SELECT a.owner, u.object_name, p.aggregate + FROM (((USER_OBJECTS u) INNER JOIN (ALL_OBJECTS a) ON + u.object_name = a.object_name AND u.object_type = a.object_type AND u.object_id = a.object_id) + INNER JOIN (ALL_PROCEDURES p) ON + p.owner = a.owner AND p.object_name = a.object_name AND p.object_type = a.object_type) + WHERE a.owner = USER; + -- +BEGIN + -- + FOR l_object IN c_example LOOP + -- + DBMS_OUTPUT.Put_Line(l_object.owner); + DBMS_OUTPUT.Put_Line(l_object.object_name); + DBMS_OUTPUT.Put_Line(l_object.aggregate); + -- + END LOOP; + -- +END EXAMPLE_PROCEDURE; +"] + +- Global[@CanonicalImage = null] + +- ProgramUnit[@CanonicalImage = null, @MethodName = "EXAMPLE_PROCEDURE", @Name = "EXAMPLE_PROCEDURE", @ObjectName = null] + +- MethodDeclarator[@CanonicalImage = "EXAMPLE_PROCEDURE", @Image = "EXAMPLE_PROCEDURE", @ParameterCount = 1] + | +- ObjectNameDeclaration[@CanonicalImage = "EXAMPLE_PROCEDURE", @Image = "EXAMPLE_PROCEDURE"] + | +- ID[@CanonicalImage = "EXAMPLE_PROCEDURE", @Image = "EXAMPLE_PROCEDURE"] + +- DeclarativeSection[@CanonicalImage = null] + | +- DeclarativeUnit[@CanonicalImage = null] + | +- CursorSpecification[@CanonicalImage = null] + | +- CursorUnit[@CanonicalImage = "C_EXAMPLE", @Image = "c_example"] + | +- ID[@CanonicalImage = "C_EXAMPLE", @Image = "c_example"] + | +- SelectStatement[@All = false, @CanonicalImage = null, @Distinct = false, @Unique = false] + | +- SelectList[@CanonicalImage = null] + | | +- SqlExpression[@CanonicalImage = "A.OWNER", @Image = "a.owner"] + | | | +- PrimaryPrefix[@CanonicalImage = "A.OWNER", @Image = "a.owner", @SelfModifier = false] + | | | +- SimpleExpression[@CanonicalImage = "A.OWNER", @Image = "a.owner"] + | | | +- TableName[@CanonicalImage = "A", @Image = "a"] + | | | | +- ID[@CanonicalImage = "A", @Image = "a"] + | | | | +- KEYWORD_UNRESERVED[@CanonicalImage = "A", @Image = "a"] + | | | +- Column[@CanonicalImage = "OWNER", @Image = "owner"] + | | | +- ID[@CanonicalImage = "OWNER", @Image = "owner"] + | | +- SqlExpression[@CanonicalImage = "U.OBJECT_NAME", @Image = "u.object_name"] + | | | +- PrimaryPrefix[@CanonicalImage = "U.OBJECT_NAME", @Image = "u.object_name", @SelfModifier = false] + | | | +- SimpleExpression[@CanonicalImage = "U.OBJECT_NAME", @Image = "u.object_name"] + | | | +- TableName[@CanonicalImage = "U", @Image = "u"] + | | | | +- ID[@CanonicalImage = "U", @Image = "u"] + | | | +- Column[@CanonicalImage = "OBJECT_NAME", @Image = "object_name"] + | | | +- ID[@CanonicalImage = "OBJECT_NAME", @Image = "object_name"] + | | +- SqlExpression[@CanonicalImage = "P.AGGREGATE", @Image = "p.aggregate"] + | | +- PrimaryPrefix[@CanonicalImage = "P.AGGREGATE", @Image = "p.aggregate", @SelfModifier = false] + | | +- SimpleExpression[@CanonicalImage = "P.AGGREGATE", @Image = "p.aggregate"] + | | +- TableName[@CanonicalImage = "P", @Image = "p"] + | | | +- ID[@CanonicalImage = "P", @Image = "p"] + | | +- Column[@CanonicalImage = "AGGREGATE", @Image = "aggregate"] + | | +- ID[@CanonicalImage = "AGGREGATE", @Image = "aggregate"] + | | +- KEYWORD_UNRESERVED[@CanonicalImage = "AGGREGATE", @Image = "aggregate"] + | +- FromClause[@CanonicalImage = null] + | | +- TableReference[@CanonicalImage = null] + | | +- JoinClause[@CanonicalImage = null] + | | +- TableReference[@CanonicalImage = null] + | | | +- JoinClause[@CanonicalImage = null] + | | | +- TableReference[@CanonicalImage = null] + | | | | +- TableName[@CanonicalImage = "USER_OBJECTS", @Image = "USER_OBJECTS"] + | | | | | +- ID[@CanonicalImage = "USER_OBJECTS", @Image = "USER_OBJECTS"] + | | | | +- TableAlias[@CanonicalImage = "U", @Image = "u"] + | | | | +- ID[@CanonicalImage = "U", @Image = "u"] + | | | +- InnerCrossJoinClause[@CanonicalImage = null, @Cross = false, @Natural = false] + | | | +- TableReference[@CanonicalImage = null] + | | | | +- TableName[@CanonicalImage = "ALL_OBJECTS", @Image = "ALL_OBJECTS"] + | | | | | +- ID[@CanonicalImage = "ALL_OBJECTS", @Image = "ALL_OBJECTS"] + | | | | +- TableAlias[@CanonicalImage = "A", @Image = "a"] + | | | | +- ID[@CanonicalImage = "A", @Image = "a"] + | | | | +- KEYWORD_UNRESERVED[@CanonicalImage = "A", @Image = "a"] + | | | +- ConditionalAndExpression[@CanonicalImage = "U.OBJECT_NAME = A.OBJECT_NAME AND U.OBJECT_TYPE = A.OBJECT_TYPE AND U.OBJECT_ID = A.OBJECT_ID", @Image = "u.object_name = a.object_name AND u.object_type = a.object_type AND u.object_id = a.object_id"] + | | | +- EqualityExpression[@CanonicalImage = "U.OBJECT_NAME = A.OBJECT_NAME", @Image = "u.object_name = a.object_name"] + | | | | +- PrimaryPrefix[@CanonicalImage = "U.OBJECT_NAME", @Image = "u.object_name", @SelfModifier = false] + | | | | | +- SimpleExpression[@CanonicalImage = "U.OBJECT_NAME", @Image = "u.object_name"] + | | | | | +- TableName[@CanonicalImage = "U", @Image = "u"] + | | | | | | +- ID[@CanonicalImage = "U", @Image = "u"] + | | | | | +- Column[@CanonicalImage = "OBJECT_NAME", @Image = "object_name"] + | | | | | +- ID[@CanonicalImage = "OBJECT_NAME", @Image = "object_name"] + | | | | +- PrimaryPrefix[@CanonicalImage = "A.OBJECT_NAME", @Image = "a.object_name", @SelfModifier = false] + | | | | +- SimpleExpression[@CanonicalImage = "A.OBJECT_NAME", @Image = "a.object_name"] + | | | | +- TableName[@CanonicalImage = "A", @Image = "a"] + | | | | | +- ID[@CanonicalImage = "A", @Image = "a"] + | | | | | +- KEYWORD_UNRESERVED[@CanonicalImage = "A", @Image = "a"] + | | | | +- Column[@CanonicalImage = "OBJECT_NAME", @Image = "object_name"] + | | | | +- ID[@CanonicalImage = "OBJECT_NAME", @Image = "object_name"] + | | | +- EqualityExpression[@CanonicalImage = "U.OBJECT_TYPE = A.OBJECT_TYPE", @Image = "u.object_type = a.object_type"] + | | | | +- PrimaryPrefix[@CanonicalImage = "U.OBJECT_TYPE", @Image = "u.object_type", @SelfModifier = false] + | | | | | +- SimpleExpression[@CanonicalImage = "U.OBJECT_TYPE", @Image = "u.object_type"] + | | | | | +- TableName[@CanonicalImage = "U", @Image = "u"] + | | | | | | +- ID[@CanonicalImage = "U", @Image = "u"] + | | | | | +- Column[@CanonicalImage = "OBJECT_TYPE", @Image = "object_type"] + | | | | | +- ID[@CanonicalImage = "OBJECT_TYPE", @Image = "object_type"] + | | | | +- PrimaryPrefix[@CanonicalImage = "A.OBJECT_TYPE", @Image = "a.object_type", @SelfModifier = false] + | | | | +- SimpleExpression[@CanonicalImage = "A.OBJECT_TYPE", @Image = "a.object_type"] + | | | | +- TableName[@CanonicalImage = "A", @Image = "a"] + | | | | | +- ID[@CanonicalImage = "A", @Image = "a"] + | | | | | +- KEYWORD_UNRESERVED[@CanonicalImage = "A", @Image = "a"] + | | | | +- Column[@CanonicalImage = "OBJECT_TYPE", @Image = "object_type"] + | | | | +- ID[@CanonicalImage = "OBJECT_TYPE", @Image = "object_type"] + | | | +- EqualityExpression[@CanonicalImage = "U.OBJECT_ID = A.OBJECT_ID", @Image = "u.object_id = a.object_id"] + | | | +- PrimaryPrefix[@CanonicalImage = "U.OBJECT_ID", @Image = "u.object_id", @SelfModifier = false] + | | | | +- SimpleExpression[@CanonicalImage = "U.OBJECT_ID", @Image = "u.object_id"] + | | | | +- TableName[@CanonicalImage = "U", @Image = "u"] + | | | | | +- ID[@CanonicalImage = "U", @Image = "u"] + | | | | +- Column[@CanonicalImage = "OBJECT_ID", @Image = "object_id"] + | | | | +- ID[@CanonicalImage = "OBJECT_ID", @Image = "object_id"] + | | | +- PrimaryPrefix[@CanonicalImage = "A.OBJECT_ID", @Image = "a.object_id", @SelfModifier = false] + | | | +- SimpleExpression[@CanonicalImage = "A.OBJECT_ID", @Image = "a.object_id"] + | | | +- TableName[@CanonicalImage = "A", @Image = "a"] + | | | | +- ID[@CanonicalImage = "A", @Image = "a"] + | | | | +- KEYWORD_UNRESERVED[@CanonicalImage = "A", @Image = "a"] + | | | +- Column[@CanonicalImage = "OBJECT_ID", @Image = "object_id"] + | | | +- ID[@CanonicalImage = "OBJECT_ID", @Image = "object_id"] + | | +- InnerCrossJoinClause[@CanonicalImage = null, @Cross = false, @Natural = false] + | | +- TableReference[@CanonicalImage = null] + | | | +- TableName[@CanonicalImage = "ALL_PROCEDURES", @Image = "ALL_PROCEDURES"] + | | | | +- ID[@CanonicalImage = "ALL_PROCEDURES", @Image = "ALL_PROCEDURES"] + | | | +- TableAlias[@CanonicalImage = "P", @Image = "p"] + | | | +- ID[@CanonicalImage = "P", @Image = "p"] + | | +- ConditionalAndExpression[@CanonicalImage = "P.OWNER = A.OWNER AND P.OBJECT_NAME = A.OBJECT_NAME AND P.OBJECT_TYPE = A.OBJECT_TYPE", @Image = "p.owner = a.owner AND p.object_name = a.object_name AND p.object_type = a.object_type"] + | | +- EqualityExpression[@CanonicalImage = "P.OWNER = A.OWNER", @Image = "p.owner = a.owner"] + | | | +- PrimaryPrefix[@CanonicalImage = "P.OWNER", @Image = "p.owner", @SelfModifier = false] + | | | | +- SimpleExpression[@CanonicalImage = "P.OWNER", @Image = "p.owner"] + | | | | +- TableName[@CanonicalImage = "P", @Image = "p"] + | | | | | +- ID[@CanonicalImage = "P", @Image = "p"] + | | | | +- Column[@CanonicalImage = "OWNER", @Image = "owner"] + | | | | +- ID[@CanonicalImage = "OWNER", @Image = "owner"] + | | | +- PrimaryPrefix[@CanonicalImage = "A.OWNER", @Image = "a.owner", @SelfModifier = false] + | | | +- SimpleExpression[@CanonicalImage = "A.OWNER", @Image = "a.owner"] + | | | +- TableName[@CanonicalImage = "A", @Image = "a"] + | | | | +- ID[@CanonicalImage = "A", @Image = "a"] + | | | | +- KEYWORD_UNRESERVED[@CanonicalImage = "A", @Image = "a"] + | | | +- Column[@CanonicalImage = "OWNER", @Image = "owner"] + | | | +- ID[@CanonicalImage = "OWNER", @Image = "owner"] + | | +- EqualityExpression[@CanonicalImage = "P.OBJECT_NAME = A.OBJECT_NAME", @Image = "p.object_name = a.object_name"] + | | | +- PrimaryPrefix[@CanonicalImage = "P.OBJECT_NAME", @Image = "p.object_name", @SelfModifier = false] + | | | | +- SimpleExpression[@CanonicalImage = "P.OBJECT_NAME", @Image = "p.object_name"] + | | | | +- TableName[@CanonicalImage = "P", @Image = "p"] + | | | | | +- ID[@CanonicalImage = "P", @Image = "p"] + | | | | +- Column[@CanonicalImage = "OBJECT_NAME", @Image = "object_name"] + | | | | +- ID[@CanonicalImage = "OBJECT_NAME", @Image = "object_name"] + | | | +- PrimaryPrefix[@CanonicalImage = "A.OBJECT_NAME", @Image = "a.object_name", @SelfModifier = false] + | | | +- SimpleExpression[@CanonicalImage = "A.OBJECT_NAME", @Image = "a.object_name"] + | | | +- TableName[@CanonicalImage = "A", @Image = "a"] + | | | | +- ID[@CanonicalImage = "A", @Image = "a"] + | | | | +- KEYWORD_UNRESERVED[@CanonicalImage = "A", @Image = "a"] + | | | +- Column[@CanonicalImage = "OBJECT_NAME", @Image = "object_name"] + | | | +- ID[@CanonicalImage = "OBJECT_NAME", @Image = "object_name"] + | | +- EqualityExpression[@CanonicalImage = "P.OBJECT_TYPE = A.OBJECT_TYPE", @Image = "p.object_type = a.object_type"] + | | +- PrimaryPrefix[@CanonicalImage = "P.OBJECT_TYPE", @Image = "p.object_type", @SelfModifier = false] + | | | +- SimpleExpression[@CanonicalImage = "P.OBJECT_TYPE", @Image = "p.object_type"] + | | | +- TableName[@CanonicalImage = "P", @Image = "p"] + | | | | +- ID[@CanonicalImage = "P", @Image = "p"] + | | | +- Column[@CanonicalImage = "OBJECT_TYPE", @Image = "object_type"] + | | | +- ID[@CanonicalImage = "OBJECT_TYPE", @Image = "object_type"] + | | +- PrimaryPrefix[@CanonicalImage = "A.OBJECT_TYPE", @Image = "a.object_type", @SelfModifier = false] + | | +- SimpleExpression[@CanonicalImage = "A.OBJECT_TYPE", @Image = "a.object_type"] + | | +- TableName[@CanonicalImage = "A", @Image = "a"] + | | | +- ID[@CanonicalImage = "A", @Image = "a"] + | | | +- KEYWORD_UNRESERVED[@CanonicalImage = "A", @Image = "a"] + | | +- Column[@CanonicalImage = "OBJECT_TYPE", @Image = "object_type"] + | | +- ID[@CanonicalImage = "OBJECT_TYPE", @Image = "object_type"] + | +- WhereClause[@CanonicalImage = null] + | +- Condition[@CanonicalImage = null] + | +- CompoundCondition[@CanonicalImage = null, @Type = null] + | +- ComparisonCondition[@CanonicalImage = null, @Operator = "="] + | +- SqlExpression[@CanonicalImage = "A.OWNER", @Image = "a.owner"] + | | +- PrimaryPrefix[@CanonicalImage = "A.OWNER", @Image = "a.owner", @SelfModifier = false] + | | +- SimpleExpression[@CanonicalImage = "A.OWNER", @Image = "a.owner"] + | | +- TableName[@CanonicalImage = "A", @Image = "a"] + | | | +- ID[@CanonicalImage = "A", @Image = "a"] + | | | +- KEYWORD_UNRESERVED[@CanonicalImage = "A", @Image = "a"] + | | +- Column[@CanonicalImage = "OWNER", @Image = "owner"] + | | +- ID[@CanonicalImage = "OWNER", @Image = "owner"] + | +- SqlExpression[@CanonicalImage = "USER", @Image = "USER"] + | +- PrimaryPrefix[@CanonicalImage = "USER", @Image = "USER", @SelfModifier = false] + | +- SimpleExpression[@CanonicalImage = "USER", @Image = "USER"] + | +- Column[@CanonicalImage = "USER", @Image = "USER"] + | +- ID[@CanonicalImage = "USER", @Image = "USER"] + | +- KEYWORD_UNRESERVED[@CanonicalImage = "USER", @Image = "USER"] + +- Statement[@CanonicalImage = null] + | +- UnlabelledStatement[@CanonicalImage = null] + | +- ForStatement[@CanonicalImage = null] + | +- ForIndex[@CanonicalImage = "L_OBJECT", @Image = "l_object"] + | | +- ID[@CanonicalImage = "L_OBJECT", @Image = "l_object"] + | +- Expression[@CanonicalImage = "C_EXAMPLE", @Image = "c_example"] + | | +- PrimaryPrefix[@CanonicalImage = "C_EXAMPLE", @Image = "c_example", @SelfModifier = false] + | | +- SimpleExpression[@CanonicalImage = "C_EXAMPLE", @Image = "c_example"] + | | +- Column[@CanonicalImage = "C_EXAMPLE", @Image = "c_example"] + | | +- ID[@CanonicalImage = "C_EXAMPLE", @Image = "c_example"] + | +- Statement[@CanonicalImage = null] + | | +- UnlabelledStatement[@CanonicalImage = null] + | | +- Expression[@CanonicalImage = "DBMS_OUTPUT.PUT_LINE", @Image = "DBMS_OUTPUT.Put_Line"] + | | +- PrimaryPrefix[@CanonicalImage = "DBMS_OUTPUT.PUT_LINE", @Image = "DBMS_OUTPUT.Put_Line", @SelfModifier = false] + | | +- FunctionCall[@CanonicalImage = "DBMS_OUTPUT.PUT_LINE", @Image = "DBMS_OUTPUT.Put_Line"] + | | +- FunctionName[@CanonicalImage = "DBMS_OUTPUT.PUT_LINE", @Image = "DBMS_OUTPUT.Put_Line"] + | | | +- ID[@CanonicalImage = "DBMS_OUTPUT", @Image = "DBMS_OUTPUT"] + | | | +- ID[@CanonicalImage = "PUT_LINE", @Image = "Put_Line"] + | | +- Arguments[@ArgumentCount = 1, @CanonicalImage = null] + | | +- ArgumentList[@CanonicalImage = null] + | | +- Argument[@CanonicalImage = null] + | | +- Expression[@CanonicalImage = "L_OBJECT.OWNER", @Image = "l_object.owner"] + | | +- PrimaryPrefix[@CanonicalImage = "L_OBJECT.OWNER", @Image = "l_object.owner", @SelfModifier = false] + | | +- SimpleExpression[@CanonicalImage = "L_OBJECT.OWNER", @Image = "l_object.owner"] + | | +- TableName[@CanonicalImage = "L_OBJECT", @Image = "l_object"] + | | | +- ID[@CanonicalImage = "L_OBJECT", @Image = "l_object"] + | | +- Column[@CanonicalImage = "OWNER", @Image = "owner"] + | | +- ID[@CanonicalImage = "OWNER", @Image = "owner"] + | +- Statement[@CanonicalImage = null] + | | +- UnlabelledStatement[@CanonicalImage = null] + | | +- Expression[@CanonicalImage = "DBMS_OUTPUT.PUT_LINE", @Image = "DBMS_OUTPUT.Put_Line"] + | | +- PrimaryPrefix[@CanonicalImage = "DBMS_OUTPUT.PUT_LINE", @Image = "DBMS_OUTPUT.Put_Line", @SelfModifier = false] + | | +- FunctionCall[@CanonicalImage = "DBMS_OUTPUT.PUT_LINE", @Image = "DBMS_OUTPUT.Put_Line"] + | | +- FunctionName[@CanonicalImage = "DBMS_OUTPUT.PUT_LINE", @Image = "DBMS_OUTPUT.Put_Line"] + | | | +- ID[@CanonicalImage = "DBMS_OUTPUT", @Image = "DBMS_OUTPUT"] + | | | +- ID[@CanonicalImage = "PUT_LINE", @Image = "Put_Line"] + | | +- Arguments[@ArgumentCount = 1, @CanonicalImage = null] + | | +- ArgumentList[@CanonicalImage = null] + | | +- Argument[@CanonicalImage = null] + | | +- Expression[@CanonicalImage = "L_OBJECT.OBJECT_NAME", @Image = "l_object.object_name"] + | | +- PrimaryPrefix[@CanonicalImage = "L_OBJECT.OBJECT_NAME", @Image = "l_object.object_name", @SelfModifier = false] + | | +- SimpleExpression[@CanonicalImage = "L_OBJECT.OBJECT_NAME", @Image = "l_object.object_name"] + | | +- TableName[@CanonicalImage = "L_OBJECT", @Image = "l_object"] + | | | +- ID[@CanonicalImage = "L_OBJECT", @Image = "l_object"] + | | +- Column[@CanonicalImage = "OBJECT_NAME", @Image = "object_name"] + | | +- ID[@CanonicalImage = "OBJECT_NAME", @Image = "object_name"] + | +- Statement[@CanonicalImage = null] + | +- UnlabelledStatement[@CanonicalImage = null] + | +- Expression[@CanonicalImage = "DBMS_OUTPUT.PUT_LINE", @Image = "DBMS_OUTPUT.Put_Line"] + | +- PrimaryPrefix[@CanonicalImage = "DBMS_OUTPUT.PUT_LINE", @Image = "DBMS_OUTPUT.Put_Line", @SelfModifier = false] + | +- FunctionCall[@CanonicalImage = "DBMS_OUTPUT.PUT_LINE", @Image = "DBMS_OUTPUT.Put_Line"] + | +- FunctionName[@CanonicalImage = "DBMS_OUTPUT.PUT_LINE", @Image = "DBMS_OUTPUT.Put_Line"] + | | +- ID[@CanonicalImage = "DBMS_OUTPUT", @Image = "DBMS_OUTPUT"] + | | +- ID[@CanonicalImage = "PUT_LINE", @Image = "Put_Line"] + | +- Arguments[@ArgumentCount = 1, @CanonicalImage = null] + | +- ArgumentList[@CanonicalImage = null] + | +- Argument[@CanonicalImage = null] + | +- Expression[@CanonicalImage = "L_OBJECT.AGGREGATE", @Image = "l_object.aggregate"] + | +- PrimaryPrefix[@CanonicalImage = "L_OBJECT.AGGREGATE", @Image = "l_object.aggregate", @SelfModifier = false] + | +- SimpleExpression[@CanonicalImage = "L_OBJECT.AGGREGATE", @Image = "l_object.aggregate"] + | +- TableName[@CanonicalImage = "L_OBJECT", @Image = "l_object"] + | | +- ID[@CanonicalImage = "L_OBJECT", @Image = "l_object"] + | +- Column[@CanonicalImage = "AGGREGATE", @Image = "aggregate"] + | +- ID[@CanonicalImage = "AGGREGATE", @Image = "aggregate"] + | +- KEYWORD_UNRESERVED[@CanonicalImage = "AGGREGATE", @Image = "aggregate"] + +- ID[@CanonicalImage = "EXAMPLE_PROCEDURE", @Image = "EXAMPLE_PROCEDURE"] diff --git a/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/ParenthesisGroup2.txt b/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/ParenthesisGroup2.txt new file mode 100644 index 0000000000..329d2f56ae --- /dev/null +++ b/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/ParenthesisGroup2.txt @@ -0,0 +1,150 @@ ++- Input[@CanonicalImage = null, @ExcludedLinesCount = 0, @ExcludedRangesCount = 0, @Sourcecode = "CREATE OR REPLACE PROCEDURE TEST_PROCEDURE IS + -- + CURSOR c_test IS + SELECT si.sid, sn.name, sa.age, ss.score, sp.parent + FROM ((((STUDENT_INFO si) INNER JOIN (STUDENT_AGE sa) on si.sid = sa.sid) + INNER JOIN + (STUDENT_SCORE ss) on si.sid = sp.sid) + INNER JOIN + (STUDENT_PARENT sp) on si.sid = sp.sid) + WHERE si.sid = '114514'; + -- +BEGIN + -- + -- +END EXAMPLE_PROCEDURE; +"] + +- Global[@CanonicalImage = null] + +- ProgramUnit[@CanonicalImage = null, @MethodName = "TEST_PROCEDURE", @Name = "TEST_PROCEDURE", @ObjectName = null] + +- MethodDeclarator[@CanonicalImage = "TEST_PROCEDURE", @Image = "TEST_PROCEDURE", @ParameterCount = 1] + | +- ObjectNameDeclaration[@CanonicalImage = "TEST_PROCEDURE", @Image = "TEST_PROCEDURE"] + | +- ID[@CanonicalImage = "TEST_PROCEDURE", @Image = "TEST_PROCEDURE"] + +- DeclarativeSection[@CanonicalImage = null] + | +- DeclarativeUnit[@CanonicalImage = null] + | +- CursorSpecification[@CanonicalImage = null] + | +- CursorUnit[@CanonicalImage = "C_TEST", @Image = "c_test"] + | +- ID[@CanonicalImage = "C_TEST", @Image = "c_test"] + | +- SelectStatement[@All = false, @CanonicalImage = null, @Distinct = false, @Unique = false] + | +- SelectList[@CanonicalImage = null] + | | +- SqlExpression[@CanonicalImage = "SI.SID", @Image = "si.sid"] + | | | +- PrimaryPrefix[@CanonicalImage = "SI.SID", @Image = "si.sid", @SelfModifier = false] + | | | +- SimpleExpression[@CanonicalImage = "SI.SID", @Image = "si.sid"] + | | | +- TableName[@CanonicalImage = "SI", @Image = "si"] + | | | | +- ID[@CanonicalImage = "SI", @Image = "si"] + | | | +- Column[@CanonicalImage = "SID", @Image = "sid"] + | | | +- ID[@CanonicalImage = "SID", @Image = "sid"] + | | +- SqlExpression[@CanonicalImage = "SN.NAME", @Image = "sn.name"] + | | | +- PrimaryPrefix[@CanonicalImage = "SN.NAME", @Image = "sn.name", @SelfModifier = false] + | | | +- SimpleExpression[@CanonicalImage = "SN.NAME", @Image = "sn.name"] + | | | +- TableName[@CanonicalImage = "SN", @Image = "sn"] + | | | | +- ID[@CanonicalImage = "SN", @Image = "sn"] + | | | +- Column[@CanonicalImage = "NAME", @Image = "name"] + | | | +- ID[@CanonicalImage = "NAME", @Image = "name"] + | | | +- KEYWORD_UNRESERVED[@CanonicalImage = "NAME", @Image = "name"] + | | +- SqlExpression[@CanonicalImage = "SA.AGE", @Image = "sa.age"] + | | | +- PrimaryPrefix[@CanonicalImage = "SA.AGE", @Image = "sa.age", @SelfModifier = false] + | | | +- SimpleExpression[@CanonicalImage = "SA.AGE", @Image = "sa.age"] + | | | +- TableName[@CanonicalImage = "SA", @Image = "sa"] + | | | | +- ID[@CanonicalImage = "SA", @Image = "sa"] + | | | +- Column[@CanonicalImage = "AGE", @Image = "age"] + | | | +- ID[@CanonicalImage = "AGE", @Image = "age"] + | | +- SqlExpression[@CanonicalImage = "SS.SCORE", @Image = "ss.score"] + | | | +- PrimaryPrefix[@CanonicalImage = "SS.SCORE", @Image = "ss.score", @SelfModifier = false] + | | | +- SimpleExpression[@CanonicalImage = "SS.SCORE", @Image = "ss.score"] + | | | +- TableName[@CanonicalImage = "SS", @Image = "ss"] + | | | | +- ID[@CanonicalImage = "SS", @Image = "ss"] + | | | +- Column[@CanonicalImage = "SCORE", @Image = "score"] + | | | +- ID[@CanonicalImage = "SCORE", @Image = "score"] + | | +- SqlExpression[@CanonicalImage = "SP.PARENT", @Image = "sp.parent"] + | | +- PrimaryPrefix[@CanonicalImage = "SP.PARENT", @Image = "sp.parent", @SelfModifier = false] + | | +- SimpleExpression[@CanonicalImage = "SP.PARENT", @Image = "sp.parent"] + | | +- TableName[@CanonicalImage = "SP", @Image = "sp"] + | | | +- ID[@CanonicalImage = "SP", @Image = "sp"] + | | +- Column[@CanonicalImage = "PARENT", @Image = "parent"] + | | +- ID[@CanonicalImage = "PARENT", @Image = "parent"] + | | +- KEYWORD_UNRESERVED[@CanonicalImage = "PARENT", @Image = "parent"] + | +- FromClause[@CanonicalImage = null] + | | +- TableReference[@CanonicalImage = null] + | | +- JoinClause[@CanonicalImage = null] + | | +- TableReference[@CanonicalImage = null] + | | | +- JoinClause[@CanonicalImage = null] + | | | +- TableReference[@CanonicalImage = null] + | | | | +- JoinClause[@CanonicalImage = null] + | | | | +- TableReference[@CanonicalImage = null] + | | | | | +- TableName[@CanonicalImage = "STUDENT_INFO", @Image = "STUDENT_INFO"] + | | | | | | +- ID[@CanonicalImage = "STUDENT_INFO", @Image = "STUDENT_INFO"] + | | | | | +- TableAlias[@CanonicalImage = "SI", @Image = "si"] + | | | | | +- ID[@CanonicalImage = "SI", @Image = "si"] + | | | | +- InnerCrossJoinClause[@CanonicalImage = null, @Cross = false, @Natural = false] + | | | | +- TableReference[@CanonicalImage = null] + | | | | | +- TableName[@CanonicalImage = "STUDENT_AGE", @Image = "STUDENT_AGE"] + | | | | | | +- ID[@CanonicalImage = "STUDENT_AGE", @Image = "STUDENT_AGE"] + | | | | | +- TableAlias[@CanonicalImage = "SA", @Image = "sa"] + | | | | | +- ID[@CanonicalImage = "SA", @Image = "sa"] + | | | | +- EqualityExpression[@CanonicalImage = "SI.SID = SA.SID", @Image = "si.sid = sa.sid"] + | | | | +- PrimaryPrefix[@CanonicalImage = "SI.SID", @Image = "si.sid", @SelfModifier = false] + | | | | | +- SimpleExpression[@CanonicalImage = "SI.SID", @Image = "si.sid"] + | | | | | +- TableName[@CanonicalImage = "SI", @Image = "si"] + | | | | | | +- ID[@CanonicalImage = "SI", @Image = "si"] + | | | | | +- Column[@CanonicalImage = "SID", @Image = "sid"] + | | | | | +- ID[@CanonicalImage = "SID", @Image = "sid"] + | | | | +- PrimaryPrefix[@CanonicalImage = "SA.SID", @Image = "sa.sid", @SelfModifier = false] + | | | | +- SimpleExpression[@CanonicalImage = "SA.SID", @Image = "sa.sid"] + | | | | +- TableName[@CanonicalImage = "SA", @Image = "sa"] + | | | | | +- ID[@CanonicalImage = "SA", @Image = "sa"] + | | | | +- Column[@CanonicalImage = "SID", @Image = "sid"] + | | | | +- ID[@CanonicalImage = "SID", @Image = "sid"] + | | | +- InnerCrossJoinClause[@CanonicalImage = null, @Cross = false, @Natural = false] + | | | +- TableReference[@CanonicalImage = null] + | | | | +- TableName[@CanonicalImage = "STUDENT_SCORE", @Image = "STUDENT_SCORE"] + | | | | | +- ID[@CanonicalImage = "STUDENT_SCORE", @Image = "STUDENT_SCORE"] + | | | | +- TableAlias[@CanonicalImage = "SS", @Image = "ss"] + | | | | +- ID[@CanonicalImage = "SS", @Image = "ss"] + | | | +- EqualityExpression[@CanonicalImage = "SI.SID = SP.SID", @Image = "si.sid = sp.sid"] + | | | +- PrimaryPrefix[@CanonicalImage = "SI.SID", @Image = "si.sid", @SelfModifier = false] + | | | | +- SimpleExpression[@CanonicalImage = "SI.SID", @Image = "si.sid"] + | | | | +- TableName[@CanonicalImage = "SI", @Image = "si"] + | | | | | +- ID[@CanonicalImage = "SI", @Image = "si"] + | | | | +- Column[@CanonicalImage = "SID", @Image = "sid"] + | | | | +- ID[@CanonicalImage = "SID", @Image = "sid"] + | | | +- PrimaryPrefix[@CanonicalImage = "SP.SID", @Image = "sp.sid", @SelfModifier = false] + | | | +- SimpleExpression[@CanonicalImage = "SP.SID", @Image = "sp.sid"] + | | | +- TableName[@CanonicalImage = "SP", @Image = "sp"] + | | | | +- ID[@CanonicalImage = "SP", @Image = "sp"] + | | | +- Column[@CanonicalImage = "SID", @Image = "sid"] + | | | +- ID[@CanonicalImage = "SID", @Image = "sid"] + | | +- InnerCrossJoinClause[@CanonicalImage = null, @Cross = false, @Natural = false] + | | +- TableReference[@CanonicalImage = null] + | | | +- TableName[@CanonicalImage = "STUDENT_PARENT", @Image = "STUDENT_PARENT"] + | | | | +- ID[@CanonicalImage = "STUDENT_PARENT", @Image = "STUDENT_PARENT"] + | | | +- TableAlias[@CanonicalImage = "SP", @Image = "sp"] + | | | +- ID[@CanonicalImage = "SP", @Image = "sp"] + | | +- EqualityExpression[@CanonicalImage = "SI.SID = SP.SID", @Image = "si.sid = sp.sid"] + | | +- PrimaryPrefix[@CanonicalImage = "SI.SID", @Image = "si.sid", @SelfModifier = false] + | | | +- SimpleExpression[@CanonicalImage = "SI.SID", @Image = "si.sid"] + | | | +- TableName[@CanonicalImage = "SI", @Image = "si"] + | | | | +- ID[@CanonicalImage = "SI", @Image = "si"] + | | | +- Column[@CanonicalImage = "SID", @Image = "sid"] + | | | +- ID[@CanonicalImage = "SID", @Image = "sid"] + | | +- PrimaryPrefix[@CanonicalImage = "SP.SID", @Image = "sp.sid", @SelfModifier = false] + | | +- SimpleExpression[@CanonicalImage = "SP.SID", @Image = "sp.sid"] + | | +- TableName[@CanonicalImage = "SP", @Image = "sp"] + | | | +- ID[@CanonicalImage = "SP", @Image = "sp"] + | | +- Column[@CanonicalImage = "SID", @Image = "sid"] + | | +- ID[@CanonicalImage = "SID", @Image = "sid"] + | +- WhereClause[@CanonicalImage = null] + | +- Condition[@CanonicalImage = null] + | +- CompoundCondition[@CanonicalImage = null, @Type = null] + | +- ComparisonCondition[@CanonicalImage = null, @Operator = "="] + | +- SqlExpression[@CanonicalImage = "SI.SID", @Image = "si.sid"] + | | +- PrimaryPrefix[@CanonicalImage = "SI.SID", @Image = "si.sid", @SelfModifier = false] + | | +- SimpleExpression[@CanonicalImage = "SI.SID", @Image = "si.sid"] + | | +- TableName[@CanonicalImage = "SI", @Image = "si"] + | | | +- ID[@CanonicalImage = "SI", @Image = "si"] + | | +- Column[@CanonicalImage = "SID", @Image = "sid"] + | | +- ID[@CanonicalImage = "SID", @Image = "sid"] + | +- SqlExpression[@CanonicalImage = "'114514'", @Image = "'114514'"] + | +- PrimaryPrefix[@CanonicalImage = "'114514'", @Image = "'114514'", @SelfModifier = false] + | +- Literal[@CanonicalImage = "'114514'", @Image = "'114514'"] + | +- StringLiteral[@CanonicalImage = "'114514'", @Image = "'114514'", @String = "114514"] + +- ID[@CanonicalImage = "EXAMPLE_PROCEDURE", @Image = "EXAMPLE_PROCEDURE"]