示例#1
0
        public CompoundOperation(IZ80AsmVisitorContext visitorContext, Z80AsmParser.CompoundOperationContext context) : base(context)
        {
            var operands = context.operand();

            if (operands == null)
            {
                return;
            }
            for (var i = 0; i < operands.Length; i++)
            {
                // --- Collect operands
                var operandCtx = operands[i];
                switch (i)
                {
                case 0:
                    Operand = visitorContext.GetOperand(operandCtx);
                    break;

                case 1:
                    Operand2 = visitorContext.GetOperand(operandCtx);
                    break;

                default:
                    Operand3 = visitorContext.GetOperand(operandCtx);
                    break;
                }
            }
        }
示例#2
0
        public MacroOrStructInvocation(IZ80AsmVisitorContext visitorContext, Z80AsmParser.MacroOrStructInvocationContext context)
        {
            Parameters = new List <Operand>();
            if (context.macroArgument().Length > 1 ||
                context.macroArgument().Length > 0 && context.macroArgument()[0].operand() != null)
            {
                Parameters.AddRange(context.macroArgument()
                                    .Select(arg => arg.operand() != null
                        ? visitorContext.GetOperand(arg.operand())
                        : new Operand()));
            }

            KeywordSpan = new TextSpan(context.Start.StartIndex, context.Start.StopIndex + 1);
            Name        = context.IDENTIFIER().GetText();
        }