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 1QK3iF-0003tJ-0K for garchives@archives.gentoo.org; Wed, 11 May 2011 07:20:03 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id B2EC81C0B7; Wed, 11 May 2011 07:19:35 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 86D251C0B7 for ; Wed, 11 May 2011 07:19:35 +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 DE53A1B40A3 for ; Wed, 11 May 2011 07:19:34 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 4EAAF80506 for ; Wed, 11 May 2011 07:19:34 +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: <68d05d5b690b4ce190b7f789705efd34eb5a4a30.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: 68d05d5b690b4ce190b7f789705efd34eb5a4a30 Date: Wed, 11 May 2011 07:19:34 +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: c47f27afddfc96e594bf0ec1567cd40a commit: 68d05d5b690b4ce190b7f789705efd34eb5a4a30 Author: Petteri R=C3=A4ty petteriraty eu> AuthorDate: Tue May 10 15:19:40 2011 +0000 Commit: Petteri R=C3=A4ty gentoo org> CommitDate: Tue May 10 15:19:40 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/libbash.git;a= =3Dcommit;h=3D68d05d5b Parser: allow white space in replacement strings Now the parser doesn't swallow white spaces from the replacement string in variable expansion and they get reflected properly in the AST. Fixes bug #364119. --- bashast/bashast.g | 4 ++-- bashast/gunit/param_main.gunit | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/bashast/bashast.g b/bashast/bashast.g index 51fe9a9..682d81b 100644 --- a/bashast/bashast.g +++ b/bashast/bashast.g @@ -262,7 +262,7 @@ var_exp : var_name ( -> ^(OFFSET var_name $os ^($len)?) | parameter_delete_operator parameter_pattern_part+ -> ^(parameter_delete_operator var_name ^(STRING parameter_pattern_= part+)) - | parameter_replace_operator parameter_replace_pattern parameter_rep= lace_string + | parameter_replace_operator parameter_replace_pattern (SLASH parame= ter_replace_string?)? -> ^(parameter_replace_operator var_name parameter_replace_pattern = parameter_replace_string?) | -> var_name ) @@ -294,7 +294,7 @@ parameter_replace_pattern parameter_pattern_part : fname_part|BLANK|SEMIC; parameter_replace_string - : (SLASH fname|SLASH)? -> fname?; + : parameter_pattern_part+ -> ^(STRING parameter_pattern_part+); parameter_replace_operator : SLASH SLASH -> REPLACE_ALL | SLASH PCT -> REPLACE_AT_END diff --git a/bashast/gunit/param_main.gunit b/bashast/gunit/param_main.gu= nit index 61cc140..91ed8be 100644 --- a/bashast/gunit/param_main.gunit +++ b/bashast/gunit/param_main.gunit @@ -60,6 +60,8 @@ var_ref: "${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))) "${PV/%foo/bar}" -> (VAR_REF (REPLACE_AT_END PV (STRING foo) (STRING bar= ))) +"${PN/%spaces /more }" -> (VAR_REF (REPLACE_AT_END PN (STRING spaces )= (STRING more ))) +"${PN/wrong#/#correct}" -> (VAR_REF (REPLACE_FIRST PN (STRING wrong #) (= STRING # correct))) =20 var_def: "MY_PN=3D${PN/asterisk-}" -> (=3D MY_PN (STRING (VAR_REF (REPLACE_FIRST = PN (STRING asterisk -)))))