[darcs-devel] darcs patch: Allow escaped quotes in `quoted' for match text.

Eric Y. Kow eric.kow at gmail.com
Sun Nov 5 13:29:56 PST 2006


I have had a look, albeit many hours late

On Sat, Nov 04, 2006 at 17:18:33 +0000, Dave Love wrote:
>   The match syntax is documented as subject to change, but this is
>   mostly backwards-compatible.

Ok, so given the new backwards-compatibility and the improved
documentation, I am much more at ease with this patch in principle.

That being said, I'm going to ask to make three minor modifications
and resubmit:

1) please split the testing stuff (for which thanks) into its
   own patch
2) please make it clearer that without double quotes, there is
   no need for escaping of any sort (*)
3) (maybe) refactor the following two paragraphs?

> +In this and the other match types, the argument must be enclosed in double
> +quotes if it contains spaces.  You can escape a quote in the argument with a
> +backslash; backslash escapes itself, but it is treated literally if followed
> +by a character other than a double quote or backslash, so it is typically not
> +necessary to escape a backslash.

> +If you want to include spaces in the regular expression, it must be enclosed
> +in double quotes (\verb|"|).  Note that to match regexp metacharacters, such
> +as \verb|(|, literally, they must be escaped with backslash.  To match a
> +literal backslash it must be written quadrupled in general, but often it need
> +not be escaped, since backslash is only special in regexps when followed by a
> +metacharacter.

Oh and thanks for putting examples in your doc!

> In the following example pairs, the first literal is matched
> +by the second sequence in the match name: ``\verb|"|'':``\verb|\"|'',
> +``\verb|\|'':``\verb|\\\\|'', ``\verb|\x|'':``\verb|\x|'',
> +``\verb|(|'':``\verb|\(|''.

(*) it might be worth submitting also another patch pointing out
that you don't get parentheses without double quotes... at least, that's
my reading of the Parsec.  Do you agree?

All the best,

-- 
Eric Kow                     http://www.loria.fr/~kow
PGP Key ID: 08AC04F9         Merci de corriger mon français.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 186 bytes
Desc: not available
Url : http://lists.osuosl.org/pipermail/darcs-devel/attachments/20061105/1cc54eae/attachment.pgp


More information about the darcs-devel mailing list