Example #1
0
        public override Value VisitOr_stat(calculatorParser.Or_statContext context)
        {
            IReadOnlyList <calculatorParser.Condition_blockContext> conditions = context.condition_block();
            Value evaluateFinal = Visit(context.rightstat_block().expr());
            bool  result        = false;

            foreach (var condition in conditions)
            {
                Value evaluateBody = Visit(condition.expr());
                //if (evaluateBody.asBoolean() == false) continue;
                if (evaluateBody.asBoolean() == true || evaluateFinal.asBoolean() == true)
                {
                    result = true;
                    break;
                }
            }
            return(new Value(result));
        }
 /// <summary>
 /// Visit a parse tree produced by <see cref="calculatorParser.or_stat"/>.
 /// <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 VisitOr_stat([NotNull] calculatorParser.Or_statContext context)
 {
     return(VisitChildren(context));
 }
Example #3
0
 /// <summary>
 /// Exit a parse tree produced by <see cref="calculatorParser.or_stat"/>.
 /// <para>The default implementation does nothing.</para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 public virtual void ExitOr_stat([NotNull] calculatorParser.Or_statContext context)
 {
 }