コード例 #1
0
ファイル: MyVisitor.cs プロジェクト: ofmendez/Danfab
    public override object VisitWhile_return(FaParser.While_returnContext context)
    {
        object valueExp = VisitExpression(context.expression());

        if (valueExp is bool)
        {
            while ((bool)valueExp)
            {
                object resp = Visit(context.body_return_break_continue());
                if (resp is float)
                {
                    if ((float)resp == (float)1.1)
                    {
                        break;
                    }
                }
                else if (resp != null)
                {
                    return(resp);
                }
                valueExp = VisitExpression(context.expression());
            }
        }
        else
        {
            Debug.LogError("No es una expresion booleana para while.(r)");
            // Console.WriteLine("No es una expresion booleana para while.(r)");
            MyConsole.main.AppendText("No es una expresion booleana para while.(r)");
        }
        return(null);
    }
コード例 #2
0
ファイル: FaBaseVisitor.cs プロジェクト: ofmendez/Danfab
 /// <summary>
 /// Visit a parse tree produced by <see cref="FaParser.while_return"/>.
 /// <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 VisitWhile_return([NotNull] FaParser.While_returnContext context)
 {
     return(VisitChildren(context));
 }