From da2586db57c83883b5c1b36712e7ead1f3786538 Mon Sep 17 00:00:00 2001 From: "Collin J. Doering" Date: Wed, 6 Jan 2016 18:06:35 -0500 Subject: [PATCH] Allow spaces between = and ; in ASM instructions During the firstpass, strip spaces from: - between the instruction destination and '=' - between '=' and the instruction ALU ops - between the instruction ALU ops and ';' - between ';' and the instruction jump Signed-off-by: Collin J. Doering --- src/lib/RekahSoft/HackAsm/Parser.hs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/lib/RekahSoft/HackAsm/Parser.hs b/src/lib/RekahSoft/HackAsm/Parser.hs index 3defcf3..eea97f0 100644 --- a/src/lib/RekahSoft/HackAsm/Parser.hs +++ b/src/lib/RekahSoft/HackAsm/Parser.hs @@ -233,11 +233,15 @@ instrLine = do cInstr' = do dest <- optionMaybe $ try $ do (d, _) <- cInstrDest + optional spaces char '=' + optional spaces return d (op, _) <- cInstrAluOps jump <- optionMaybe $ try $ do + optional spaces char ';' + optional spaces (j, _) <- cInstrJump return j