On Mar 25, 2008, at 12:43 , Paul Keir wrote:
Thanks. I can't find optionMaybe in my version 2.1 of Parsec, but in any case, defining my only_prod as

only_prod = do { reserved "only"; option [] identifier }

or

only_prod = do { reserved "only"; identifier <|> return [] }

gives the same error responses as before. I will anyway look closer at option.

The other problem here is that just using a given string in "reserved" doesn't prevent it from being parsed elsewhere by "identifier". (Note the character offset of the error was 9, i.e. just past "only end", and it was looking for "end" or more identifier characters.)

Are you using the higher level parser facilities from Text.ParserCombinators.Parsec.Token, or rolling your own? If the latter, you will need to modify "identifier" to not accept keywords.

--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [EMAIL PROTECTED]
system administrator [openafs,heimdal,too many hats] [EMAIL PROTECTED]
electrical and computer engineering, carnegie mellon university    KF8NH


_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to