From dc56fd1c146e538338f0c3913e9730c97d66a1a0 Mon Sep 17 00:00:00 2001 From: Guy John Date: Tue, 25 Aug 2020 21:13:10 +0100 Subject: [PATCH] Allow underscores and dollar signs in identifier names --- src/Language/Parser.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Language/Parser.hs b/src/Language/Parser.hs index 96d5c6f..e4d6ff1 100644 --- a/src/Language/Parser.hs +++ b/src/Language/Parser.hs @@ -67,7 +67,7 @@ rws = ["if", "elif", "else", "null", "func", "times", "with", "time"] identifier :: Parser String identifier = (lexeme . try) (p >>= check) where - p = (:) <$> letterChar <*> many alphaNumChar + p = (:) <$> (letterChar <|> char '$' <|> char '_') <*> many (alphaNumChar <|> char '$' <|> char '_') check x = if x `elem` rws then fail $ "keyword " ++ show x ++ " cannot be an identifier" else return x