forked from jasder/antlr
only gen "set stop token" if finally/after actions exist.
This commit is contained in:
parent
b05d86c150
commit
7d16438a19
|
@ -79,6 +79,7 @@ public abstract class DefaultOutputModelFactory extends BlankOutputModelFactory
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SrcOp> rulePostamble(RuleFunction function, Rule r) {
|
public List<SrcOp> rulePostamble(RuleFunction function, Rule r) {
|
||||||
|
if ( r.namedActions.containsKey("after") || r.namedActions.containsKey("finally") ) {
|
||||||
// See OutputModelController.buildLeftRecursiveRuleFunction
|
// See OutputModelController.buildLeftRecursiveRuleFunction
|
||||||
// and Parser.exitRule for other places which set stop.
|
// and Parser.exitRule for other places which set stop.
|
||||||
CodeGenerator gen = getGenerator();
|
CodeGenerator gen = getGenerator();
|
||||||
|
@ -89,6 +90,8 @@ public abstract class DefaultOutputModelFactory extends BlankOutputModelFactory
|
||||||
ops.add(setStopTokenAction);
|
ops.add(setStopTokenAction);
|
||||||
return ops;
|
return ops;
|
||||||
}
|
}
|
||||||
|
return super.rulePostamble(function, r);
|
||||||
|
}
|
||||||
|
|
||||||
// Convenience methods
|
// Convenience methods
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue