summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2014-03-09 17:11:51 +1100
committerJed Barber <jjbarber@y7mail.com>2014-03-09 17:11:51 +1100
commit6576f330a8bb66e269fd15e66850ee0082e08d10 (patch)
tree0ef03ed49c0f3bee7f867f9d310e2b0a3c2db64a
parentd79ec4f26640e3ca0a447de8fb5906246b4dc4b3 (diff)
Fixed comment removal to leave . and ? builtins intact
-rw-r--r--Unlambda/Parser.hs10
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")