On Mon, Jul 26, 2010 at 4:14 AM, S. Doaitse Swierstra
<doaitse@swierstra.net> wrote:
I took a quick look at this file. To me it seems a mixture of a lexer and a parser built on top of a home brewn parser library. I see function like maybeWork which
(if I interpret correctly) test whether specific conditions hold for the input, etc.
The one Eric linked to is the current parser, but it's not the one I had in mind when I mentioned the "parsec-like" API.
I have modified the API exported by the home brewed parser to be more parsec-like, but my changes are still in review. You can see them here:
I have also included the PatchInfo parser on that page as it is defined in a different module than the one Eric linked.
Indeed it would be nice to have a grammatical description of the input format. An important question is whether you can be assured that all input is indeed correct, or whether any checking has to be done.
Most of the time darcs just consumes its own output. Sometimes humans edit their patches, for example to rewrite history, but this is discouraged. Also, darcs stores hashes of files and checks them so editing patches will fail unless those hashes are updated too. When patches are mailed the mailer might munge them so that's another time when it's good to do some input validation.
Thanks,
Jason