ekmett / parsers

Generic parser combinators
Other
88 stars 38 forks source link

Incorrect implementation of someSpace for Unlined in Text.Parser.Token. #77

Open alexandervandenbroucke opened 5 years ago

alexandervandenbroucke commented 5 years ago

The comments on the 'TokenParsing' type class suggest that 'someSpace' should parse at least one space but the instance of 'someSpace' for 'Unlined' also parses the empty string it's definition is:

someSpace = skipMany (satisfy $ \c -> c /= '\n' && isSpace c)

where it should probably be something like

someSpace = spaceNoNewline >> skipMany spaceNoNewline where spaceNoNewline c = c /= '\n' && isSpace c

minimal example:

Text.Parser.Token Text.Trifecta.Parser Text.Parser.Combinators> parseTest (runUnlined someSpace *> eof ) "" ()