Example #1
0
        public override int VisitOperand([NotNull] OperandContext context)
        {
            ITerminalNode digit  = context.DIGIT();
            var           result = 0;

            if (digit != null)
            {
                result = int.Parse(digit.GetText());
            }
            else
            {
                result = HandleGroup(context.operand(), context.OPERATOR());
            }
            return(result);
        }
	/// <summary>
	/// Visit a parse tree produced by <see cref="ICalculatorParser.operand"/>.
	/// <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 VisitOperand([NotNull] ICalculatorParser.OperandContext context) { return VisitChildren(context); }