[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bug Report: \y, \B, \<, \> do not work with _
From: |
Aharon Robbins |
Subject: |
Re: Bug Report: \y, \B, \<, \> do not work with _ |
Date: |
Sun, 03 Dec 2000 15:33:50 +0200 |
Greetings. Concerning this:
> Date: Fri, 01 Dec 2000 12:09:03 +0100
> From: Servatius Brandt <address@hidden>
> To: address@hidden
> CC: address@hidden
> Subject: Bug Report: \y, \B, \<, \> do not work with _
>
> Hello,
>
> The \y, \B, \<, \> patterns do not regard _ as
> word-constituent (unlike \w and \W, which do).
>
> Operating system: ReliantUNIX-Y 5.44 C2001 RM600 R10000
> Version of gawk: 3.0.6
> C-Compiler: Fujitsu Siemens Computers CDS++ V2.0C0004
>
> Test program:
>
> #!/usr/local/bin/gawk -f
>
> BEGIN {
> print match("X _abc Y", /\<_abc/) # bug
> print match("X _abc Y", /\y_abc/) # bug
> print match("X abc_ Y", /abc_\>/) # bug
> print match("X abc_ Y", /abc_\y/) # bug
> print match("X abc_def Y", /abc_\Bdef/) # bug
>
> print match("X a_c Y", /a\wc/) # ok!
> print match("X a.c Y", /a\Wc/) # ok!
> exit
> }
>
>
> Regards,
> Servatius Brandt
This is indeed a bug. Here is an unofficial patch that fixes the
problem. My development version uses newer versions of dfa.[ch]
and regex.[ch] and your test program worked there; this patch is
against 3.0.6.
Let me say "thank you" for an excellent bug report. This made it
quite easy to see the problem and track it down.
Arnold Robbins
--------------------------------------------------------------
*** ../gawk-3.0.6/dfa.c Fri May 2 04:36:18 1997
--- dfa.c Sun Dec 3 15:28:25 2000
***************
*** 1547,1552 ****
--- 1547,1553 ----
for (i = 0; i < NOTCHAR; ++i)
if (ISALNUM(i))
setbit(i, letters);
+ setbit('_', letters);
setbit('\n', newline);
}
***************
*** 1680,1686 ****
for (i = 0; i < NOTCHAR; ++i)
if (i == '\n')
trans[i] = state_newline;
! else if (ISALNUM(i))
trans[i] = state_letter;
else
trans[i] = state;
--- 1681,1687 ----
for (i = 0; i < NOTCHAR; ++i)
if (i == '\n')
trans[i] = state_newline;
! else if (ISALNUM(i) || i == '_')
trans[i] = state_letter;
else
trans[i] = state;
***************
*** 1741,1747 ****
if (c == '\n')
trans[c] = state_newline;
! else if (ISALNUM(c))
trans[c] = state_letter;
else if (c < NOTCHAR)
trans[c] = state;
--- 1742,1748 ----
if (c == '\n')
trans[c] = state_newline;
! else if (ISALNUM(c) || c == '_')
trans[c] = state_letter;
else if (c < NOTCHAR)
trans[c] = state;
***************
*** 1890,1896 ****
for (i = 0; i < NOTCHAR; ++i)
if (i == '\n')
sbit[i] = 4;
! else if (ISALNUM(i))
sbit[i] = 2;
else
sbit[i] = 1;
--- 1891,1897 ----
for (i = 0; i < NOTCHAR; ++i)
if (i == '\n')
sbit[i] = 4;
! else if (ISALNUM(i) || i == '_')
sbit[i] = 2;
else
sbit[i] = 1;
--
Aharon (Arnold) Robbins --- Pioneer Consulting Ltd. address@hidden
P.O. Box 354 Home Phone: +972 8 979-0381 Fax: +1 603 761-6761
Nof Ayalon Cell Phone: +972 51 297-545 (See www.efax.com)
D.N. Shimshon 99785 Laundry increases exponentially in the
ISRAEL number of children. -- Miriam Robbins
- Bug Report: \y, \B, \<, \> do not work with _, Servatius Brandt, 2000/12/01
- Re: Bug Report: \y, \B, \<, \> do not work with _,
Aharon Robbins <=
- Re: Bug Report: \y, \B, \<, \> do not work with _, Paul Eggert, 2000/12/04
- Re: Bug Report: \y, \B, \<, \> do not work with _, Akim Demaille, 2000/12/06
- Re: Bug Report: \y, \B, \<, \> do not work with _, Paul Eggert, 2000/12/06
- Re: Bug Report: \y, \B, \<, \> do not work with _, Akim Demaille, 2000/12/07
- Re: Bug Report: \y, \B, \<, \> do not work with _, Eli Zaretskii, 2000/12/10
Re: Bug Report: \y, \B, \<, \> do not work with _, Aharon Robbins, 2000/12/05
Re: Bug Report: \y, \B, \<, \> do not work with _, Aharon Robbins, 2000/12/07