[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: m4sugar speedups [was: Multi-Line Definitions]
From: |
Eric Blake |
Subject: |
Re: m4sugar speedups [was: Multi-Line Definitions] |
Date: |
Sun, 30 Sep 2007 08:24:12 -0600 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070728 Thunderbird/2.0.0.6 Mnenhy/0.7.5.666 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
According to Benoit SIGOURE on 9/30/2007 7:51 AM:
>> # Because we want to preserve active symbols, STRING must be
>> double-quoted.
>
> Hmm if you changed [[$1]] to [$1 ], STRING no longer needs to be double
> quoted, right?
There is no change to the level of quotation that clients of m4_strip
require, only in how much quoting we wrap around $1 in the implementation.
Look at the replacement. Beforehand, it was:
m4_bpatsubsts([[$1]], [regex that expects double-overquoting],
[single-quoted replacement that leaves $1 over-quoting alone])
so the result of the m4_bpatsubsts ended up with one extra layer of
quotation (needed, because it is invoked inside a macro, so one more layer
gets stripped off before the final printout).
Now it is:
m4_bpatsubst([$1 ], [regex that expects single-overquoting],
[[[triple-quoted replacement that strips $1 over-quoting]]])
in other words, the replacement provides the over-quoting that was lacking
in the initial pattern, but the end result is still a string with one
extra layer of quotation.
>> -[m4_bpatsubsts([[$1]],
>> +[m4_bpatsubsts([$1 ],
>> [[ ]+], [ ],
>> - [^\(..\) ], [\1],
>> - [ \(..\)$], [\1])])
>> + [^. ?\(.*\) .$], [[[\1]]])])
>>
In general, using anchored regex with m4_bpatsubsts is a bear, because you
have to deal with the fact that m4_bpatsubsts must use overquoted $1.
Now, if m4 could provide a regex builtin that spit out quoted output, we
could fix m4_bpatsubsts to not overquote (hence the m4 TODO to add the
qindir builtin).
- --
Don't work too hard, make some time for fun as well!
Eric Blake address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFG/7GM84KuGfSFAYARAjU8AJ4jld15B77idnKhygKlQx+p4DQ4FwCgphzc
gP0Pv/bg7MVxnbaF41PqvHs=
=7wCV
-----END PGP SIGNATURE-----
- RE: Multi-Line Definitions, (continued)
- RE: Multi-Line Definitions, Eric Lemings, 2007/09/18
- Re: Multi-Line Definitions, Eric Blake, 2007/09/22
- Re: Multi-Line Definitions, Eric Blake-1, 2007/09/27
- Re: Multi-Line Definitions, Ralf Wildenhues, 2007/09/29
- Re: Multi-Line Definitions, Eric Blake, 2007/09/29
- Re: Multi-Line Definitions, Eric Blake, 2007/09/29
- m4 regex usage [was: Multi-Line Definitions], Eric Blake, 2007/09/29
- m4sugar speedups [was: Multi-Line Definitions], Eric Blake, 2007/09/29
- Re: m4sugar speedups [was: Multi-Line Definitions], Benoit SIGOURE, 2007/09/30
- Re: m4sugar speedups [was: Multi-Line Definitions],
Eric Blake <=