bug-grep
[Top][All Lists]
Advanced

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

Re: [:space:] bugs in 2.6.3?


From: Aharon Robbins
Subject: Re: [:space:] bugs in 2.6.3?
Date: Fri, 06 Aug 2010 16:32:39 -0400
User-agent: Heirloom mailx 12.4 7/29/08

Hi All.  In old thread with this subject, I was asked if gawk checked
for regexps like [:space:] which should be [[:space:]].  Paolo asked
that I send my reply to the list.

> On 07/06/2010 06:00 AM, Aharon Robbins wrote:
> > Hi Guys.
> >
> > Sorry for the long delay in replying to this thread. To answer Paolo's
> > question, gawk doesn't have warnings at the moment, but it would be
> > a good idea.
> >
> > I suggest that the code be smarter and check exactly the words that
> > are supposed to occur between the colons, so that
> >
> >     grep '[:space:]' ...
> >
> > gets a warning while
> >
> >     grep '[:address@hidden:]'
> >
> > doesn't.  To do this the dfa struct should probably gain an extra member
> > which is a bit flag of possible problems; this way code that is interested
> > can check and print a warning, while code that isn't doesn't have to,
> > and no other interfaces change along the way. It's OK to start out with
> > only one flag and add more over time.
> >
> > A convenience routine to translate the bits into strings would be helpful,
> > too; this way all programs using dfa would report the same error in the
> > same way (at least in English :-).
>
> Arnold,
>
> please write these remarks to bug-grep.  It was lost in my mailbox 
> because it came during my holidays.
>
> Paolo

I have since added some code into the gawk-devel version to check
for this:

$ ./gawk --lint '/foo[:space:]bar/' /dev/null
gawk: warning: regexp component `[:space:]' should probably be `[[:space:]]'
$ ./gawk --lint '/foo[:space:][:junk:]/' /dev/null
gawk: warning: regexp component `[:space:]' should probably be `[[:space:]]'
$ ./gawk --lint '/foo[:space:][:alnum:]/' /dev/null
gawk: warning: regexp component `[:space:]' should probably be `[[:space:]]'
gawk: warning: regexp component `[:alnum:]' should probably be `[[:alnum:]]'
$ ./gawk --lint '/foo[abc[:space:]def]bar/' /dev/null
$ ./gawk --lint '/[^[:space:]][:alnum:]/' /dev/null
gawk: warning: regexp component `[:alnum:]' should probably be `[[:alnum:]]'

Grep is free to borrow the code; it'll be in Savannah within an hour.

Thanks,

Arnold



reply via email to

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