Skip to content

Commit

Permalink
fix specialIdGen to avoid reserved words. Solves #151
Browse files Browse the repository at this point in the history
  • Loading branch information
marcosh committed Aug 15, 2019
1 parent c8cc768 commit e6f06a1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Language/Parser/Generator/Generator.hs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ lowerIdGen =
(`notElem` reservedWords)

specialIdGen :: Gen String
specialIdGen = (:) <$> idCharGen <*> listOf (oneof [idCharGen, digitCharGen])
specialIdGen =
((:) <$> idCharGen <*>
listOf (oneof [idCharGen, digitCharGen])) `suchThat`
(`notElem` reservedWords)

identifierGen :: Gen String
identifierGen = oneof [lowerIdGen, upperIdGen, specialIdGen]
Expand Down

0 comments on commit e6f06a1

Please sign in to comment.