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)); }
public BaseDirective(int instructionIndex, int sourceLine, AsmValue address) : base(instructionIndex, sourceLine) { this.Address = address; }
public Assignment(int instructionIndex, int sourceLine, StringSection variable, bool isLabel, AsmValue value) : base(instructionIndex, sourceLine) { this.Variable = variable; this.Value = value; this.IsLabel = isLabel; }