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 1QBPiE-0002fi-II for garchives@archives.gentoo.org; Sun, 17 Apr 2011 11:00:18 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id C53521C0AA; Sun, 17 Apr 2011 10:58:31 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 8D6BF1C0A7 for ; Sun, 17 Apr 2011 10:58:31 +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 1359C1B4026 for ; Sun, 17 Apr 2011 10:58:31 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 484FC80079 for ; Sun, 17 Apr 2011 10:58:30 +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: a41e198778614972aa021d58c1539d6a8cdda8c5 Date: Sun, 17 Apr 2011 10:58:30 +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: ec63e73223dc41acaa2289fb312c5bf4 commit: a41e198778614972aa021d58c1539d6a8cdda8c5 Author: Petteri R=C3=A4ty petteriraty eu> AuthorDate: Fri Apr 15 15:18:46 2011 +0000 Commit: Petteri R=C3=A4ty gentoo org> CommitDate: Sun Apr 17 10:44:35 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/libbash.git;a= =3Dcommit;h=3Da41e1987 Parser: parameter replacements expansions take ; You can now produce patterns like ${foo%; }. With this change we are able to parse versionator.eclass fully. --- bashast/bashast.g | 6 +++--- bashast/gunit/param_main.gunit | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/bashast/bashast.g b/bashast/bashast.g index 46a90c9..036cd3e 100644 --- a/bashast/bashast.g +++ b/bashast/bashast.g @@ -249,8 +249,8 @@ var_exp : var_name (USE_DEFAULT|USE_ALTERNATE|DISPLAY= _ERROR|ASSIGN_DEFAULT)^ wor | BANG^ var_name_for_bang (TIMES|AT) | BANG var_name_for_bang LSQUARE (op=3DTIMES|op=3DAT) RSQUARE -> ^(LIST= _EXPAND var_name_for_bang $op) | BANG var_name_for_bang -> ^(VAR_REF var_name_for_bang) - | var_name (POUND^|POUNDPOUND^) fname - | var_name (PCT^|PCTPCT^) fname + | var_name (POUND^|POUNDPOUND^) parameter_pattern + | var_name (PCT^|PCTPCT^) parameter_pattern | var_name parameter_replace_operator^ parameter_pattern parameter_repl= ace_string | var_size_ref | var_name @@ -259,7 +259,7 @@ var_exp : var_name (USE_DEFAULT|USE_ALTERNATE|DISPLAY= _ERROR|ASSIGN_DEFAULT)^ wor parameter_pattern : ((~SLASH) =3D> parameter_pattern_part)+ -> ^(STRING parameter_pattern= _part+); parameter_pattern_part - : fname_part|BLANK; + : fname_part|BLANK|SEMIC; parameter_replace_string : (SLASH fname|SLASH)? -> fname?; parameter_replace_operator diff --git a/bashast/gunit/param_main.gunit b/bashast/gunit/param_main.gu= nit index 8a14dec..7394b66 100644 --- a/bashast/gunit/param_main.gunit +++ b/bashast/gunit/param_main.gunit @@ -38,6 +38,7 @@ var_ref: "${foo##bar}" -> (VAR_REF (## foo (STRING bar))) "${foo%bar}" -> (VAR_REF (% foo (STRING bar))) "${foo%%bar}" -> (VAR_REF (%% foo (STRING bar))) +"${foo%; *}" -> (VAR_REF (% foo (STRING ; *))) "${this/is/pattern}"->(VAR_REF (REPLACE_FIRST this (STRING is) (STRING p= attern))) //Test positional/special parameters "$1" -> (VAR_REF 1)