MCPcopy
hub / github.com/antlr/antlr4 / unrollRecursionContexts

Method unrollRecursionContexts

runtime/JavaScript/src/antlr4/Parser.js:448–468  ·  view source on GitHub ↗
(parentCtx)

Source from the content-addressed store, hash-verified

446 }
447
448 unrollRecursionContexts(parentCtx) {
449 this._precedenceStack.pop();
450 this._ctx.stop = this._input.LT(-1);
451 const retCtx = this._ctx; // save current ctx (return value)
452 // unroll so _ctx is as it was before call to recursive method
453 const parseListeners = this.getParseListeners();
454 if (parseListeners !== null && parseListeners.length > 0) {
455 while (this._ctx !== parentCtx) {
456 this.triggerExitRuleEvent();
457 this._ctx = this._ctx.parentCtx;
458 }
459 } else {
460 this._ctx = parentCtx;
461 }
462 // hook into tree
463 retCtx.parentCtx = parentCtx;
464 if (this.buildParseTrees && parentCtx !== null) {
465 // add return ctx into invoking rule's tree
466 parentCtx.addChild(retCtx);
467 }
468 }
469
470 getInvokingContext(ruleIndex) {
471 let ctx = this._ctx;

Callers

nothing calls this directly

Calls 5

getParseListenersMethod · 0.95
triggerExitRuleEventMethod · 0.95
popMethod · 0.80
LTMethod · 0.65
addChildMethod · 0.45

Tested by

no test coverage detected