/// <summary> /// Visit a parse tree produced by <see cref="Z80EvalParser.equExpr"/>. /// <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 override object VisitEquExpr(Z80EvalParser.EquExprContext context) { if (IsInvalidContext(context)) { return(null); } var expr = (ExpressionNode)VisitRelExpr(context.relExpr()[0]); var opIndex = 1; for (var i = 1; i < context.relExpr().Length; i++) { var rightExpr = VisitRelExpr(context.relExpr()[i]); var opToken = context.GetTokenText(opIndex); var equExpr = opToken == "==" ? new EqualOperationNode() : new NotEqualOperationNode() as BinaryOperationNode; equExpr.LeftOperand = expr; equExpr.RightOperand = (ExpressionNode)rightExpr; expr = equExpr; opIndex += 2; } return(expr); }
/// <summary> /// Visit a parse tree produced by <see cref="Z80EvalParser.equExpr"/>. /// <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 VisitEquExpr([NotNull] Z80EvalParser.EquExprContext context) { return(VisitChildren(context)); }
/// <summary> /// Exit a parse tree produced by <see cref="Z80EvalParser.equExpr"/>. /// <para>The default implementation does nothing.</para> /// </summary> /// <param name="context">The parse tree.</param> public virtual void ExitEquExpr([NotNull] Z80EvalParser.EquExprContext context) { }