public override object VisitSwitch_break_continue(FaParser.Switch_break_continueContext context) { int nCases = context.dataType().Length; string id = context.ID().GetText(); bool thrown = false; object result = null; if (Exist(id) is MyVariable) //TODO : agregar array { object value = ((MyVariable)Exist(id)).value; for (int i = 0; i < nCases; i++) { object caseValue = VisitDataType(context.dataType(i)); if (caseValue.GetType() == value.GetType() && caseValue == value) { result = Visit(context.body_break_continue(i)); thrown = true; break; } // else{ // Debug.LogError("La expresión a evaluar debe ser booleana"); // // Console.WriteLine("La expresión a evaluar debe ser booleana"); // MyConsole.main.AppendText("La expresión a evaluar debe ser booleana"); // break; // } } if (context.body_break_continue().Length > nCases && !thrown) { result = Visit(context.body_break_continue(context.body_break_continue().Length - 1)); } } return(result); }
/// <summary> /// Visit a parse tree produced by <see cref="FaParser.switch_break_continue"/>. /// <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 VisitSwitch_break_continue([NotNull] FaParser.Switch_break_continueContext context) { return(VisitChildren(context)); }