after experimenting with m, r

[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 6754]
This commit is contained in:
parrt 2010-03-15 15:23:39 -08:00
parent e70287954a
commit c967b39f44
3 changed files with 4 additions and 11 deletions

View File

@ -149,11 +149,6 @@ public class RecursionLimitedNFAToDFAConverter extends StackLimitedNFAToDFAConve
@Override
void reach(DFAState d) {
super.reach(d);
// // Check to see if we need to add any semantic predicate transitions
// if ( d.isResolvedWithPredicates() ) {
// addPredicateTransitions(d);
// }
}
/**
@ -192,7 +187,6 @@ public class RecursionLimitedNFAToDFAConverter extends StackLimitedNFAToDFAConve
}
}
// TODO: make sure to deal with sempreds in exact DFA
/** 1. Traverse an edge that takes us to the start state of another
* rule, r. We must push this state so that if the DFA
* conversion hits the end of rule r, then it knows to continue
@ -228,6 +222,7 @@ public class RecursionLimitedNFAToDFAConverter extends StackLimitedNFAToDFAConve
// if this context has hit the max recursions for p.stateNumber,
// don't allow it to enter p.stateNumber again
if ( depth >= r ) {
throw new RuntimeException("recursion overflow in "+altNum);
}
// first create a new context and push onto call tree,
// recording the fact that we are invoking a rule and

View File

@ -116,6 +116,7 @@ public class Resolver {
ctxConflict = s.context.conflictsWith(t.context);
}
if ( altConflict && ctxConflict ) {
//System.out.println("ctx conflict between "+s+" and "+t);
ambiguousAlts.add(s.alt);
ambiguousAlts.add(t.alt);
}

View File

@ -54,9 +54,6 @@ public class StackLimitedNFAToDFAConverter {
/** The set of states w/o emanating edges (and w/o resolving sem preds). */
public Set<DFAState> danglingStates = new HashSet<DFAState>();
/** If non-reduced, this is set of states that don't lead to accept state */
public Set<DFAState> deadStates;
/** Was a syntactic ambiguity resolved with predicates? Any DFA
* state that predicts more than one alternative, must be resolved
* with predicates or it should be reported to the user.
@ -268,7 +265,7 @@ public class StackLimitedNFAToDFAConverter {
if ( debug ) {
System.out.println("after closure("+d+")");
}
// System.out.println("after closure d="+d);
//System.out.println("after closure d="+d);
}
/** Where can we get from NFA state s traversing only epsilon transitions?
@ -571,6 +568,7 @@ public class StackLimitedNFAToDFAConverter {
return unreachable;
}
// TODO: where does this belong?
void issueAmbiguityWarnings() {
MachineProbe probe = new MachineProbe(dfa);
@ -603,5 +601,4 @@ public class StackLimitedNFAToDFAConverter {
}
if ( unreachableAlts.size()>0 ) System.out.println("unreachable="+unreachableAlts);
}
}