
Hi Francesco, Quick response! Thanks. I see, so would it reduce to something like? many itemValue and originally I was thinking the data structure that it would parse into would be data Module = Module {— some record structure—} but now it would be roughly like… type Entry = (String, String) data Module = Module [Entry] Thanks
On 6 Mar 2016, at 09:30, Francesco Ariis
wrote: On Sun, Mar 06, 2016 at 09:26:17AM +0000, Mike Houghton wrote:
Hi, I’m using Parsec to parse structured text and have some problems with mandatory and optional text entries and the order in which they occur. For example:
module{
name = some string source = …
dest = ….. bundle = … bundle_dest = … zip_name = ….
}
Hello Mike, I would personally keep it simple. Parse the (item, value) list and after that check if it is well formed (i.e. contains 'name' and 'source' values). If not, call `parserFail` with an appropriate message. _______________________________________________ Beginners mailing list Beginners@haskell.org mailto:Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners