public override object VisitBlock([NotNull] CalculatorParser.BlockContext context) { var stack = new Stack(m_stack); // Save the old stack's reference var oldStack = m_stack; m_stack = stack; var result = base.VisitBlock(context); // Retrieve the old stack m_stack = oldStack; return(result); }
/// <summary> /// Visit a parse tree produced by <see cref="CalculatorParser.block"/>. /// <para> /// The default implementation returns the result of calling <see cref="AbstractParseTreeVisitor{Result}.VisitChildren(IRuleNode)"/> /// on <paramref name="context"/>. /// </para> /// </summary> /// <param name="context">The parse tree.</param> /// <return>The visitor result.</return> public virtual Result VisitBlock([NotNull] CalculatorParser.BlockContext context) { return(VisitChildren(context)); }