[Haskell-cafe] Parsec question

minh thu noteed at gmail.com
Fri Apr 17 02:47:45 EDT 2009


2009/4/17 Michael P Mossey <mpm at alumni.caltech.edu>:
> I want to write a parser that can read a file with this format: the file has
> sections which are demarcated by keywords. Keywords always begin with two
> forward slashes and consist of letters, digits, and underscore. The text can
> be anything, including special characters. For instance:
>
>
> //keyword some text
> and more text //another_keyword and) some { more text
> //ya_keyword $$
> -- text
>
>
> I'm not sure how to write a parser that considers anything but a double
> slash to be a valid part of the text.

Maybe you can use a combination of 'many', 'noneOf' or 'manyTill' ?

Cheers,
Thu


More information about the Haskell-Cafe mailing list