[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: m4_pattern_forbid
From: |
Eric Blake |
Subject: |
Re: m4_pattern_forbid |
Date: |
Tue, 17 Mar 2015 18:06:37 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 |
On 03/17/2015 06:02 PM, Matěj Týč wrote:
>
> What is interesting: I wanted to point out that it should be more
> appropriate to write m4_pattern_forbid([\bMACRO]) than ...([^MACRO]),
> but I found out that it is not really the true:
The perl code in autom4te splits all words of the input into one word
per line before running the regex.
>
> cat << EOF | autom4te -l m4sugar
> m4_pattern_forbid([^FOO])
> m4_divert_push(1)dnl
> FOO1
> FOO2
> hidden FOO3
so all three instances of these FOO match the pattern to be rejected
(after being rewritten as:
FOO1
FOO2
hidden
FOO3
before testing the regex)
> hiddenFOO4
and this does not.
> So maybe getting involved \b is not needed under these circumstances?
The accept/reject patterns operate on each word as if on the line by
themselves, so no need to use \b.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature