Cleanup and encapsulation in LexerATNSimulator

This commit is contained in:
Sam Harwell 2013-04-24 10:33:34 -05:00
parent 25676332fb
commit ef8b10ebc4
1 changed files with 4 additions and 6 deletions

View File

@ -41,7 +41,6 @@ import org.antlr.v4.runtime.misc.Interval;
import org.antlr.v4.runtime.misc.NotNull; import org.antlr.v4.runtime.misc.NotNull;
import org.antlr.v4.runtime.misc.Nullable; import org.antlr.v4.runtime.misc.Nullable;
import java.io.OutputStream;
import java.util.Locale; import java.util.Locale;
/** "dup" of ParserInterpreter */ /** "dup" of ParserInterpreter */
@ -158,7 +157,6 @@ public class LexerATNSimulator extends ATNSimulator {
mode = Lexer.DEFAULT_MODE; mode = Lexer.DEFAULT_MODE;
} }
// only called from test code from outside
protected int matchATN(@NotNull CharStream input) { protected int matchATN(@NotNull CharStream input) {
ATNState startState = atn.modeToStartState.get(mode); ATNState startState = atn.modeToStartState.get(mode);
@ -341,7 +339,7 @@ public class LexerATNSimulator extends ATNSimulator {
} }
@Nullable @Nullable
public ATNState getReachableTarget(Transition trans, int t) { protected ATNState getReachableTarget(Transition trans, int t) {
if (trans.matches(t, Lexer.MIN_CHAR_VALUE, Lexer.MAX_CHAR_VALUE)) { if (trans.matches(t, Lexer.MIN_CHAR_VALUE, Lexer.MAX_CHAR_VALUE)) {
return trans.target; return trans.target;
} }
@ -444,7 +442,7 @@ public class LexerATNSimulator extends ATNSimulator {
// side-effect: can alter configs.hasSemanticContext // side-effect: can alter configs.hasSemanticContext
@Nullable @Nullable
public LexerATNConfig getEpsilonTarget(@NotNull CharStream input, protected LexerATNConfig getEpsilonTarget(@NotNull CharStream input,
@NotNull LexerATNConfig config, @NotNull LexerATNConfig config,
@NotNull Transition t, @NotNull Transition t,
@NotNull ATNConfigSet configs, @NotNull ATNConfigSet configs,
@ -650,8 +648,8 @@ public class LexerATNSimulator extends ATNSimulator {
} }
} }
@Nullable @NotNull
public DFA getDFA(int mode) { public final DFA getDFA(int mode) {
return decisionToDFA[mode]; return decisionToDFA[mode];
} }