[Haskell-beginners] Parsing
Mike Houghton
mike_k_houghton at yahoo.co.uk
Sun Mar 6 09:54:34 UTC 2016
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 <fa-ml at ariis.it> 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 at haskell.org <mailto:Beginners at haskell.org>
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners <http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20160306/e7952ddf/attachment.html>
More information about the Beginners
mailing list