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 1QAEWA-0001VI-S3 for garchives@archives.gentoo.org; Thu, 14 Apr 2011 04:51:05 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 80B201C001; Thu, 14 Apr 2011 04:50:15 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 45C141C001 for ; Thu, 14 Apr 2011 04:50:15 +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 8B1D01B414F for ; Thu, 14 Apr 2011 04:50:14 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id C7E218006D for ; Thu, 14 Apr 2011 04:50:13 +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/array.gunit X-VCS-Directories: bashast/ bashast/gunit/ X-VCS-Committer: betelgeuse X-VCS-Committer-Name: Petteri Räty X-VCS-Revision: d2e5859fb891011512a206e48cec8acf4034dbaa Date: Thu, 14 Apr 2011 04:50:13 +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: 120edc3820aa7df4abb18d4755421b1d commit: d2e5859fb891011512a206e48cec8acf4034dbaa Author: Mu Qiao gentoo org> AuthorDate: Wed Apr 13 01:46:57 2011 +0000 Commit: Petteri R=C3=A4ty gentoo org> CommitDate: Wed Apr 13 01:51:29 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/libbash.git;a= =3Dcommit;h=3Dd2e5859f Unify variable reference AST for arrays Array grammar generate (# name index) for ${#name[index]}, which is different from the usual AST (# (name index)). Now it's unified. --- bashast/bashast.g | 3 ++- bashast/gunit/array.gunit | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/bashast/bashast.g b/bashast/bashast.g index fc847a4..74fd5df 100644 --- a/bashast/bashast.g +++ b/bashast/bashast.g @@ -266,7 +266,8 @@ var_name: num var_name_for_bang : num|name|POUND; var_size_ref - : POUND^ name (LSQUARE! array_size_index RSQUARE!)?; + : POUND name LSQUARE array_size_index RSQUARE -> ^(POUND ^(name array_s= ize_index)) + | POUND^ name; array_size_index : DIGIT+ | (AT|TIMES) -> ARRAY_SIZE; diff --git a/bashast/gunit/array.gunit b/bashast/gunit/array.gunit index f1e87e0..ae5ad6d 100644 --- a/bashast/gunit/array.gunit +++ b/bashast/gunit/array.gunit @@ -34,11 +34,11 @@ var_ref: "${asdf[3]%%word}" -> (VAR_REF (%% (asdf 3) (STRING word))) "${asdf[4]//pattern}" -> (VAR_REF (REPLACE_ALL (asdf 4) (STRING pattern)= )) "${asdf}" -> (VAR_REF asdf) -"${#asdf[0]}" -> (VAR_REF (# asdf 0)) +"${#asdf[0]}" -> (VAR_REF (# (asdf 0))) "${asdf[@]}" -> (VAR_REF (asdf @)) "${asdf[*]}" -> (VAR_REF (asdf *)) -"${#asdf[@]}" -> (VAR_REF (# asdf ARRAY_SIZE)) -"${#asdf[*]}" -> (VAR_REF (# asdf ARRAY_SIZE)) +"${#asdf[@]}" -> (VAR_REF (# (asdf ARRAY_SIZE))) +"${#asdf[*]}" -> (VAR_REF (# (asdf ARRAY_SIZE))) "${asdf[@]:0:1}" -> (VAR_REF (OFFSET (asdf @) 0 1)) "${asdf[*]#path}" -> (VAR_REF (# (asdf *) (STRING path))) "${asdf[@]%word}" -> (VAR_REF (% (asdf @) (STRING word)))