diff --git a/pmd-jsp/src/test/resources/net/sourceforge/pmd/lang/jsp/cpd/testdata/scriptletWithString.txt b/pmd-jsp/src/test/resources/net/sourceforge/pmd/lang/jsp/cpd/testdata/scriptletWithString.txt index a27643e225..cfd9afafa6 100644 --- a/pmd-jsp/src/test/resources/net/sourceforge/pmd/lang/jsp/cpd/testdata/scriptletWithString.txt +++ b/pmd-jsp/src/test/resources/net/sourceforge/pmd/lang/jsp/cpd/testdata/scriptletWithString.txt @@ -1,17 +1,17 @@ [Image] or [Truncated image[ Bcol Ecol L1 [<%--] 1 5 - [\nBSD-style license; for more info[ 5 1 + [\nBSD-style license; for more info[ 5 78 L3 [--%>] 1 5 L5 [<%] 1 3 - [\nString nodeContent = "<% %>";\n] 3 1 + [\nString nodeContent = "<% %>";\n] 3 31 L7 [%>] 1 3 L8 [<%] 1 3 - [\n] 1 3 EOF diff --git a/pmd-plsql/etc/grammar/PLSQL.jjt b/pmd-plsql/etc/grammar/PLSQL.jjt index 98a0b9389c..10e7ed7065 100644 --- a/pmd-plsql/etc/grammar/PLSQL.jjt +++ b/pmd-plsql/etc/grammar/PLSQL.jjt @@ -160,6 +160,7 @@ import net.sourceforge.pmd.lang.ast.Node; import net.sourceforge.pmd.lang.ast.impl.javacc.CharStream; import net.sourceforge.pmd.lang.ast.TokenMgrError; import net.sourceforge.pmd.lang.plsql.ast.internal.ParsingExclusion; +import net.sourceforge.pmd.util.document.Chars; public class PLSQLParserImpl { @@ -3472,7 +3473,7 @@ ASTPrimarySuffix PrimarySuffix() : ) ) | - ( arguments = Arguments() ) {sb.append(arguments) ; } + ( arguments = Arguments() ) {sb.append("Arguments") ; } // was broken before... ) { jjtThis.setImage(sb.toString()); return jjtThis; @@ -5234,6 +5235,7 @@ TOKEN : MORE : { <~["'"]> | <"'"> { + Chars image = input_stream.getTokenImageCs(); int quoteDelimiter = image.charAt(2); if (image.charAt(0) == 'n' || image.charAt(0) == 'N') { quoteDelimiter = image.charAt(3); @@ -5241,7 +5243,6 @@ TOKEN : int beforeQuote = image.charAt(image.length() - 2); if (quoteDelimiter == beforeQuote) { input_stream.backup(1); - image.setLength(image.length() - 1); SwitchTo(IN_STRING_LITERAL_TOKENIZE); } } diff --git a/pmd-plsql/src/main/java/net/sourceforge/pmd/cpd/PLSQLTokenizer.java b/pmd-plsql/src/main/java/net/sourceforge/pmd/cpd/PLSQLTokenizer.java index 32dbbf94c5..77abbf8794 100644 --- a/pmd-plsql/src/main/java/net/sourceforge/pmd/cpd/PLSQLTokenizer.java +++ b/pmd-plsql/src/main/java/net/sourceforge/pmd/cpd/PLSQLTokenizer.java @@ -8,8 +8,8 @@ import java.util.Properties; import net.sourceforge.pmd.cpd.internal.JavaCCTokenizer; import net.sourceforge.pmd.lang.TokenManager; -import net.sourceforge.pmd.lang.ast.impl.javacc.JavaccToken; import net.sourceforge.pmd.lang.ast.impl.javacc.CharStream; +import net.sourceforge.pmd.lang.ast.impl.javacc.JavaccToken; import net.sourceforge.pmd.lang.plsql.ast.PLSQLTokenKinds; public class PLSQLTokenizer extends JavaCCTokenizer { diff --git a/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/ParsingExclusion.txt b/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/ParsingExclusion.txt index 2bf8e5d5b6..396f9304a5 100644 --- a/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/ParsingExclusion.txt +++ b/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/ParsingExclusion.txt @@ -1,4 +1,4 @@ -+- Input[@CanonicalImage = null, @ExcludedLinesCount = "6", @ExcludedRangesCount = "2", @Sourcecode = "begin\n do_something();\n -- pmd-exclude-begin: PMD does not like dbms_lob.trim (clash with TrimExpression)\n dbms_lob.trim(the_blob, 1000);\n -- pmd-exclude-end\n do_something_else(x);\nend;\n/\n\nselect dummy from dual a\nwhere 1=1\n -- pmd-exclude-begin: PMD does not like scalar subqueries in WHERE conditions\n and \'J\' = (select max(\'J\') from dual b)\n -- pmd-exclude-end\n;\n"] ++- Input[@CanonicalImage = null, @ExcludedLinesCount = "6", @ExcludedRangesCount = "2"] +- Global[@CanonicalImage = null] | +- Block[@CanonicalImage = null] | +- Statement[@CanonicalImage = null] diff --git a/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/SqlPlusLexicalVariablesIssue195.txt b/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/SqlPlusLexicalVariablesIssue195.txt index f655a96709..efec9a5183 100644 --- a/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/SqlPlusLexicalVariablesIssue195.txt +++ b/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/SqlPlusLexicalVariablesIssue195.txt @@ -1,3 +1,3 @@ -+- Input[@CanonicalImage = null, @ExcludedLinesCount = "0", @ExcludedRangesCount = "0", @Sourcecode = "\n-- see https://github.com/pmd/pmd/issues/195\n-- both define and spool are SQL*Plus commands, and they should not be ended with a semi-colon.\n\ndefine patch_name = acme_module\nspool &patch_name..log\n"] ++- Input[@CanonicalImage = null, @ExcludedLinesCount = "0", @ExcludedRangesCount = "0"] +- SqlPlusCommand[@CanonicalImage = "DEFINE PATCH_NAME = ACME_MODULE", @Image = "define patch_name = acme_module "] +- SqlPlusCommand[@CanonicalImage = "SPOOL &PATCH_NAME. . LOG", @Image = "spool &patch_name. . log "]