Make Antlr token manager throw TokenMgrError directly
This commit is contained in:
@ -7,7 +7,7 @@ package net.sourceforge.pmd.cpd;
|
||||
import org.antlr.v4.runtime.CharStream;
|
||||
|
||||
import net.sourceforge.pmd.cpd.internal.AntlrTokenizer;
|
||||
import net.sourceforge.pmd.cpd.token.AntlrToken;
|
||||
import net.sourceforge.pmd.lang.ast.impl.antlr4.AntlrToken;
|
||||
import net.sourceforge.pmd.cpd.token.AntlrTokenFilter;
|
||||
import net.sourceforge.pmd.lang.ast.impl.antlr4.AntlrTokenManager;
|
||||
import net.sourceforge.pmd.lang.dart.antlr4.Dart2Lexer;
|
||||
@ -53,7 +53,7 @@ public class DartTokenizer extends AntlrTokenizer {
|
||||
}
|
||||
|
||||
private void skipLibraryAndImport(final AntlrToken currentToken) {
|
||||
final int type = currentToken.getType();
|
||||
final int type = currentToken.getKind();
|
||||
if (type == Dart2Lexer.LIBRARY || type == Dart2Lexer.IMPORT) {
|
||||
discardingLibraryAndImport = true;
|
||||
} else if (discardingLibraryAndImport && (type == Dart2Lexer.SEMICOLON || type == Dart2Lexer.NEWLINE)) {
|
||||
@ -62,11 +62,11 @@ public class DartTokenizer extends AntlrTokenizer {
|
||||
}
|
||||
|
||||
private void skipNewLines(final AntlrToken currentToken) {
|
||||
discardingNL = currentToken.getType() == Dart2Lexer.NEWLINE;
|
||||
discardingNL = currentToken.getKind() == Dart2Lexer.NEWLINE;
|
||||
}
|
||||
|
||||
private void skipSemicolons(final AntlrToken currentToken) {
|
||||
discardingSemicolon = currentToken.getType() == Dart2Lexer.SEMICOLON;
|
||||
discardingSemicolon = currentToken.getKind() == Dart2Lexer.SEMICOLON;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user