Exemple #1
0
    public override String VisitFactor([NotNull] mathParser.FactorContext context)
    {
        if (context.ChildCount <= 1)
        {
            return(VisitChildren(context));
        }

        if (context.ChildCount != 3)
        {
            Visit(context.GetChild(0));
            expression = expression + "*";
            Visit(context.GetChild(1));
        }
        else
        {
            expression = expression + "System.Math.Pow (";
            Visit(context.GetChild(0));
            expression = expression + ",";
            Visit(context.GetChild(2));
            expression = expression + ")";
        }

        return(expression);
    }
 /// <summary>
 /// Visit a parse tree produced by <see cref="mathParser.factor"/>.
 /// <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 VisitFactor([NotNull] mathParser.FactorContext context)
 {
     return(VisitChildren(context));
 }