Parsec: Help needed with simple parser

Folks, I wrote a parser for what should be a simple expression but it's not working. Any help is appreciated! My expression is x + 1 where x can be either "Close", or "Close[N]" or "Close[N] of DataM where N and M are positive integers. What happens in my case is that 1 + x parses fine but x + 1 doesn't. In fact, I would be fine with parsing Close + such that it ignores the plus and returns the parse. Thanks, Joel -- http://wagerlabs.com/

Joel Reymont wrote:
My expression is x + 1 where x can be either "Close", or "Close[N]" or "Close[N] of DataM where N and M are positive integers. What happens in my case is that 1 + x parses fine but x + 1 doesn't. In fact, I would be fine with parsing Close + such that it ignores the plus and returns the parse.
Does "option" help? Like: string "Close" option () (bracketN >> option () ofDataM) where bracketN parses [N], ofDataM parses " of DataM".

On Apr 10, 2007, at 3:42 AM, Albert Y. C. Lai wrote:
Does "option" help? Like:
It did, together with a couple of 'try's. Thanks, Joel -- http://wagerlabs.com/
participants (2)
-
Albert Y. C. Lai
-
Joel Reymont