diff options
author | Jed Barber <jjbarber@y7mail.com> | 2014-03-09 17:11:51 +1100 |
---|---|---|
committer | Jed Barber <jjbarber@y7mail.com> | 2014-03-09 17:11:51 +1100 |
commit | 6576f330a8bb66e269fd15e66850ee0082e08d10 (patch) | |
tree | 0ef03ed49c0f3bee7f867f9d310e2b0a3c2db64a /Unlambda | |
parent | d79ec4f26640e3ca0a447de8fb5906246b4dc4b3 (diff) |
Fixed comment removal to leave . and ? builtins intact
Diffstat (limited to 'Unlambda')
-rw-r--r-- | Unlambda/Parser.hs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Unlambda/Parser.hs b/Unlambda/Parser.hs index 5287940..18012e7 100644 --- a/Unlambda/Parser.hs +++ b/Unlambda/Parser.hs @@ -50,9 +50,15 @@ removeComments = uline `sepEndBy` eol >>= (return . concat) uline = do - l <- many (noneOf "#\r\n") + l <- many builtin optional (char '#' >> many (noneOf "\r\n")) - return l + return . concat $ l + + +builtin = (oneOf "`skivrdce|@" >>= return . (:[])) + <|> (char '.' >> anyChar >>= return . ('.':) . (:[])) + <|> (char '?' >> anyChar >>= return . ('?':) . (:[])) + <?> "unlambda builtin function" eol = try (string "\r\n") |