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 1QoyOB-000626-VK for garchives@archives.gentoo.org; Thu, 04 Aug 2011 13:55:08 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id EC17C21C1D3; Thu, 4 Aug 2011 13:53:40 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id BB7F921C1D0 for ; Thu, 4 Aug 2011 13:53:40 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 005791B4043 for ; Thu, 4 Aug 2011 13:53:40 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 5863A8004A for ; Thu, 4 Aug 2011 13:53:39 +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/param_main.gunit X-VCS-Directories: bashast/ bashast/gunit/ X-VCS-Committer: betelgeuse X-VCS-Committer-Name: Petteri Räty X-VCS-Revision: c5a116f1794e061ea10335b12c6889676d92136b Date: Thu, 4 Aug 2011 13:53:39 +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: 11839b7bc1b5bc4bd1f7afa8cc56ba3e commit: c5a116f1794e061ea10335b12c6889676d92136b Author: Mu Qiao gentoo org> AuthorDate: Thu Jul 21 09:08:33 2011 +0000 Commit: Petteri R=C3=A4ty gentoo org> CommitDate: Tue Aug 2 07:46:29 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/libbash.git;a= =3Dcommit;h=3Dc5a116f1 Parser: allow empty value for sub-array expansion Expansion like ${var::3} is allowed now. --- bashast/bashast.g | 9 +++++++-- bashast/gunit/param_main.gunit | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/bashast/bashast.g b/bashast/bashast.g index 14d7d10..7bb8a8b 100644 --- a/bashast/bashast.g +++ b/bashast/bashast.g @@ -724,8 +724,13 @@ parameter_expansion ( (parameter_value_operator) =3D> parameter_value_operator parameter_ex= pansion_value -> ^(parameter_value_operator variable_name parameter_expansion_valu= e) - | COLON BLANK? os=3Dexplicit_arithmetic (COLON BLANK? len=3Dexplicit_= arithmetic)? - -> ^(OFFSET variable_name $os ^($len)?) + | COLON BLANK? + ( + os=3Dexplicit_arithmetic (COLON BLANK? len=3Dexplicit_arithmetic)? + -> ^(OFFSET variable_name $os ^($len)?) + | COLON BLANK? len=3Dexplicit_arithmetic + -> ^(OFFSET variable_name NUMBER["0"] ^($len)?) + ) | parameter_delete_operator parameter_delete_pattern -> ^(parameter_delete_operator variable_name parameter_delete_patter= n) | parameter_replace_operator parameter_replace_pattern (SLASH paramet= er_expansion_value)? diff --git a/bashast/gunit/param_main.gunit b/bashast/gunit/param_main.gu= nit index 677b566..306d3c6 100644 --- a/bashast/gunit/param_main.gunit +++ b/bashast/gunit/param_main.gunit @@ -29,6 +29,7 @@ variable_reference: "${bar: -10}" -> (VAR_REF (OFFSET bar (MINUS_SIGN 10))) "${bar:(-10 + 5)}" -> (VAR_REF (OFFSET bar (+ (MINUS_SIGN 10) 5))) "${foo:5:2}" -> (VAR_REF (OFFSET foo 5 2)) +"${foo::2}" -> (VAR_REF (OFFSET foo 0 2)) "${foo:$((5)):$((2))}" -> (VAR_REF (OFFSET foo 5 2)) "${!asdf*}" -> (VAR_REF (! asdf *)) "${!asdf@}" -> (VAR_REF (! asdf @))