unrollRecursionContexts method
void
unrollRecursionContexts(
- ParserRuleContext? _parentctx
inherited
Implementation
void unrollRecursionContexts(ParserRuleContext? _parentctx) {
assert(context != null);
_precedenceStack.removeLast();
context!.stop = _input.LT(-1);
final retctx = context!; // save current ctx (return value)
// unroll so _ctx is as it was before call to recursive method
if (_parseListeners != null) {
while (context != _parentctx) {
triggerExitRuleEvent();
context = context!.parent;
}
} else {
context = _parentctx;
}
// hook into tree
retctx.parent = _parentctx;
if (buildParseTree && _parentctx != null) {
// add return ctx into invoking rule's tree
_parentctx.addAnyChild(retctx);
}
}