[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: |
Stepan Kasal |
Subject: |
Re: [gawk] Change in the order of precedence for the redirection operator? |
Date: |
Mon, 31 Oct 2005 12:27:41 +0100 |
User-agent: |
Mutt/1.4.1i |
Hello Arnold,
I cannot fully agree with the reasons you mentioned. First, about *pars1.patch:
> > gawk-20051027-pars1.patch is a small cleanup of the grammar, [...]
> 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, [...]
I agree that the "bug" fixed by *pars1.patch has zero weight.
If the patch has any value, then it is that it actually _simplifies_ the
grammar: the special rule for "! regex" is now gone.
awkgram.y can be made shorter by replacing the code for Node_not by the
straightforward:
{ $$ = node($2, Node_not, (NODE *) NULL); }
I believe the performace hit would be minimal.
See the attached gawk-20051031-pars1a.patch.
Regarding the second of my patches:
On Fri, Oct 28, 2005 at 07:24:44AM +0200, Aharon Robbins wrote:
> > > > gawk 'BEGIN { "echo " "date" | getline; print }'
...
> The problem is that the above is inherently ambiguous, [...]
Yes, it is, in POSIX awk.
But the gawk documentation contains "redirection" in the precedence table.
I believe this forms kind of promise how the above expression will work.
That is why I regretted that I talked you into breaking the backward
compatibility in 3.1.2. (I even recall that I considered the possibility
to "shadow" some nonterminals, and dismissed it as overcomplicated.)
When I thought about it again, I recognized that the pars2.patch was too
complicated; the same can be achieved by adding only one nonterminal.
Attached please find gawk-20051031-pars2a.patch.
Please (re)consider this patch, too.
Have a nice day,
Stepan Kasal
gawk-20051031-pars1a.patch
Description: Text document
gawk-20051031-pars2a.patch
Description: Text document