Update TSQL module

This commit is contained in:
Clément Fournier
2023-02-18 17:08:20 +01:00
parent b7a3f800ec
commit 62beb2b5fb
6 changed files with 28 additions and 33 deletions

View File

@ -0,0 +1,25 @@
/*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.tsql;
import net.sourceforge.pmd.cpd.Tokenizer;
import net.sourceforge.pmd.lang.LanguagePropertyBundle;
import net.sourceforge.pmd.lang.impl.CpdOnlyLanguageModuleBase;
import net.sourceforge.pmd.lang.tsql.cpd.TSqlTokenizer;
/**
* @author pguyot@kallisys.net
*/
public class TSqlLanguageModule extends CpdOnlyLanguageModuleBase {
public TSqlLanguageModule() {
super(LanguageMetadata.withId("tsql").name("TSql").extensions("sql"));
}
@Override
public Tokenizer createCpdTokenizer(LanguagePropertyBundle bundle) {
return new TSqlTokenizer();
}
}

View File

@ -1,17 +0,0 @@
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.tsql.cpd;
import net.sourceforge.pmd.cpd.AbstractLanguage;
/**
* @author pguyot@kallisys.net
*/
public class TSqlLanguage extends AbstractLanguage {
public TSqlLanguage() {
super("TSql", "tsql", new TSqlTokenizer(), ".sql");
}
}

View File

@ -7,7 +7,7 @@ package net.sourceforge.pmd.lang.tsql.cpd;
import org.antlr.v4.runtime.CharStream;
import org.antlr.v4.runtime.Lexer;
import net.sourceforge.pmd.cpd.internal.AntlrTokenizer;
import net.sourceforge.pmd.cpd.impl.AntlrTokenizer;
import net.sourceforge.pmd.lang.tsql.ast.TSqlLexer;
public class TSqlTokenizer extends AntlrTokenizer {

View File

@ -1 +0,0 @@
net.sourceforge.pmd.lang.tsql.cpd.TSqlLanguage

View File

@ -0,0 +1 @@
net.sourceforge.pmd.lang.tsql.TSqlLanguageModule

View File

@ -4,27 +4,14 @@
package net.sourceforge.pmd.lang.tsql.cpd;
import java.util.Properties;
import org.junit.jupiter.api.Test;
import net.sourceforge.pmd.cpd.Tokenizer;
import net.sourceforge.pmd.cpd.test.CpdTextComparisonTest;
class TSqlTokenizerTest extends CpdTextComparisonTest {
TSqlTokenizerTest() {
super(".sql");
}
@Override
public Tokenizer newTokenizer(Properties properties) {
return new TSqlTokenizer();
}
@Override
protected String getResourcePrefix() {
return "../cpd/testdata";
super("tsql", ".sql");
}
@Test