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 1QBPh5-0002SB-QE for garchives@archives.gentoo.org; Sun, 17 Apr 2011 10:59:08 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 1B0F41C0A1; 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 D8EF81C09D for ; Sun, 17 Apr 2011 10:58:30 +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 4FE9C1B406C for ; Sun, 17 Apr 2011 10:58:30 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 9AA3380076 for ; Sun, 17 Apr 2011 10:58:29 +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: <0827ad788f2799814598c6b013abc2a5da76c703.betelgeuse@gentoo> 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: 0827ad788f2799814598c6b013abc2a5da76c703 Date: Sun, 17 Apr 2011 10:58:29 +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: 88703dbddb2454357db5a5871ae96e6f commit: 0827ad788f2799814598c6b013abc2a5da76c703 Author: Petteri R=C3=A4ty petteriraty eu> AuthorDate: Fri Apr 15 14:27:07 2011 +0000 Commit: Petteri R=C3=A4ty gentoo org> CommitDate: Sun Apr 17 10:44:28 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/libbash.git;a= =3Dcommit;h=3D0827ad78 Parser: blanks in parameter replace pattern We now support replacements like ${foo// }. The white space handling in this area is still insufficient after this change but it gets us further along in parsing versionator. --- bashast/bashast.g | 4 +++- bashast/gunit/param_main.gunit | 1 + 2 files changed, 4 insertions(+), 1 deletions(-) diff --git a/bashast/bashast.g b/bashast/bashast.g index 67353e3..a7d150c 100644 --- a/bashast/bashast.g +++ b/bashast/bashast.g @@ -253,7 +253,9 @@ var_exp : var_name (USE_DEFAULT|USE_ALTERNATE|DISPLAY= _ERROR|ASSIGN_DEFAULT)^ wor | TIMES | AT; parameter_pattern - : ((~SLASH) =3D> fname_part)+ -> ^(STRING fname_part+); + : ((~SLASH) =3D> parameter_pattern_part)+ -> ^(STRING parameter_pattern= _part+); +parameter_pattern_part + : fname_part|BLANK; 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 0d9bd78..8a14dec 100644 --- a/bashast/gunit/param_main.gunit +++ b/bashast/gunit/param_main.gunit @@ -52,6 +52,7 @@ var_ref: "$_" -> (VAR_REF _) "${_}" -> (VAR_REF _) "${PV//./_}" -> (VAR_REF (REPLACE_ALL PV (STRING .) (STRING _))) +"${PV// }" -> (VAR_REF (REPLACE_ALL PV (STRING ))) "${PV//[-._]/}" -> (VAR_REF (REPLACE_ALL PV (STRING (MATCH_PATTERN - . _= )))) "${PV/${pattern}/${replace}}" -> (VAR_REF (REPLACE_FIRST PV (STRING (VAR= _REF pattern)) (STRING (VAR_REF replace)))) "${PV/#foo/bar}" -> (VAR_REF (REPLACE_AT_START PV (STRING foo) (STRING b= ar)))