public override object VisitXorExpr(Z80AsmParser.XorExprContext context) { if (context == null) { return(null); } var subExprs = context.andExpr(); var expr = VisitAndExpr(subExprs[0]); for (var i = 1; i < subExprs.Length; i++) { var rightExpr = VisitAndExpr(subExprs[i]); expr = new BitwiseXorOperationNode(expr, rightExpr); } return(expr); }
/// <summary> /// Visit a parse tree produced by <see cref="Generated.Z80AsmParser.xorExpr"/>. /// </summary> /// <param name="context">The parse tree.</param> /// <return>The visitor result.</return> public override object VisitXorExpr(Z80AsmParser.XorExprContext context) { if (IsInvalidContext(context)) { return(null); } var expr = VisitAndExpr(context.GetChild(0) as Z80AsmParser.AndExprContext); var nextChildIndex = 2; while (nextChildIndex < context.ChildCount) { var rightExpr = VisitAndExpr(context.GetChild(nextChildIndex) as Z80AsmParser.AndExprContext); expr = new BitwiseXorOperationNode { LeftOperand = (ExpressionNode)expr, RightOperand = (ExpressionNode)rightExpr }; nextChildIndex += 2; } return(expr); }
/// <summary> /// Visit a parse tree produced by <see cref="Z80AsmParser.xorExpr"/>. /// <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 VisitXorExpr([NotNull] Z80AsmParser.XorExprContext context) { return(VisitChildren(context)); }
/// <summary> /// Exit a parse tree produced by <see cref="Z80AsmParser.xorExpr"/>. /// <para>The default implementation does nothing.</para> /// </summary> /// <param name="context">The parse tree.</param> public virtual void ExitXorExpr([NotNull] Z80AsmParser.XorExprContext context) { }
public BitwiseXorOperationNode(Z80AsmParser.XorExprContext context, Z80AsmVisitor visitor) : base(context, context.expr()[0], context.expr()[1], visitor) { }