bug-gawk
[Top][All Lists]
Advanced

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

Re: [bug-gawk] posix flag bug?


From: Ed Morton
Subject: Re: [bug-gawk] posix flag bug?
Date: Sat, 26 Sep 2015 13:35:26 -0500
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0

thanks for the quick action. I see do_lint and do_traditional being tested in the fix - does that cover the presence of the "--posix" argument too or is there a missing do_posix variable?

       Ed.

On 9/26/2015 1:29 PM, Aharon Robbins wrote:
Greetings. Re this:

To: address@hidden
From: Ed Morton <address@hidden>
Date: Sat, 26 Sep 2015 08:45:10 -0500
Subject: [bug-gawk] posix flag bug?

Since multi-dimensional arrays are gawk extensions I expected this:

     $ echo 'x' | awk --posix '{arr[1][2]=$0; for (i in arr) for (j in arr[i])
     print arr[i][j]}'
     x

to fail, but clearly it didn't. It didn't fail with the `--traditional` flag
either. Shouldn't it?

      Ed.

P.S. I'm using:

     $ awk --version
     GNU Awk 4.1.3, API: 1.1 (GNU MPFR 3.1.3, GNU MP 6.0.0)

in bash on cygwin.
Here's the fix. It'll get pushed eventually.

Arnold
-----------------------------------------------
diff --git a/awkgram.y b/awkgram.y
index f311f29..db61aa6 100644
--- a/awkgram.y
+++ b/awkgram.y
@@ -3224,6 +3227,10 @@ retry:
                c = nextc(true);
                pushback();
                if (c == '[') {
+                       if (do_traditional)
+                               fatal(_("multidimensional arrays are a gawk 
extension"));
+                       if (do_lint)
+                               lintwarn(_("multidimensional arrays are a gawk 
extension"));
                        yylval = GET_INSTRUCTION(Op_sub_array);
                        lasttok = ']';
                } else {





reply via email to

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