Rename NUM_EDGES to MAX_DFA_EDGE, reduce max value to 127

This commit is contained in:
sharwell 2012-02-08 17:15:34 -06:00
parent 2249135c21
commit 71e0c66477
1 changed files with 4 additions and 4 deletions

View File

@ -44,7 +44,7 @@ public class LexerATNSimulator extends ATNSimulator {
public static boolean debug = false; public static boolean debug = false;
public static boolean dfa_debug = false; public static boolean dfa_debug = false;
public static final int NUM_EDGES = 255; // forces unicode to stay in ATN public static final int MAX_DFA_EDGE = 127; // forces unicode to stay in ATN
private boolean trace = false; private boolean trace = false;
private OutputStream traceStream = null; private OutputStream traceStream = null;
@ -574,7 +574,7 @@ public class LexerATNSimulator extends ATNSimulator {
@NotNull ATNConfigSet q) @NotNull ATNConfigSet q)
{ {
// even if we can add the states, we can't add an edge for labels out of range // even if we can add the states, we can't add an edge for labels out of range
if (t < 0 || t > NUM_EDGES) { if (t < 0 || t > MAX_DFA_EDGE) {
return; return;
} }
@ -593,10 +593,10 @@ public class LexerATNSimulator extends ATNSimulator {
} }
protected void addDFAEdge(@NotNull DFAState p, int t, @NotNull DFAState q) { protected void addDFAEdge(@NotNull DFAState p, int t, @NotNull DFAState q) {
if (t < 0 || t > NUM_EDGES) return; // Only track edges within the DFA bounds if (t < 0 || t > MAX_DFA_EDGE) return; // Only track edges within the DFA bounds
if ( p.edges==null ) { if ( p.edges==null ) {
// make room for tokens 1..n and -1 masquerading as index 0 // make room for tokens 1..n and -1 masquerading as index 0
p.edges = new DFAState[NUM_EDGES+1]; // TODO: make adaptive p.edges = new DFAState[MAX_DFA_EDGE+1]; // TODO: make adaptive
} }
// if ( t==Token.EOF ) { // if ( t==Token.EOF ) {
// System.out.println("state "+p+" has EOF edge"); // System.out.println("state "+p+" has EOF edge");