Exemplo n.º 1
0
        public override void ExitProductMultiplyNegate(calcParser.ProductMultiplyNegateContext context)
        {
            base.ExitProductMultiplyNegate(context);
            var    sum    = context.product();
            var    negate = context.negate();
            double v1     = Annotations.ptp.Get(sum);
            double v2     = Annotations.ptp.Get(negate);
            double res;

            if (context.MULOP().GetText() == "*")
            {
                res = v1 * v2;
            }
            else
            {
                res = v1 / v2;
            }
            Annotations.ptp.Put(context, res);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Exit a parse tree produced by the <c>productMultiplyNegate</c>
 /// labeled alternative in <see cref="calcParser.product"/>.
 /// <para>The default implementation does nothing.</para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 public virtual void ExitProductMultiplyNegate([NotNull] calcParser.ProductMultiplyNegateContext context)
 {
 }