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