Return the correct tree when starting parser interpreter at an LR rule (fixes #461)
This commit is contained in:
parent
d498292680
commit
72a65093e0
|
@ -148,8 +148,16 @@ public class ParserInterpreter extends Parser {
|
|||
case ATNState.RULE_STOP :
|
||||
// pop; return from rule
|
||||
if ( _ctx.isEmpty() ) {
|
||||
exitRule();
|
||||
return rootContext;
|
||||
if (startRuleStartState.isPrecedenceRule) {
|
||||
ParserRuleContext result = _ctx;
|
||||
Pair<ParserRuleContext, Integer> parentContext = _parentContextStack.pop();
|
||||
unrollRecursionContexts(parentContext.a);
|
||||
return result;
|
||||
}
|
||||
else {
|
||||
exitRule();
|
||||
return rootContext;
|
||||
}
|
||||
}
|
||||
|
||||
visitRuleStopState(p);
|
||||
|
|
Loading…
Reference in New Issue