Ejemplo n.º 1
0
        public override Calc_node VisitTrig_exp([NotNull] CalcParser.Trig_expContext context)
        {
            Unary_node node = new Unary_node();

            switch (context.TrigID().GetText().ToLower())
            {
            case "sin":
                node.func = Unary_node.FuncID.Sin;
                break;

            case "cos":
                node.func = Unary_node.FuncID.Cos;
                break;

            case "tan":
                node.func = Unary_node.FuncID.Tan;
                break;
            }
            if (context.exp() != null)
            {
                node.node1 = Visit(context.exp());
            }
            else
            {
                node.node1 = null;
            }
            return(node);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Visit a parse tree produced by <see cref="CalcParser.trig_exp"/>.
 /// <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 VisitTrig_exp([NotNull] CalcParser.Trig_expContext context)
 {
     return(VisitChildren(context));
 }
 /// <summary>
 /// Exit a parse tree produced by <see cref="CalcParser.trig_exp"/>.
 /// <para>The default implementation does nothing.</para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 public virtual void ExitTrig_exp([NotNull] CalcParser.Trig_expContext context)
 {
 }