a bit of clean up

[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 8907]
This commit is contained in:
parrt 2011-07-24 16:24:18 -08:00
parent a29feac1bf
commit 76ca9ba0d5
2 changed files with 18 additions and 18 deletions

View File

@ -65,33 +65,33 @@ public class <parser.name> extends Parser {
dumpActions(recog, argFuncs, actionFuncs, sempredFuncs) ::= << dumpActions(recog, argFuncs, actionFuncs, sempredFuncs) ::= <<
<if(argFuncs)> <if(argFuncs)>
public ParserRuleContext newContext(RuleContext _localctx, int s, int ruleIndex, int actionIndex) { public ParserRuleContext newContext(RuleContext _localctx, int s, int ruleIndex, int actionIndex) {
switch ( ruleIndex ) { switch ( ruleIndex ) {
<recog.argFuncs.values:{f| <recog.argFuncs.values:{f|
case <f.ruleIndex> : return <f.name>_argEval((<f.ctxType>)_localctx, s, actionIndex);}; separator="\n"> case <f.ruleIndex> : return <f.name>_argEval((<f.ctxType>)_localctx, s, actionIndex);}; separator="\n">
}
return new ParserRuleContext(_localctx, s);
} }
<argFuncs.values; separator="\n"> return new ParserRuleContext(_localctx, s);
}
<argFuncs.values; separator="\n">
<endif> <endif>
<if(actionFuncs)> <if(actionFuncs)>
public void action(RuleContext _localctx, int ruleIndex, int actionIndex) { public void action(RuleContext _localctx, int ruleIndex, int actionIndex) {
switch ( ruleIndex ) { switch ( ruleIndex ) {
<recog.actionFuncs.values:{f| <recog.actionFuncs.values:{f|
case <f.ruleIndex> : <f.name>_action((<f.ctxType>)_localctx, actionIndex);}; separator="\n"> case <f.ruleIndex> : <f.name>_action((<f.ctxType>)_localctx, actionIndex);}; separator="\n">
}
} }
<actionFuncs.values; separator="\n"> }
<actionFuncs.values; separator="\n">
<endif> <endif>
<if(sempredFuncs)> <if(sempredFuncs)>
public boolean sempred(RuleContext _localctx, int ruleIndex, int predIndex) { public boolean sempred(RuleContext _localctx, int ruleIndex, int predIndex) {
switch ( ruleIndex ) { switch ( ruleIndex ) {
<recog.sempredFuncs.values:{f| <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;
} }
<sempredFuncs.values; separator="\n"> return true;
}
<sempredFuncs.values; separator="\n">
<endif> <endif>
>> >>

View File

@ -625,7 +625,7 @@ public class Tool {
for (Grammar ig : grammars) { for (Grammar ig : grammars) {
for (Rule r : ig.rules.values()) { for (Rule r : ig.rules.values()) {
try { try {
String dot = dotGenerator.getDOT(g.atn.ruleToStartState[r.index]); String dot = dotGenerator.getDOT(g.atn.ruleToStartState[r.index], g.isLexer());
if (dot != null) { if (dot != null) {
writeDOTFile(g, r, dot); writeDOTFile(g, r, dot);
} }