[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gawk] posix flag bug?
From: |
Aharon Robbins |
Subject: |
Re: [bug-gawk] posix flag bug? |
Date: |
Sat, 26 Sep 2015 21:29:52 +0300 |
User-agent: |
Heirloom mailx 12.5 6/20/10 |
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 {