[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: Gecko/20070728 Thunderbird/ Mnenhy/

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
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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]