Skip to content

Commit

Permalink
Allow underscores and dollar signs in identifier names
Browse files Browse the repository at this point in the history
  • Loading branch information
rumblesan committed Aug 25, 2020
1 parent 9610c38 commit dc56fd1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Language/Parser.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit dc56fd1

Please sign in to comment.