From 6576f330a8bb66e269fd15e66850ee0082e08d10 Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Sun, 9 Mar 2014 17:11:51 +1100 Subject: Fixed comment removal to leave . and ? builtins intact --- Unlambda/Parser.hs | 10 ++++++++-- 1 file 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") -- cgit