[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [gawk] Change in the order of precedence for the redirection operato
From: |
Aharon Robbins |
Subject: |
Re: [gawk] Change in the order of precedence for the redirection operator? |
Date: |
Fri, 28 Oct 2005 07:24:44 +0200 |
Greetings. Re this:
> Date: Thu, 27 Oct 2005 10:53:08 +0200
> From: Stepan Kasal <address@hidden>
> Subject: Re: [gawk] Change in the order of precedence for the redirection
> operator?
> To: Tony Leneis <address@hidden>, address@hidden
>
> Hello,
>
> > > gawk 'BEGIN { "echo " "date" | getline; print }'
>
> as I supposed, this incompatibility was introduced by my patches, which fixed
> other bugs in the parser.
The problem is that the above is inherently ambiguous, and there isn't
agreement as to its meaning among the other awks:
Brian Kernighan's does the concatenation first:
$ nawk 'BEGIN { "echo " "date" | getline; print }'
date
Mike Brennan's mawk does the getline first:
$ mawk 'BEGIN { "echo " "date" | getline; print }'
Fri Oct 28 07:15:01 IST 2005
At 3.1.2 (two years ago!), gawk changed to be like mawk:
$ gawk-3.1.1 'BEGIN { "echo " "date" | getline; print }'
date
$ gawk-3.1.5 'BEGIN { "echo " "date" | getline; print }'
Fri Oct 28 07:19:46 IST 2005
> I wrote two patches; please apply gawk-20051027-pars1.patch first, and
> then gawk-20051027-pars2.patch .
>
> gawk-20051027-pars2.patch fixes the bug quoted above.
>
> gawk-20051027-pars1.patch is a small cleanup of the grammar, which prepares
> it for the other patch. Moreover, it fixes a bug that some expressions
> were not parsed correctly; see the new test file for details.
>
> Arnold, will you accept these patches?
I am inclined at the moment not to accept the patches. They add considerable
complexity to the grammar to fix what is, in my opinion, a corner case, and
one that should be parenthesized anyways. This issue is also documented in
the gawk manual.
Unless Mike is willing to change mawk (or at least tells me I should change
gawk), I am going to leave things alone.
The new test case is interesting, but both the other awks choke on it as
well, and gawk's diagnostics are considerably better, so I still don't
see the patches as providing enough added value to be worth the hassle.
Thanks though,
Arnold
- Re: [gawk] Change in the order of precedence for the redirection operator?,
Aharon Robbins <=