Re: m4sugar speedups [was: Multi-Line Definitions]

Eric Blake <[email protected]>
Newsgroups gmane.comp.sysutils.autoconf.patches,gmane.comp.gnu.m4.general
Message-ID <[email protected]>
-----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             [email protected]
-----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-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.