forked from phoedos/pmd
[typescript] Update lexer for PMD 7
This commit is contained in:
parent
490e019307
commit
e4b9c30323
@ -5,17 +5,14 @@
|
||||
package net.sourceforge.pmd.lang.typescript.cpd;
|
||||
|
||||
import org.antlr.v4.runtime.CharStream;
|
||||
import org.antlr.v4.runtime.Lexer;
|
||||
|
||||
import net.sourceforge.pmd.cpd.AntlrTokenizer;
|
||||
import net.sourceforge.pmd.cpd.SourceCode;
|
||||
import net.sourceforge.pmd.lang.antlr.AntlrTokenManager;
|
||||
import net.sourceforge.pmd.cpd.internal.AntlrTokenizer;
|
||||
import net.sourceforge.pmd.lang.typescript.ast.TypeScriptLexer;
|
||||
|
||||
public class TypescriptTokenizer extends AntlrTokenizer {
|
||||
|
||||
@Override
|
||||
protected AntlrTokenManager getLexerForSource(SourceCode sourceCode) {
|
||||
CharStream charStream = AntlrTokenizer.getCharStreamFromSourceCode(sourceCode);
|
||||
return new AntlrTokenManager(new TypeScriptLexer(charStream), sourceCode.getFileName());
|
||||
protected Lexer getLexerForSource(CharStream charStream) {
|
||||
return new TypeScriptLexer(charStream);
|
||||
}
|
||||
}
|
||||
|
@ -6,14 +6,14 @@ package net.sourceforge.pmd.lang.typescript.cpd;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import net.sourceforge.pmd.cpd.Tokenizer;
|
||||
import net.sourceforge.pmd.cpd.test.CpdTextComparisonTest;
|
||||
|
||||
public class TypescriptTokenizerTest extends CpdTextComparisonTest {
|
||||
class TypescriptTokenizerTest extends CpdTextComparisonTest {
|
||||
|
||||
public TypescriptTokenizerTest() {
|
||||
TypescriptTokenizerTest() {
|
||||
super(".ts");
|
||||
}
|
||||
|
||||
@ -28,12 +28,12 @@ public class TypescriptTokenizerTest extends CpdTextComparisonTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void greeterTest() {
|
||||
void greeterTest() {
|
||||
doTest("greeter");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void apiSampleWatchTest() {
|
||||
void apiSampleWatchTest() {
|
||||
doTest("APISample_Watch");
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,35 +1,35 @@
|
||||
[Image] or [Truncated image[ Bcol Ecol
|
||||
L3
|
||||
[function] 1 8
|
||||
[greeter] 10 16
|
||||
[(] 17 17
|
||||
[person] 18 23
|
||||
[)] 24 24
|
||||
[{] 26 26
|
||||
[function] 1 9
|
||||
[greeter] 10 17
|
||||
[(] 17 18
|
||||
[person] 18 24
|
||||
[)] 24 25
|
||||
[{] 26 27
|
||||
L4
|
||||
[return] 3 8
|
||||
["Hello, "] 10 18
|
||||
[+] 20 20
|
||||
[person] 22 27
|
||||
[;] 28 28
|
||||
[return] 3 9
|
||||
["Hello, "] 10 19
|
||||
[+] 20 21
|
||||
[person] 22 28
|
||||
[;] 28 29
|
||||
L5
|
||||
[}] 1 1
|
||||
[}] 1 2
|
||||
L7
|
||||
[let] 1 3
|
||||
[user] 5 8
|
||||
[=] 10 10
|
||||
["Jane User"] 12 22
|
||||
[;] 23 23
|
||||
[let] 1 4
|
||||
[user] 5 9
|
||||
[=] 10 11
|
||||
["Jane User"] 12 23
|
||||
[;] 23 24
|
||||
L9
|
||||
[document] 1 8
|
||||
[.] 9 9
|
||||
[body] 10 13
|
||||
[.] 14 14
|
||||
[textContent] 15 25
|
||||
[=] 27 27
|
||||
[greeter] 29 35
|
||||
[(] 36 36
|
||||
[user] 37 40
|
||||
[)] 41 41
|
||||
[;] 42 42
|
||||
[document] 1 9
|
||||
[.] 9 10
|
||||
[body] 10 14
|
||||
[.] 14 15
|
||||
[textContent] 15 26
|
||||
[=] 27 28
|
||||
[greeter] 29 36
|
||||
[(] 36 37
|
||||
[user] 37 41
|
||||
[)] 41 42
|
||||
[;] 42 43
|
||||
EOF
|
||||
|
Loading…
x
Reference in New Issue
Block a user