From 86dd243c11cdefae740a749ec4a69854889722a5 Mon Sep 17 00:00:00 2001 From: Joscha Date: Sat, 4 Apr 2020 13:40:40 +0000 Subject: [PATCH] Allow '_' in label and meta names --- examples/stack.mimasm | 8 ++++---- src/Mima/Asm/Phase1.hs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/stack.mimasm b/examples/stack.mimasm index d40bfe5..b4f50fb 100644 --- a/examples/stack.mimasm +++ b/examples/stack.mimasm @@ -163,11 +163,11 @@ callee: STV tmp3 ; For comparison in loop STV tmp4 ; For accumulating result - callee-loop: + callee_loop: ; Break if counter (tmp1) is zero LDV tmp1 EQL tmp3 - JMN callee-loop-end + JMN callee_loop_end ; Decrement counter (tmp1) by 1 LDV tmp1 ADC -1 @@ -177,9 +177,9 @@ callee: ADD tmp2 STV tmp4 ; And repeat the loop - JMP callee-loop + JMP callee_loop - callee-loop-end: + callee_loop_end: ; Save the result in return value 2 LDV tmp4 STRF 2 diff --git a/src/Mima/Asm/Phase1.hs b/src/Mima/Asm/Phase1.hs index 381d4f6..6ff8609 100644 --- a/src/Mima/Asm/Phase1.hs +++ b/src/Mima/Asm/Phase1.hs @@ -213,7 +213,7 @@ withSpan f = do name :: Parser (Name Span) name = fmap (uncurry Name) $ withSpan $ do firstChar <- satisfy isLower "lowercase character" - otherChars <- takeWhileP (Just "alphanumeric character") isAlphaNum + otherChars <- takeWhileP (Just "alphanumeric character or '_'") (\c -> isAlphaNum c || c == '_') pure $ T.pack [firstChar] <> otherChars number :: (Num a) => Parser a