[Haskell-cafe] simple parsec question
Immanuel Normann
immanuel.normann at googlemail.com
Sun Mar 3 16:44:17 CET 2013
Hi,
I am trying to parse a semi structured text with parsec that basically
should identify sections. Each section starts with a headline and has an
unstructured content - that's all. For instance, consider the following
example text (inside the dashed lines):
---------------------------
top 1:
some text ... bla
top 2:
more text ... bla bla
---------------------------
This should be parsed into a structure like this:
[Section (Top 1) (Content "some text ... bla"), Section (Top 1) (Content
"more text ... bla")]
Say, I have a parser "headline", but the content after a headline could be
anything that is different from what "headline" parses.
How could the "section" parser making use of "headline" look like?
My idea would be to use the "manyTill" combinator, but I don"t find an easy
solution.
Many thanks for any hint
Immanuel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130303/08b77e47/attachment.htm>
More information about the Haskell-Cafe
mailing list