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 1QAEWW-0001ar-4m for garchives@archives.gentoo.org; Thu, 14 Apr 2011 04:51:20 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id D47B51C028; Thu, 14 Apr 2011 04:50:16 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id A37F41C025 for ; Thu, 14 Apr 2011 04:50:16 +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 48ADF1B4160 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 A06EB80073 for ; Thu, 14 Apr 2011 04:50:15 +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: f56ce8a14a3948fa900539344d5ed7c1edd7cf00 Date: Thu, 14 Apr 2011 04:50:15 +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: a06260de32fde830cbf52c776982f922 commit: f56ce8a14a3948fa900539344d5ed7c1edd7cf00 Author: Mu Qiao gentoo org> AuthorDate: Wed Apr 13 13:40:36 2011 +0000 Commit: Petteri R=C3=A4ty gentoo org> CommitDate: Thu Apr 14 01:20:34 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/libbash.git;a= =3Dcommit;h=3Df56ce8a1 Support array element in arithmetic expansion Array element reference and assignment in arithmetic expansion is supported now. --- bashast/bashast.g | 8 ++++++-- bashast/gunit/arith_main.gunit | 3 +++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/bashast/bashast.g b/bashast/bashast.g index 5fc5e7b..f15bec7 100644 --- a/bashast/bashast.g +++ b/bashast/bashast.g @@ -445,7 +445,7 @@ arithmetic primary : num | var_ref | command_sub - | name -> ^(VAR_REF name) + | var_name -> ^(VAR_REF var_name) | LPAREN! (arithmetics) RPAREN!; post_inc_dec : primary BLANK? PLUS PLUS -> ^(POST_INCR primary) @@ -477,8 +477,12 @@ logicor : logicand (BLANK!* LOGICOR^ BLANK!* logican= d)*; =20 arithmetic_condition : cnd=3Dlogicor QMARK t=3Dlogicor COLON f=3Dlogicor -> ^(ARITHMETIC_CON= DITION $cnd $t $f); + +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; + arithmetic_assignment - : (name BLANK!* (EQUALS|MUL_ASSIGN|DIVIDE_ASSIGN|MOD_ASSIGN|PLUS_ASSIGN= |MINUS_ASSIGN|LSHIFT_ASSIGN|RSHIFT_ASSIGN|AND_ASSIGN|XOR_ASSIGN|OR_ASSIGN= )^ BLANK!*)? logicor; + : (var_name BLANK!* arithmetic_assignment_opterator^ 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 5a29849..219cc30 100644 --- a/bashast/gunit/arith_main.gunit +++ b/bashast/gunit/arith_main.gunit @@ -23,6 +23,8 @@ gunit bashast; =20 primary: "3" -> "3" +"foo" -> (VAR_REF foo) +"foo[1]" -> (VAR_REF (foo 1)) =20 post_inc_dec: "b--" -> (POST_DECR (VAR_REF b)) @@ -102,6 +104,7 @@ logicor: arithmetic_assignment: "13"->"13" "foo=3D5+3" -> (=3D foo (+ 5 3)) +"foo[5]=3D5+3" -> (=3D (foo 5) (+ 5 3)) "var *=3D 5" -> (*=3D var 5) "var /=3D 5" -> (/=3D var 5) "var %=3D 5" -> (%=3D var 5)