From cca8c374f9f769cbf294f6a111524e9cbfafca51 Mon Sep 17 00:00:00 2001 From: Adrian Matoga Date: Sun, 14 Mar 2021 23:32:32 +0100 Subject: [PATCH] Instruction pairing extended to more than two instructions. --- source/app.d | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/source/app.d b/source/app.d index 053f713..83dfc57 100644 --- a/source/app.d +++ b/source/app.d @@ -2659,19 +2659,24 @@ unittest { void assemblyPair() { assert(!inOpcode); string instruction = readInstruction(); - if (!eol() && line[column] == ':') { + string[] extraInstructions; + while (!eol() && line[column] == ':') { pairing = true; column++; - string instruction2 = readInstruction(); + extraInstructions ~= readInstruction(); + } + if (!extraInstructions.empty) { int savedColumn = column; if (willSkip) warning("Skipping only the first instruction"); assemblyInstruction(instruction); checkNoExtraCharacters(); - column = savedColumn; wereManyInstructions = false; - assemblyInstruction(instruction2); - wereManyInstructions = true; + foreach (instruction2; extraInstructions) { + column = savedColumn; + assemblyInstruction(instruction2); + wereManyInstructions = true; + } } else { pairing = false; assemblyInstruction(instruction);