Delete old CPD Language interface

reorganize cpd modules
This commit is contained in:
Clément Fournier
2023-02-12 17:32:56 +01:00
parent 8fbd830daa
commit fb9f49624d
87 changed files with 402 additions and 476 deletions

View File

@ -1,19 +0,0 @@
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.cpd;
/**
* Defines the Language module for Python
*/
public class PythonLanguage extends AbstractLanguage {
/**
* Creates a new instance of {@link PythonLanguage} with the default
* extensions for python files.
*/
public PythonLanguage() {
super("Python", "python", new PythonTokenizer(), ".py");
}
}

View File

@ -0,0 +1,25 @@
/*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.python;
import net.sourceforge.pmd.lang.python.cpd.PythonTokenizer;
import net.sourceforge.pmd.cpd.Tokenizer;
import net.sourceforge.pmd.lang.CpdOnlyLanguageModuleBase;
import net.sourceforge.pmd.lang.LanguagePropertyBundle;
/**
* Defines the Language module for Python
*/
public class PythonLanguageModule extends CpdOnlyLanguageModuleBase {
public PythonLanguageModule() {
super(LanguageMetadata.withId("python").name("Python").extensions("py"));
}
@Override
public Tokenizer createCpdTokenizer(LanguagePropertyBundle bundle) {
return new PythonTokenizer();
}
}

View File

@ -1,8 +1,8 @@
/**
/*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.cpd;
package net.sourceforge.pmd.lang.python.cpd;
import java.util.regex.Pattern;

View File

@ -1 +0,0 @@
net.sourceforge.pmd.cpd.PythonLanguage

View File

@ -0,0 +1 @@
net.sourceforge.pmd.lang.python.PythonLanguageModule

View File

@ -1,8 +1,8 @@
/**
/*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.cpd;
package net.sourceforge.pmd.lang.python.cpd;
import org.junit.jupiter.api.Test;
@ -11,15 +11,9 @@ import net.sourceforge.pmd.cpd.test.CpdTextComparisonTest;
class PythonTokenizerTest extends CpdTextComparisonTest {
PythonTokenizerTest() {
super(".py");
super("python", ".py");
}
@Override
protected String getResourcePrefix() {
return "../lang/python/cpd/testdata";
}
@Test
void sampleTest() {
doTest("sample_python");