Skip to content

Commit

Permalink
allow identifiers to be quoted on parsing #64
Browse files Browse the repository at this point in the history
  • Loading branch information
marcosh committed Oct 12, 2018
1 parent e4d3dee commit d7b7298
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Language/Parser/Parser.hs
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@ optionParser =
return (i,j)

identifier :: Parser String
identifier = (lexeme . try) (p >>= check)
identifier = (lexeme . try) (p' >>= check)
where
p = lowerId <|> upperId <|> specialId
p' = p <|> between (char '"') (char '"') p
check x =
if x `elem` reservedWords
then fail $ "keyword" ++ show x ++ "cannot be used as an identifier"
Expand Down

0 comments on commit d7b7298

Please sign in to comment.