/** Is this DFA cyclic? That is, are there any loops? If not, then * the DFA is essentially an LL(k) predictor for some fixed, max k value. * We can build a series of nested IF statements to match this. In the * presence of cycles, we need to build a general DFA and interpret it * to distinguish between alternatives. */ public boolean isCyclic() { return cyclic && getUserMaxLookahead()==0; }
/** Is this DFA cyclic? That is, are there any loops? If not, then * the DFA is essentially an LL(k) predictor for some fixed, max k value. * We can build a series of nested IF statements to match this. In the * presence of cycles, we need to build a general DFA and interpret it * to distinguish between alternatives. */ public boolean isCyclic() { return cyclic && getUserMaxLookahead()==0; }
/** Is this DFA cyclic? That is, are there any loops? If not, then * the DFA is essentially an LL(k) predictor for some fixed, max k value. * We can build a series of nested IF statements to match this. In the * presence of cycles, we need to build a general DFA and interpret it * to distinguish between alternatives. */ public boolean isCyclic() { return cyclic && getUserMaxLookahead()==0; }
/** Is this DFA cyclic? That is, are there any loops? If not, then * the DFA is essentially an LL(k) predictor for some fixed, max k value. * We can build a series of nested IF statements to match this. In the * presence of cycles, we need to build a general DFA and interpret it * to distinguish between alternatives. */ public boolean isCyclic() { return cyclic && getUserMaxLookahead()==0; }
public int getNumberOfStates() { if ( getUserMaxLookahead()>0 ) { // if using fixed lookahead then uniqueSets not set return states.size(); } return numberOfStates; }
public int getNumberOfStates() { if ( getUserMaxLookahead()>0 ) { // if using fixed lookahead then uniqueSets not set return states.size(); } return numberOfStates; }
public int getNumberOfStates() { if ( getUserMaxLookahead()>0 ) { // if using fixed lookahead then uniqueSets not set return states.size(); } return numberOfStates; }
public int getNumberOfStates() { if ( getUserMaxLookahead()>0 ) { // if using fixed lookahead then uniqueSets not set return states.size(); } return numberOfStates; }
/** Add a new DFA state to this DFA if not already present. * To force an acyclic, fixed maximum depth DFA, just always * return the incoming state. By not reusing old states, * no cycles can be created. If we're doing fixed k lookahead * don't updated uniqueStates, just return incoming state, which * indicates it's a new state. */ protected DFAState addState(DFAState d) { if ( getUserMaxLookahead()>0 ) { return d; } // does a DFA state exist already with everything the same // except its state number? DFAState existing = uniqueStates.get(d); if ( existing != null ) { /* System.out.println("state "+d.stateNumber+" exists as state "+ existing.stateNumber); */ // already there...get the existing DFA state return existing; } // if not there, then add new state. uniqueStates.put(d,d); numberOfStates++; return d; }
/** Add a new DFA state to this DFA if not already present. * To force an acyclic, fixed maximum depth DFA, just always * return the incoming state. By not reusing old states, * no cycles can be created. If we're doing fixed k lookahead * don't updated uniqueStates, just return incoming state, which * indicates it's a new state. */ protected DFAState addState(DFAState d) { if ( getUserMaxLookahead()>0 ) { return d; } // does a DFA state exist already with everything the same // except its state number? DFAState existing = (DFAState)uniqueStates.get(d); if ( existing != null ) { /* System.out.println("state "+d.stateNumber+" exists as state "+ existing.stateNumber); */ // already there...get the existing DFA state return existing; } // if not there, then add new state. uniqueStates.put(d,d); numberOfStates++; return d; }
/** Add a new DFA state to this DFA if not already present. * To force an acyclic, fixed maximum depth DFA, just always * return the incoming state. By not reusing old states, * no cycles can be created. If we're doing fixed k lookahead * don't updated uniqueStates, just return incoming state, which * indicates it's a new state. */ protected DFAState addState(DFAState d) { if ( getUserMaxLookahead()>0 ) { return d; } // does a DFA state exist already with everything the same // except its state number? DFAState existing = uniqueStates.get(d); if ( existing != null ) { /* System.out.println("state "+d.stateNumber+" exists as state "+ existing.stateNumber); */ // already there...get the existing DFA state return existing; } // if not there, then add new state. uniqueStates.put(d,d); numberOfStates++; return d; }
/** Add a new DFA state to this DFA if not already present. * To force an acyclic, fixed maximum depth DFA, just always * return the incoming state. By not reusing old states, * no cycles can be created. If we're doing fixed k lookahead * don't updated uniqueStates, just return incoming state, which * indicates it's a new state. */ protected DFAState addState(DFAState d) { if ( getUserMaxLookahead()>0 ) { return d; } // does a DFA state exist already with everything the same // except its state number? DFAState existing = (DFAState)uniqueStates.get(d); if ( existing != null ) { /* System.out.println("state "+d.stateNumber+" exists as state "+ existing.stateNumber); */ // already there...get the existing DFA state return existing; } // if not there, then add new state. uniqueStates.put(d,d); numberOfStates++; return d; }
/** If this DFA failed to finish during construction, we might be * able to retry with k=1 but we need to know whether it will * potentially succeed. Can only succeed if there is a predicate * to resolve the issue. Don't try if k=1 already as it would * cycle forever. Timeout can retry with k=1 even if no predicate * if k!=1. */ public boolean okToRetryDFAWithK1() { boolean nonLLStarOrOverflowAndPredicateVisible = (probe.isNonLLStarDecision()||probe.analysisOverflowed()) && predicateVisible; // auto backtrack or manual sem/syn return getUserMaxLookahead()!=1 && nonLLStarOrOverflowAndPredicateVisible; }
/** If this DFA failed to finish during construction, we might be * able to retry with k=1 but we need to know whether it will * potentially succeed. Can only succeed if there is a predicate * to resolve the issue. Don't try if k=1 already as it would * cycle forever. Timeout can retry with k=1 even if no predicate * if k!=1. */ public boolean okToRetryDFAWithK1() { boolean nonLLStarOrOverflowAndPredicateVisible = (probe.isNonLLStarDecision()||probe.analysisOverflowed()) && predicateVisible; // auto backtrack or manual sem/syn return getUserMaxLookahead()!=1 && nonLLStarOrOverflowAndPredicateVisible; }
/** If this DFA failed to finish during construction, we might be * able to retry with k=1 but we need to know whether it will * potentially succeed. Can only succeed if there is a predicate * to resolve the issue. Don't try if k=1 already as it would * cycle forever. Timeout can retry with k=1 even if no predicate * if k!=1. */ public boolean okToRetryDFAWithK1() { boolean nonLLStarOrOverflowAndPredicateVisible = (probe.isNonLLStarDecision()||probe.analysisOverflowed()) && predicateVisible; // auto backtrack or manual sem/syn return getUserMaxLookahead()!=1 && nonLLStarOrOverflowAndPredicateVisible; }
/** If this DFA failed to finish during construction, we might be * able to retry with k=1 but we need to know whether it will * potentially succeed. Can only succeed if there is a predicate * to resolve the issue. Don't try if k=1 already as it would * cycle forever. Timeout can retry with k=1 even if no predicate * if k!=1. */ public boolean okToRetryDFAWithK1() { boolean nonLLStarOrOverflowAndPredicateVisible = (probe.isNonLLStarDecision()||probe.analysisOverflowed()) && predicateVisible; // auto backtrack or manual sem/syn return getUserMaxLookahead()!=1 && (analysisTimedOut() || nonLLStarOrOverflowAndPredicateVisible); }
protected Set<Integer> getNonDeterministicAlts() { int user_k = dfa.getUserMaxLookahead(); if ( user_k>0 && user_k==k ) { // if fixed lookahead, then more than 1 alt is a nondeterminism // if we have hit the max lookahead return getAltSet(); } else if ( abortedDueToMultipleRecursiveAlts || abortedDueToRecursionOverflow ) { // if we had to abort for non-LL(*) state assume all alts are a problem return getAltSet(); } else { return getConflictingAlts(); } }
protected Set<Integer> getNonDeterministicAlts() { int user_k = dfa.getUserMaxLookahead(); if ( user_k>0 && user_k==k ) { // if fixed lookahead, then more than 1 alt is a nondeterminism // if we have hit the max lookahead return getAltSet(); } else if ( abortedDueToMultipleRecursiveAlts || abortedDueToRecursionOverflow ) { // if we had to abort for non-LL(*) state assume all alts are a problem return getAltSet(); } else { return getConflictingAlts(); } }
protected Set getNonDeterministicAlts() { int user_k = dfa.getUserMaxLookahead(); if ( user_k>0 && user_k==k ) { // if fixed lookahead, then more than 1 alt is a nondeterminism // if we have hit the max lookahead return getAltSet(); } else if ( abortedDueToMultipleRecursiveAlts || abortedDueToRecursionOverflow ) { // if we had to abort for non-LL(*) state assume all alts are a problem return getAltSet(); } else { return getConflictingAlts(); } }
protected Set getNonDeterministicAlts() { int user_k = dfa.getUserMaxLookahead(); if ( user_k>0 && user_k==k ) { // if fixed lookahead, then more than 1 alt is a nondeterminism // if we have hit the max lookahead return getAltSet(); } else if ( abortedDueToMultipleRecursiveAlts || abortedDueToRecursionOverflow ) { // if we had to abort for non-LL(*) state assume all alts are a problem return getAltSet(); } else { return getConflictingAlts(); } }