🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

3 total messages Started by Cesar Quiroz Mon, 02 Oct 1989 22:29
Unexpected parsing error in Gawk
#464
Author: Cesar Quiroz
Date: Mon, 02 Oct 1989 22:29
37 lines
1828 bytes
Consider the line marked `*' in this program:

    gawk '
    BEGIN                       {   inleader=1; trailers=0  }
    /^[ \t]*$/ && inleader      {   next }
    inleader                    {   inleader = 0; print; next }
*   !inleader && /^[ \t]*$/     {   trailers++; next }
    !inleader                   {   for (i=0; i<trailers; i++) printf "\n";
                                    print; trailers=0; next }
    '

Gnu Awk (gawk) 2.10beta 07 Apr 1989 complains about it:

    gawk:  syntax error near line 5:
    !inleader && /^[ \t]*$/     {   trailers++; next }


                   ^ parse error


However, it parses correctly this version:

    /^[ \t]*$/ && !inleader     {   trailers++; next }

[Aside: indeed, I can just drop the check on inleader in that
script, that is not the point.]  In awk.y, the rule for simp_pattern
is suspect; I don't see how to generate the simple pattern
expression LEX_AND regexp.  Perhaps it would be better to generate
expressions, simple regexps and dynamic regexps.  Then derive
patterns from these three.

Thanks!
-- 
                                      Cesar Augusto Quiroz Gonzalez
                                      Department of Computer Science
                                      University of Rochester
                                      Rochester,  NY 14627
Re: Unexpected parsing error in Gawk
#477
Author: Arnold D. Robbins {EUCC}
Date: Sun, 08 Oct 1989 13:49
16 lines
1115 bytes
In article <1989Oct2.222916.4588@cs.rochester.edu> quiroz@cs.rochester.edu (Cesar Quiroz) writes:
>Consider the line marked `*' in this program:
>
>*   !inleader && /^[ \t]*$/     {   trailers++; next }

This has been fixed in GAWK 2.11, scheduled for release Real Soon Now.

INEWS FODDER
INEWS FODDER
INEWS FODDER
INEWS FODDER
-- 
Arnold Robbins -- Emory U. Information Technology Div.  | Laundry increases
DOMAIN: arnold@emoryu1.cc.emory.edu			| exponentially in the
UUCP: gatech!emoryu1!arnold  PHONE: +1 404 727-7636	| number of children.
BITNET: arnold@emoryu1	     FAX:   +1 404 727-2599	|   -- Miriam Hartholz
Re: Unexpected parsing error in Gawk
#482
Author: Arnold D. Robbins {EUCC}
Date: Tue, 10 Oct 1989 14:12
17 lines
1387 bytes
In article <1989Oct2.222916.4588@cs.rochester.edu> quiroz@cs.rochester.edu (Cesar Quiroz) writes:
}}Consider the line marked `*' in this program:
}}
}}*   !inleader && /^[ \t]*$/     {   trailers++; next }

In article <4422@emory.mathcs.emory.edu> arnold@emory.UUCP (Arnold D. Robbins {EUCC}) writes:
>This has been fixed in GAWK 2.11, scheduled for release Real Soon Now.

Sigh.  I spoke too soon.  It is still broke in 2.11.  But it should be fixed
(I hope) by the time 2.11 is out.

There's Always One More Bug!
-- 
Arnold Robbins -- Emory U. Information Technology Div.  | Laundry increases
DOMAIN: arnold@emoryu1.cc.emory.edu			| exponentially in the
UUCP: gatech!emoryu1!arnold  PHONE: +1 404 727-7636	| number of children.
BITNET: arnold@emoryu1	     FAX:   +1 404 727-2599	|   -- Miriam Hartholz
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads