diff --git a/pmd-plsql/src/main/java/net/sourceforge/pmd/lang/plsql/cpd/PLSQLCpdLexer.java b/pmd-plsql/src/main/java/net/sourceforge/pmd/lang/plsql/cpd/PLSQLCpdLexer.java index 869c254f51..317e27253d 100644 --- a/pmd-plsql/src/main/java/net/sourceforge/pmd/lang/plsql/cpd/PLSQLCpdLexer.java +++ b/pmd-plsql/src/main/java/net/sourceforge/pmd/lang/plsql/cpd/PLSQLCpdLexer.java @@ -47,7 +47,7 @@ public class PLSQLCpdLexer extends JavaccCpdLexer { || plsqlToken.kind == PLSQLTokenKinds.STRING_LITERAL || plsqlToken.kind == PLSQLTokenKinds.QUOTED_LITERAL)) { // the token kind is preserved - image = String.valueOf(plsqlToken.kind); + image = PLSQLTokenKinds.describe(plsqlToken.kind); } else if (plsqlToken.kind != PLSQLTokenKinds.CHARACTER_LITERAL && plsqlToken.kind != PLSQLTokenKinds.STRING_LITERAL && plsqlToken.kind != PLSQLTokenKinds.QUOTED_LITERAL) { diff --git a/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/cpd/testdata/sample-plsql_ignore-literals.txt b/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/cpd/testdata/sample-plsql_ignore-literals.txt index 54617f4103..bae01a69f5 100644 --- a/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/cpd/testdata/sample-plsql_ignore-literals.txt +++ b/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/cpd/testdata/sample-plsql_ignore-literals.txt @@ -16,7 +16,7 @@ L19 [NUMBER] 14 20 [:] 21 22 [=] 22 23 - [472] 24 30 + [] 24 30 [;] 30 31 L20 [C] 1 2 @@ -24,7 +24,7 @@ L20 [NUMBER] 14 20 [:] 21 22 [=] 22 23 - [472] 24 29 + [] 24 29 [;] 29 30 L21 [D] 1 2 @@ -32,7 +32,7 @@ L21 [NUMBER] 14 20 [:] 21 22 [=] 22 23 - [472] 24 29 + [] 24 29 [;] 29 30 L22 [YEAR_CREATED] 1 13 @@ -40,18 +40,18 @@ L22 [NUMBER] 23 29 [:] 30 31 [=] 31 32 - [472] 33 37 + [] 33 37 [;] 37 38 L23 [AUTHOR] 1 7 [CONSTANT] 9 17 [VARCHAR2] 18 26 [(] 26 27 - [472] 27 30 + [] 27 30 [)] 30 31 [:] 32 33 [=] 33 34 - [496] 35 58 + ["\\'"] 35 58 [;] 58 59 L24 [DATE_CREATED] 1 13 @@ -59,7 +59,7 @@ L24 [DATE] 24 28 [:] 29 30 [=] 30 31 - [496] 32 43 + ["\\'"] 32 43 [;] 43 44 L29 [TYPE] 1 5 @@ -72,7 +72,7 @@ L29 [BY] 43 45 [VARCHAR2] 46 54 [(] 54 55 - [472] 55 57 + [] 55 57 [)] 57 58 [;] 58 59 L34 @@ -85,77 +85,77 @@ L35 [ID] 3 5 [VARCHAR2] 30 38 [(] 38 39 - [472] 39 41 + [] 39 41 [)] 41 42 [,] 42 43 L36 [NAME] 3 7 [VARCHAR2] 30 38 [(] 38 39 - [472] 39 42 + [] 39 42 [)] 42 43 [,] 43 44 L37 [ADDRESS] 3 10 [VARCHAR2] 30 38 [(] 38 39 - [472] 39 42 + [] 39 42 [)] 42 43 [,] 43 44 L38 [LOCATION] 3 11 [VARCHAR2] 30 38 [(] 38 39 - [472] 39 41 + [] 39 41 [)] 41 42 [,] 42 43 L39 [BIC] 3 6 [VARCHAR2] 30 38 [(] 38 39 - [472] 39 41 + [] 39 41 [)] 41 42 [,] 42 43 L40 [AUTH_KEY] 3 11 [VARCHAR2] 30 38 [(] 38 39 - [472] 39 40 + [] 39 40 [)] 40 41 [,] 41 42 L41 [CONTACT] 3 10 [VARCHAR2] 30 38 [(] 38 39 - [472] 39 42 + [] 39 42 [)] 42 43 [,] 43 44 L42 [PHONE] 3 8 [VARCHAR2] 30 38 [(] 38 39 - [472] 39 41 + [] 39 41 [)] 41 42 [,] 42 43 L43 [FAX] 3 6 [VARCHAR2] 30 38 [(] 38 39 - [472] 39 41 + [] 39 41 [)] 41 42 [,] 42 43 L44 [TELEX] 3 8 [VARCHAR2] 30 38 [(] 38 39 - [472] 39 42 + [] 39 42 [)] 42 43 [,] 43 44 L45 [MEDIUM] 3 9 [VARCHAR2] 30 38 [(] 38 39 - [472] 39 42 + [] 39 42 [)] 42 43 [,] 43 44 L46 @@ -166,21 +166,21 @@ L47 [APP_USER] 3 11 [VARCHAR2] 30 38 [(] 38 39 - [472] 39 41 + [] 39 41 [)] 41 42 [,] 42 43 L48 [DB_USER] 3 10 [VARCHAR2] 30 38 [(] 38 39 - [472] 39 41 + [] 39 41 [)] 41 42 [,] 42 43 L49 [CUSTOMER_ID] 3 14 [VARCHAR2] 30 38 [(] 38 39 - [472] 39 41 + [] 39 41 [)] 41 42 L50 [)] 1 2 @@ -218,31 +218,31 @@ L66 [NUMBER] 12 18 [:] 19 20 [=] 20 21 - [472] 22 28 + [] 22 28 [;] 28 29 L67 [CURRENT_YEAR] 1 13 [NUMBER] 14 20 [:] 21 22 [=] 22 23 - [472] 24 28 + [] 24 28 [;] 28 29 L68 [CURRENT_AUTHOR] 1 15 [VARCHAR2] 16 24 [(] 24 25 - [472] 25 28 + [] 25 28 [)] 28 29 [:] 30 31 [=] 31 32 - [496] 33 62 + ["\\'"] 33 62 [;] 62 63 L69 [CURRENT_DATE] 1 13 [DATE] 15 19 [:] 20 21 [=] 21 22 - [496] 23 34 + ["\\'"] 23 34 [;] 34 35 L72 [CURSOR] 1 7 @@ -289,7 +289,7 @@ L73 [WHERE] 80 85 [ID] 86 88 [=] 89 90 - [476] 91 94 + [] 91 94 [;] 94 95 L86 [FUNCTION] 1 9 @@ -1171,91 +1171,91 @@ L461 [ID] 3 5 [VARCHAR2] 29 37 [(] 37 38 - [472] 38 40 + [] 38 40 [)] 40 41 [,] 41 42 L462 [NAME] 3 7 [VARCHAR2] 29 37 [(] 37 38 - [472] 38 41 + [] 38 41 [)] 41 42 [,] 42 43 L463 [SHORT_NAME] 3 13 [VARCHAR2] 29 37 [(] 37 38 - [472] 38 40 + [] 38 40 [)] 40 41 [,] 41 42 L464 [DB_ID] 3 8 [VARCHAR2] 29 37 [(] 37 38 - [472] 38 40 + [] 38 40 [)] 40 41 [,] 41 42 L465 [SUB_CUST_CODE] 3 16 [VARCHAR2] 29 37 [(] 37 38 - [472] 38 40 + [] 38 40 [)] 40 41 [,] 41 42 L466 [SUB_ACCOUNT] 3 14 [VARCHAR2] 29 37 [(] 37 38 - [472] 38 40 + [] 38 40 [)] 40 41 [,] 41 42 L467 [REGNO] 3 8 [VARCHAR2] 29 37 [(] 37 38 - [472] 38 40 + [] 38 40 [)] 40 41 [,] 41 42 L468 [RESIDENCE] 3 12 [VARCHAR2] 29 37 [(] 37 38 - [472] 38 40 + [] 38 40 [)] 40 41 [,] 41 42 L469 [CT_TYPE] 3 10 [VARCHAR2] 29 37 [(] 37 38 - [472] 38 40 + [] 38 40 [)] 40 41 [,] 41 42 L470 [CT_ENTITY] 3 12 [VARCHAR2] 29 37 [(] 37 38 - [472] 38 40 + [] 38 40 [)] 40 41 [,] 41 42 L471 [LANGUAGE] 3 11 [VARCHAR2] 29 37 [(] 37 38 - [472] 38 40 + [] 38 40 [)] 40 41 [,] 41 42 L472 [BUSINESS_TYPE] 3 16 [VARCHAR2] 29 37 [(] 37 38 - [472] 38 40 + [] 38 40 [)] 40 41 [,] 41 42 L473 [TAX_CODE] 3 11 [VARCHAR2] 29 37 [(] 37 38 - [472] 38 40 + [] 38 40 [)] 40 41 L474 [)] 1 2 @@ -1497,11 +1497,11 @@ L562 [CONSTANT] 12 20 [VARCHAR2] 21 29 [(] 29 30 - [472] 30 33 + [] 30 33 [)] 33 34 [:] 35 36 [=] 36 37 - [496] 38 61 + ["\\'"] 38 61 [;] 61 62 L563 [TYPE] 1 5 @@ -1511,7 +1511,7 @@ L563 [OF] 28 30 [VARCHAR2] 31 39 [(] 39 40 - [472] 40 45 + [] 40 45 [)] 45 46 [INDEX] 47 52 [BY] 53 55 @@ -1716,11 +1716,11 @@ L622 [SYSDATE] 69 76 [)] 76 77 [,] 77 78 - [472] 78 79 + [] 78 79 [)] 79 80 [)] 80 81 [+] 81 82 - [472] 82 83 + [] 82 83 [)] 83 84 [;] 84 85 L624