Fix plsql build

This commit is contained in:
Clément Fournier
2022-04-02 16:21:38 +02:00
parent 163a9274dc
commit e5453eea28
5 changed files with 12 additions and 4 deletions

View File

@ -90,6 +90,12 @@ public interface TextDocument extends Closeable {
return getText().length();
}
/**
* Returns a text region that corresponds to the entire document.
*/
default TextRegion getEntireRegion() {
return TextRegion.fromOffsetLength(0, getLength());
}
/**
* Returns a region that spans the text of all the given lines.

View File

@ -158,7 +158,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
package net.sourceforge.pmd.lang.plsql.ast;
import java.util.List;
import java.util.ArrayList;
import net.sourceforge.pmd.lang.plsql.ast.internal.ParsingExclusion;
import net.sourceforge.pmd.lang.ast.TokenMgrError;
public class PLSQLParserImpl {
@ -215,7 +217,7 @@ public class PLSQLParserImpl {
private boolean isKeyword(String keyword) {
return getToken(1).kind == IDENTIFIER && getToken(1).getImage().equalsIgnoreCase(keyword);
}
}}
}
PARSER_END(PLSQLParserImpl)

View File

@ -4,11 +4,11 @@
package net.sourceforge.pmd.lang.plsql.rule.codestyle;
import net.sourceforge.pmd.lang.document.Chars;
import net.sourceforge.pmd.lang.plsql.ast.ASTInput;
import net.sourceforge.pmd.lang.plsql.rule.AbstractPLSQLRule;
import net.sourceforge.pmd.properties.PropertyDescriptor;
import net.sourceforge.pmd.properties.PropertyFactory;
import net.sourceforge.pmd.lang.document.Chars;
public class AvoidTabCharacterRule extends AbstractPLSQLRule {

View File

@ -4,12 +4,12 @@
package net.sourceforge.pmd.lang.plsql.rule.codestyle;
import net.sourceforge.pmd.lang.document.Chars;
import net.sourceforge.pmd.lang.plsql.ast.ASTInput;
import net.sourceforge.pmd.lang.plsql.rule.AbstractPLSQLRule;
import net.sourceforge.pmd.properties.PropertyDescriptor;
import net.sourceforge.pmd.properties.PropertyFactory;
import net.sourceforge.pmd.properties.constraints.NumericConstraints;
import net.sourceforge.pmd.lang.document.Chars;
public class LineLengthRule extends AbstractPLSQLRule {

View File

@ -1,4 +1,4 @@
+- Input[@CanonicalImage = null, @ExcludedLinesCount = "0", @ExcludedRangesCount = "0", @Sourcecode = "--\n-- See https://docs.oracle.com/en/database/oracle/oracle-database/18/lnpls/OPEN-FOR-statement.html#GUID-EB7AF439-FDD3-4461-9E3F-B621E8ABFB96\n-- https://github.com/pmd/pmd/issues/3487\n--\n\nCREATE OR REPLACE PROCEDURE EXAMPLE_PROCEDURE IS\n --\n TYPE t_ref_cursor IS REF CURSOR;\n --\n l_ref_cursor t_ref_cursor;\n --\nBEGIN\n --\n OPEN l_ref_cursor FOR\n SELECT *\n FROM DUAL;\n --\nEND EXAMPLE_PROCEDURE;\n\n--\n-- Example 6-26 Fetching Data with Cursor Variables\n-- https://docs.oracle.com/en/database/oracle/oracle-database/18/lnpls/static-sql.html#GUID-AA5A2016-1B76-4961-9AFB-EB052F0D0FB2\n--\nDECLARE\n cv SYS_REFCURSOR; -- cursor variable\n \n v_lastname employees.last_name%TYPE; -- variable for last_name\n v_jobid employees.job_id%TYPE; -- variable for job_id\n \n query_2 VARCHAR2(200) :=\n \'SELECT * FROM employees\n WHERE REGEXP_LIKE (job_id, \'\'[ACADFIMKSA]_M[ANGR]\'\')\n ORDER BY job_id\';\n \n v_employees employees%ROWTYPE; -- record variable row of table\n \nBEGIN\n OPEN cv FOR\n SELECT last_name, job_id FROM employees\n WHERE REGEXP_LIKE (job_id, \'S[HT]_CLERK\')\n ORDER BY last_name;\n \n LOOP -- Fetches 2 columns into variables\n FETCH cv INTO v_lastname, v_jobid;\n EXIT WHEN cv%NOTFOUND;\n DBMS_OUTPUT.PUT_LINE( RPAD(v_lastname, 25, \' \') || v_jobid );\n END LOOP;\n \n DBMS_OUTPUT.PUT_LINE( \'-------------------------------------\' );\n \n OPEN cv FOR query_2;\n \n LOOP -- Fetches entire row into the v_employees record\n FETCH cv INTO v_employees;\n EXIT WHEN cv%NOTFOUND;\n DBMS_OUTPUT.PUT_LINE( RPAD(v_employees.last_name, 25, \' \') ||\n v_employees.job_id );\n END LOOP;\n \n CLOSE cv;\nEND;\n/\n"]
+- Input[@CanonicalImage = null, @ExcludedLinesCount = "0", @ExcludedRangesCount = "0"]
+- Global[@CanonicalImage = null]
| +- ProgramUnit[@CanonicalImage = null, @MethodName = "EXAMPLE_PROCEDURE", @Name = "EXAMPLE_PROCEDURE", @ObjectName = null]
| +- MethodDeclarator[@CanonicalImage = "EXAMPLE_PROCEDURE", @Image = "EXAMPLE_PROCEDURE", @ParameterCount = "1"]