public void BuildWhenCalledOnIndirectNextWordOffsetOperandBuilderSetsNextWordValueToTokenContentForHexValue()
        {
            var leftToken = new HexToken { Content = "0xF" };

            var builder = new IndirectNextWordOffsetOperandBuilder(leftToken);

            var rigthToken = new RegisterToken { Content = "A" };

            var operand = builder.Build(rigthToken);

            Assert.That(operand.NextWord, Is.EqualTo(15));
        }
        public void BuildWhenCalledOnIndirectNextWordOffsetOperandBuilderSetsRegisterToRightTokenContent()
        {
            var leftToken = new HexToken { Content = "0xF" };

            var builder = new IndirectNextWordOffsetOperandBuilder(leftToken);

            var rigthToken = new RegisterToken { Content = "A" };

            var operand = builder.Build(rigthToken);

            Assert.That(operand.RegisterValue, Is.EqualTo((int)RegisterIdentifier.RegA));
        }
Beispiel #3
0
        private Operand ParseIndirectOperand()
        {
            var token = this.ConsumeNextToken().Clone();

            Operand operand;

            if (this.PeekNextToken() is PluslToken)
            {
                this.ConsumeNextToken();
                var rigthToken = this.ConsumeNextToken();
                operand = new IndirectNextWordOffsetOperandBuilder(token).Build(rigthToken);
            }
            else
            {
                operand = this.indirectOperandFactory.CreateOperand(token);
            }

            this.AssertIndirectOperandIsTerminatedWithACloseBracketToken();

            return operand;
        }