forked from phoedos/pmd
Make Antlr token manager throw TokenMgrError directly
This commit is contained in:
@ -9,7 +9,7 @@ import java.util.Properties;
|
||||
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.cs.antlr4.CSharpLexer;
|
||||
@ -79,7 +79,7 @@ public class CsTokenizer extends AntlrTokenizer {
|
||||
|
||||
private void skipUsingDirectives(final AntlrToken currentToken, final Iterable<AntlrToken> remainingTokens) {
|
||||
if (ignoreUsings) {
|
||||
final int type = currentToken.getType();
|
||||
final int type = currentToken.getKind();
|
||||
if (type == CSharpLexer.USING && isUsingDirective(remainingTokens)) {
|
||||
discardingUsings = true;
|
||||
} else if (type == CSharpLexer.SEMICOLON && discardingUsings) {
|
||||
@ -92,7 +92,7 @@ public class CsTokenizer extends AntlrTokenizer {
|
||||
private boolean isUsingDirective(final Iterable<AntlrToken> remainingTokens) {
|
||||
UsingState usingState = UsingState.KEYWORD;
|
||||
for (final AntlrToken token : remainingTokens) {
|
||||
final int type = token.getType();
|
||||
final int type = token.getKind();
|
||||
if (usingState == UsingState.KEYWORD) {
|
||||
// The previous token was a using keyword.
|
||||
switch (type) {
|
||||
@ -148,7 +148,7 @@ public class CsTokenizer extends AntlrTokenizer {
|
||||
}
|
||||
|
||||
private void skipNewLines(final AntlrToken currentToken) {
|
||||
discardingNL = currentToken.getType() == CSharpLexer.NL;
|
||||
discardingNL = currentToken.getKind() == CSharpLexer.NL;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user