bug-grep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 01/11] dfa: fix corner case with anchors


From: Eric Blake
Subject: Re: [PATCH 01/11] dfa: fix corner case with anchors
Date: Wed, 04 Jan 2012 16:40:53 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:9.0) Gecko/20111222 Thunderbird/9.0

On 01/04/2012 03:59 AM, Paolo Bonzini wrote:
> * NEWS: Document bugfix.
> * src/dfa.c (insert, delete, merge): Do not merge nodes with the
> same index and different constraints.
> * tests/spencer1.tests: Add test cases.
> ---
>  NEWS                 |    5 +++++
>  src/dfa.c            |   23 ++++++++++++-----------
>  tests/spencer1.tests |   12 ++++++++++++
>  3 files changed, 29 insertions(+), 11 deletions(-)
> 
> diff --git a/NEWS b/NEWS
> index 9efb82a..5467d37 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -33,6 +33,11 @@ GNU grep NEWS                                    -*- 
> outline -*-
>    grep no longer emits an error message and quits on MS-Windows when
>    invoked with the -r option.
>  
> +  grep interprets correctly some regular expressions where anchors
> +  (^, $, \<, \>, \B, \b) occur before an "|".  For example "(^|\B)a"
> +  incorrectly reported a match the string "x a".
> +  [bug present since "the beginning"]

That has a grammar problem, and doesn't make it clear that the example
is for egrep.  Also, I like it when the first line can be read in
isolation as a summary of the overall entry.  How about:

grep no longer misinterprets alternations involving anchors
(^, $, \< \> \B, \b).  For example, grep -E "(^|\B)a" no
longer reports a match to the string "x a".
[bug present since "the beginning"]

> +++ b/tests/spencer1.tests
> @@ -129,3 +129,15 @@
>  address@hidden(bc)address@hidden
>  address@hidden@ac
>  0@(....)address@hidden
> +0@(^|\B)address@hidden
> +0@(^|\B)address@hidden
> +1@(^|\B)address@hidden abc
> address@hidden|address@hidden
> address@hidden|address@hidden
> address@hidden|address@hidden abc
> +0@(^|\>)address@hidden
> +1@(^|\>)address@hidden
> +1@(^|\>)address@hidden abc
> address@hidden|\>address@hidden
> address@hidden|\>address@hidden
> address@hidden|\>address@hidden abc

Should we also test things like:

address@hidden($|\B)@a x

-- 
Eric Blake   address@hidden    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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