本文整理汇总了Java中org.antlr.tool.ErrorManager.recursionOverflow方法的典型用法代码示例。如果您正苦于以下问题:Java ErrorManager.recursionOverflow方法的具体用法?Java ErrorManager.recursionOverflow怎么用?Java ErrorManager.recursionOverflow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.antlr.tool.ErrorManager
的用法示例。
在下文中一共展示了ErrorManager.recursionOverflow方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: issueRecursionWarnings
import org.antlr.tool.ErrorManager; //导入方法依赖的package包/类
protected void issueRecursionWarnings() {
// RECURSION OVERFLOW
Set dfaStatesWithRecursionProblems =
stateToRecursionOverflowConfigurationsMap.keySet();
// now walk truly unique (unaliased) list of dfa states with inf recur
// Goal: create a map from alt to map<target,List<callsites>>
// Map<Map<String target, List<NFAState call sites>>
Map altToTargetToCallSitesMap = new HashMap();
// track a single problem DFA state for each alt
Map altToDFAState = new HashMap();
computeAltToProblemMaps(dfaStatesWithRecursionProblems,
stateToRecursionOverflowConfigurationsMap,
altToTargetToCallSitesMap, // output param
altToDFAState); // output param
// walk each alt with recursion overflow problems and generate error
Set alts = altToTargetToCallSitesMap.keySet();
List sortedAlts = new ArrayList(alts);
Collections.sort(sortedAlts);
for (Iterator altsIt = sortedAlts.iterator(); altsIt.hasNext();) {
Integer altI = (Integer) altsIt.next();
Map targetToCallSiteMap =
(Map)altToTargetToCallSitesMap.get(altI);
Set targetRules = targetToCallSiteMap.keySet();
Collection callSiteStates = targetToCallSiteMap.values();
DFAState sampleBadState = (DFAState)altToDFAState.get(altI);
ErrorManager.recursionOverflow(this,
sampleBadState,
altI.intValue(),
targetRules,
callSiteStates);
}
}
示例2: issueRecursionWarnings
import org.antlr.tool.ErrorManager; //导入方法依赖的package包/类
protected void issueRecursionWarnings() {
// RECURSION OVERFLOW
Set dfaStatesWithRecursionProblems =
stateToRecursiveOverflowConfigurationsMap.keySet();
// now walk truly unique (unaliased) list of dfa states with inf recur
// Goal: create a map from alt to map<target,List<callsites>>
// Map<Map<String target, List<NFAState call sites>>
Map altToTargetToCallSitesMap = new HashMap();
// track a single problem DFA state for each alt
Map altToDFAState = new HashMap();
computeAltToProblemMaps(dfaStatesWithRecursionProblems,
stateToRecursiveOverflowConfigurationsMap,
altToTargetToCallSitesMap, // output param
altToDFAState); // output param
//System.out.println("altToTargetToCallSitesMap="+altToTargetToCallSitesMap);
// walk each alt with recursion overflow problems and generate error
Set alts = altToTargetToCallSitesMap.keySet();
List sortedAlts = new ArrayList(alts);
Collections.sort(sortedAlts);
for (Iterator altsIt = sortedAlts.iterator(); altsIt.hasNext();) {
Integer altI = (Integer) altsIt.next();
Map targetToCallSiteMap =
(Map)altToTargetToCallSitesMap.get(altI);
Set targetRules = targetToCallSiteMap.keySet();
Collection callSiteStates = targetToCallSiteMap.values();
DFAState sampleBadState = (DFAState)altToDFAState.get(altI);
ErrorManager.recursionOverflow(this,
sampleBadState,
altI.intValue(),
targetRules,
callSiteStates);
}
/* All recursion determines now before analysis
// LEFT RECURSION
// TODO: hideous cut/paste of code; try to refactor
Set dfaStatesWithLeftRecursionProblems =
stateToLeftRecursiveConfigurationsMap.keySet();
Set dfaStatesUnaliased =
getUnaliasedDFAStateSet(dfaStatesWithLeftRecursionProblems);
// now walk truly unique (unaliased) list of dfa states with inf recur
// Goal: create a map from alt to map<target,List<callsites>>
// Map<Map<String target, List<NFAState call sites>>
altToTargetToCallSitesMap = new HashMap();
// track a single problem DFA state for each alt
altToDFAState = new HashMap();
computeAltToProblemMaps(dfaStatesUnaliased,
stateToLeftRecursiveConfigurationsMap,
altToTargetToCallSitesMap, // output param
altToDFAState); // output param
// walk each alt with recursion overflow problems and generate error
alts = altToTargetToCallSitesMap.keySet();
sortedAlts = new ArrayList(alts);
Collections.sort(sortedAlts);
for (Iterator altsIt = sortedAlts.iterator(); altsIt.hasNext();) {
Integer altI = (Integer) altsIt.next();
Map targetToCallSiteMap =
(Map)altToTargetToCallSitesMap.get(altI);
Set targetRules = targetToCallSiteMap.keySet();
Collection callSiteStates = targetToCallSiteMap.values();
ErrorManager.leftRecursion(this,
altI.intValue(),
targetRules,
callSiteStates);
}
*/
}