How to add a new language to CPD

If you wish CPD to parse a unsupported language, you can easily develop a new parser for CPD. All you need to is implements the following interface:

  1. net.sourceforge.pmd.cpd.Language
  2. net.sourceforge.pmd.cpd.Tokenizer
Do not forget to the follow the proper naming convention, as the CPD parser factory use this convention:
  • Language Name + "Language"
  • Tokenizer Name + "Tokenizer"
For instance, if you develop a python parser, you should have two classes named PythonLanguage and PythonTokenizer.

To test your parser, just package it in a jar and add your jar to the classpath.