Пример #1
0
        private void ParseAssignment(StringSection symbolName, bool isLabel, StringSection expression, int iSourceLine)
        {
            // Call site SHOULD check for this condition and specify an Error.
            if (expression.Length == 0)
            {
                throw new SyntaxErrorException("Expected: expression.", iSourceLine);
            }

            AsmValue assignedValue;

            LiteralValue assignedLiteral;

            if (ExpressionEvaluator.TryParseLiteral(expression, out assignedLiteral))
            {
                assignedValue = new AsmValue(assignedLiteral);
            }
            else
            {
                assignedValue = new AsmValue(expression.ToString());
            }

            assembly.Directives.Add(new Assignment(NextInstructionIndex, iSourceLine, symbolName, isLabel, assignedValue));
        }
Пример #2
0
 public BaseDirective(int instructionIndex, int sourceLine, AsmValue address)
     : base(instructionIndex, sourceLine)
 {
     this.Address = address;
 }
Пример #3
0
 public Assignment(int instructionIndex, int sourceLine, StringSection variable, bool isLabel, AsmValue value)
     : base(instructionIndex, sourceLine)
 {
     this.Variable = variable;
     this.Value    = value;
     this.IsLabel  = isLabel;
 }