You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -45,8 +45,15 @@ Use the following guide to set up a new language module that supports CPD.
45
45
}
46
46
```
47
47
48
+
-If your language is case-insensitive, then you might want to overwrite `getImage(AntlrToken)`.There you can
49
+
change each token e.g. into uppercase, so that CPD sees the same strings and can find duplicates even when
50
+
the casing differs. See {% jdoc tsql::lang.tsql.cpd.TSqlCpdLexer%} for an example. You will also need a
51
+
"CaseChangingCharStream", so that antlr itself is case-insensitive.
48
52
-ForJavaCC grammars, place your grammar in `etc/grammar` and edit the `pom.xml` like the [Python implementation](https://github.com/pmd/pmd/blob/master/pmd-python/pom.xml) does.
49
53
You can then subclass {% jdoc core::cpd.impl.JavaccCpdLexer%} instead of AntlrCpdLexer.
54
+
-If your JavaCC based language is case-insensitive (option `IGNORE_CASE=true`), then you need to implement
55
+
{%jdoc core::lang.ast.impl.javacc.JavaccTokenDocument.TokenDocumentBehavior%}, which can change each token
56
+
e.g. into uppercase. See {%jdoc plsql::lang.plsql.ast.PLSQLParser%} for an example.
50
57
- For any other scenario just implement the interfacehowever you can. Look at the Scala or Apex module for existing implementations.
51
58
52
59
3. Create a {% jdoc core::lang.Language%} implementation, and make it implement {% jdoc core::cpd.CpdCapableLanguage%}.
0 commit comments