[Haskell-beginners] Attoparsec and multiline comments

Daniel Fischer daniel.is.fischer at googlemail.com
Thu Sep 15 10:04:19 CEST 2011


On Thursday 15 September 2011, 06:03:44, Alexander.Vladislav.Popov wrote:
> Dear haskellers,
> 
> Help me to parse multiline comments (like /* ... */ or even like /*- ...
> -*/) using attoparsec.

The docs for manyTill at 
http://hackage.haskell.org/packages/archive/attoparsec/0.9.1.2/doc/html/Data-
Attoparsec-Combinator.html
have the example

simpleComment   = string "<!--" *> manyTill anyChar (try (string "-->"))

modifying the comment delimiters is trivial, modifying it to parse nested 
comments would be nontrivial, but still not too difficult, I think.



More information about the Beginners mailing list