forked from jasder/antlr
improve debuggability of generated recognizer
This commit is contained in:
parent
84fbdc8038
commit
6f35cf231b
|
@ -266,7 +266,8 @@ public class <parser.name> extends <superClass; null="Parser"> {
|
|||
public boolean sempred(RuleContext _localctx, int ruleIndex, int predIndex) {
|
||||
switch (ruleIndex) {
|
||||
<parser.sempredFuncs.values:{f|
|
||||
case <f.ruleIndex>: return <f.name>_sempred((<f.ctxType>)_localctx, predIndex);}; separator="\n">
|
||||
case <f.ruleIndex>:
|
||||
return <f.name>_sempred((<f.ctxType>)_localctx, predIndex);}; separator="\n">
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -324,7 +325,9 @@ dumpActions(recog, argFuncs, actionFuncs, sempredFuncs) ::= <<
|
|||
public void action(RuleContext _localctx, int ruleIndex, int actionIndex) {
|
||||
switch (ruleIndex) {
|
||||
<recog.actionFuncs.values:{f|
|
||||
case <f.ruleIndex>: <f.name>_action((<f.ctxType>)_localctx, actionIndex); break;}; separator="\n">
|
||||
case <f.ruleIndex>:
|
||||
<f.name>_action((<f.ctxType>)_localctx, actionIndex);
|
||||
break;}; separator="\n">
|
||||
}
|
||||
}
|
||||
<actionFuncs.values; separator="\n">
|
||||
|
@ -334,7 +337,8 @@ case <f.ruleIndex>: <f.name>_action((<f.ctxType>)_localctx, actionIndex); break;
|
|||
public boolean sempred(RuleContext _localctx, int ruleIndex, int predIndex) {
|
||||
switch (ruleIndex) {
|
||||
<recog.sempredFuncs.values:{f|
|
||||
case <f.ruleIndex>: return <f.name>_sempred((<f.ctxType>)_localctx, predIndex);}; separator="\n">
|
||||
case <f.ruleIndex>:
|
||||
return <f.name>_sempred((<f.ctxType>)_localctx, predIndex);}; separator="\n">
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -356,7 +360,9 @@ RuleActionFunction(r, actions) ::= <<
|
|||
private void <r.name>_action(<r.ctxType> _localctx, int actionIndex) {
|
||||
switch (actionIndex) {
|
||||
<actions:{index|
|
||||
case <index>: <actions.(index)> break;}; separator="\n">
|
||||
case <index>:
|
||||
<actions.(index)>
|
||||
break;}; separator="\n">
|
||||
}
|
||||
}
|
||||
>>
|
||||
|
@ -368,7 +374,8 @@ RuleSempredFunction(r, actions) ::= <<
|
|||
private boolean <r.name>_sempred(<r.ctxType> _localctx, int predIndex) {
|
||||
switch (predIndex) {
|
||||
<actions:{index|
|
||||
case <index>: return <actions.(index)>;}; separator="\n">
|
||||
case <index>:
|
||||
return <actions.(index)>;}; separator="\n">
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -621,11 +628,13 @@ cases(ttypes) ::= <<
|
|||
>>
|
||||
|
||||
InvokeRule(r, argExprsChunks) ::= <<
|
||||
setState(<r.stateNumber>); <if(r.labels)><r.labels:{l | <labelref(l)> = }><endif><r.name>(<if(r.ast.options.p)><r.ast.options.p><if(argExprsChunks)>,<endif><endif><argExprsChunks>);
|
||||
setState(<r.stateNumber>);
|
||||
<if(r.labels)><r.labels:{l | <labelref(l)> = }><endif><r.name>(<if(r.ast.options.p)><r.ast.options.p><if(argExprsChunks)>,<endif><endif><argExprsChunks>);
|
||||
>>
|
||||
|
||||
MatchToken(m) ::= <<
|
||||
setState(<m.stateNumber>); <if(m.labels)><m.labels:{l | <labelref(l)> = }><endif>match(<m.name>);
|
||||
setState(<m.stateNumber>);
|
||||
<if(m.labels)><m.labels:{l | <labelref(l)> = }><endif>match(<m.name>);
|
||||
>>
|
||||
|
||||
MatchSet(m, expr, capture) ::= "<CommonSetStuff(m, expr, capture, false)>"
|
||||
|
|
Loading…
Reference in New Issue