public override int VisitCondition([NotNull] GrammarParser.ConditionContext context) { if (context.condition_expression() != null) { Visit(context.condition_expression()); } if (context.GetChild <GrammarParser.ConditionContext>(0) != null) { Visit(context.GetChild <GrammarParser.ConditionContext>(0)); } if (context.GetChild <GrammarParser.ConditionContext>(1) != null) { Visit(context.GetChild <GrammarParser.ConditionContext>(1)); } ITerminalNode logicalOperator = context.Logical_operator(); if (logicalOperator != null) { if (logicalOperator.GetText() == "||") { AddOPR(Instruction.ADD); AddLIT("1"); AddOPR(Instruction.GEQ); } else { AddOPR(Instruction.MUL); } } return(0); }
/// <summary> /// Exit a parse tree produced by <see cref="GrammarParser.condition"/>. /// <para>The default implementation does nothing.</para> /// </summary> /// <param name="context">The parse tree.</param> public virtual void ExitCondition([NotNull] GrammarParser.ConditionContext context) { }
/// <summary> /// Visit a parse tree produced by <see cref="GrammarParser.condition"/>. /// <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 VisitCondition([NotNull] GrammarParser.ConditionContext context) { return(VisitChildren(context)); }