diff options
-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") |