I'm writing a parser with Parsec.  In the input language, elements of a sequence
are separated by commas:

   [1, 2, 3]

However, instead of a comma, you can also use an EOL:

  [1, 2
  3]

Anywhere else, EOL is considered ignorable whitespace.  So it's not as simple as
just making EOL a token and looking for (comma | eol).

I've implemented this functionality in a hand-written parser (basically a hack
that keeps track of whether the last read token was preceded by an EOL,
without making EOL itself a token).  Does anybody have ideas about how to
do this with Parsec?

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

Reply via email to