[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: BUG? report on Gawk
From: |
Aharon Robbins |
Subject: |
Re: BUG? report on Gawk |
Date: |
Fri, 13 Sep 2002 16:53:48 +0200 |
Greetings. Re this:
> Date: Fri, 13 Sep 2002 21:40:48 +0900
> From: address@hidden
> To: address@hidden
> Subject: BUG? report on Gawk
>
> Dear Sir,
>
> I have encountered an parse error using Gawk with following simple program:
>
> { x[1,1] /= 2 }
>
> That is not so serious problem for me, if I only change my program as,
> ' X[1,1] = x[1,1] / 2 '. Multidimensional array may cause this trouble,
> and I could not find any related Changes in the latest Gawk manual.
> I checked in several systems. It seems strange for me, the oldest
> version 3.0.3 works well.
>
> gawk-3.0.3 + multi-byte extension 1.09 on LASER5 Linux (Redhat Linux 6.0
> base)
> : YES
> gawk-3.0.4 + multi-byte extension 1.12 on FreeBSD 3.5.1
> : NO
> gawk-3.1.0 on Redhat Linux 7.2 (originally packaged)
> : NO
> gawk 3.1.1 on Redhat Linux 7.2,(compiled with gcc-2.96-98 )
> : NO
>
> I believe the last version is the latest. Though I do not know this is
> my mistake or any known trouble, I think I should report the problem.
> Thank you for your contribution for the excellent program.
>
> ------------------------------------------------
> KAMIYA, Kenshu
> Department of Physics, School of Science, Kitasato University
> E-mail: address@hidden
Thanks for the bug report. Here is a patch, relative to 3.1.1.
Arnold Robbins
*** awkgram.y.save Tue Apr 16 14:40:13 2002
--- awkgram.y Fri Sep 13 16:51:32 2002
***************
*** 1446,1451 ****
--- 1446,1452 ----
static int lasttok = 0, eof_warned = FALSE;
int inhex = FALSE;
int intlstr = FALSE;
+ static int plain_brackets = 0;
if (nextc() == EOF) {
if (lasttok != NEWLINE) {
***************
*** 1639,1647 ****
case '{':
case ',':
want_assign = FALSE;
! /* fall through */
case '[':
case ']':
return lasttok = c;
case '*':
--- 1640,1655 ----
case '{':
case ',':
want_assign = FALSE;
! return lasttok = c;
!
case '[':
+ plain_brackets++;
+ return lasttok = c;
+
case ']':
+ plain_brackets--;
+ if (plain_brackets == 0)
+ want_assign = TRUE;
return lasttok = c;
case '*':