[Top][All Lists]
[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
signature.asc
Description: OpenPGP digital signature
- [RFC/RFT PATCH 00/11] Differentiate ^/$ from \` and \' in grep -z mode, Paolo Bonzini, 2012/01/04
- [PATCH 01/11] dfa: fix corner case with anchors, Paolo Bonzini, 2012/01/04
- Re: [PATCH 01/11] dfa: fix corner case with anchors,
Eric Blake <=
- [PATCH 02/11] dfa: introduce contexts for the values in d->success, Paolo Bonzini, 2012/01/04
- [PATCH 04/11] dfa: refactor common context computations, Paolo Bonzini, 2012/01/04
- [PATCH 03/11] dfa: change newline/letter to a single context value, Paolo Bonzini, 2012/01/04
- [PATCH 05/11] dfa: change meaning of a state context, Paolo Bonzini, 2012/01/04
- [PATCH 06/11] dfa: remove useless check, Paolo Bonzini, 2012/01/04
- [PATCH 07/11] dfa: make repetitive code *really* repetitive, Paolo Bonzini, 2012/01/04
- [PATCH 08/11] dfa: remove redundant line constraints, Paolo Bonzini, 2012/01/04
- [PATCH 11/11] dfa: introduce BEGBUF/ENDBUF, Paolo Bonzini, 2012/01/04
- [PATCH 09/11] dfa: rename "newline" to "buffer delimiter", Paolo Bonzini, 2012/01/04
- [PATCH 10/11] dfa: introduce bufdelim context, Paolo Bonzini, 2012/01/04