From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1QAEWb-0001cr-Qf for garchives@archives.gentoo.org; Thu, 14 Apr 2011 04:51:26 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 6C0BA1C029; Thu, 14 Apr 2011 04:50:17 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 3A64A1C030 for ; Thu, 14 Apr 2011 04:50:17 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id E3FEB2AC003 for ; Thu, 14 Apr 2011 04:50:16 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 4D3DF80075 for ; Thu, 14 Apr 2011 04:50:16 +0000 (UTC) From: "Petteri Räty" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Petteri Räty" Message-ID: Subject: [gentoo-commits] proj/libbash:master commit in: bashast/, bashast/gunit/ X-VCS-Repository: proj/libbash X-VCS-Files: bashast/bashast.g bashast/gunit/arith_main.gunit X-VCS-Directories: bashast/ bashast/gunit/ X-VCS-Committer: betelgeuse X-VCS-Committer-Name: Petteri Räty X-VCS-Revision: f751b29c1b6a946da1aa14cdce85f31afeddda4b Date: Thu, 14 Apr 2011 04:50:16 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 921c5729421fdaafdd9e291dfe426da8 commit: f751b29c1b6a946da1aa14cdce85f31afeddda4b Author: Mu Qiao gentoo org> AuthorDate: Wed Apr 13 14:18:59 2011 +0000 Commit: Petteri R=C3=A4ty gentoo org> CommitDate: Thu Apr 14 01:29:58 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/libbash.git;a= =3Dcommit;h=3Df751b29c Support arithmetic assignment for variable expansion Our parser grammar didn't support arithmetic assignment inside variable expansion like $((${foo[5]}=3D3)). Now it's supported. --- bashast/bashast.g | 2 +- bashast/gunit/arith_main.gunit | 3 +++ 2 files changed, 4 insertions(+), 1 deletions(-) diff --git a/bashast/bashast.g b/bashast/bashast.g index 1ef7b1f..ca54570 100644 --- a/bashast/bashast.g +++ b/bashast/bashast.g @@ -484,7 +484,7 @@ arithmetic_assignment_opterator : EQUALS|MUL_ASSIGN|DIVIDE_ASSIGN|MOD_ASSIGN|PLUS_ASSIGN|MINUS_ASSIGN|L= SHIFT_ASSIGN|RSHIFT_ASSIGN|AND_ASSIGN|XOR_ASSIGN|OR_ASSIGN; =20 arithmetic_assignment - : (var_name BLANK!* arithmetic_assignment_opterator^ BLANK!*)? logicor; + : ((var_name|arithmetic_var_ref) BLANK!* arithmetic_assignment_opterato= r^ BLANK!*)? logicor; process_substitution : (dir=3DLESS_THAN|dir=3DGREATER_THAN)LPAREN clist BLANK* RPAREN -> ^(P= ROCESS_SUBSTITUTION $dir clist); //the biggie: functions diff --git a/bashast/gunit/arith_main.gunit b/bashast/gunit/arith_main.gu= nit index 8ead7ef..0f85d55 100644 --- a/bashast/gunit/arith_main.gunit +++ b/bashast/gunit/arith_main.gunit @@ -105,6 +105,9 @@ arithmetic_assignment: "13"->"13" "foo=3D5+3" -> (=3D foo (+ 5 3)) "foo[5]=3D5+3" -> (=3D (foo 5) (+ 5 3)) +"${foo[5]}=3D3" -> (=3D (VAR_REF (VAR_REF (foo 5))) 3) +"${foo[5]}*=3D3" -> (*=3D (VAR_REF (VAR_REF (foo 5))) 3) +"${foo[5]}^=3D3" -> (^=3D (VAR_REF (VAR_REF (foo 5))) 3) "var *=3D 5" -> (*=3D var 5) "var /=3D 5" -> (/=3D var 5) "var %=3D 5" -> (%=3D var 5)