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 1QRk8y-0008PQ-UI for garchives@archives.gentoo.org; Wed, 01 Jun 2011 12:03:25 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 25D3F1C0CB; Wed, 1 Jun 2011 12:03:13 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id E47611C0C3 for ; Wed, 1 Jun 2011 12:03:12 +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 721191B4031 for ; Wed, 1 Jun 2011 12:03:12 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id C00F180512 for ; Wed, 1 Jun 2011 12:03:11 +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: <3316cbc65d294bd54022a86ed86433ae7a65fc93.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/brace.gunit X-VCS-Directories: bashast/ bashast/gunit/ X-VCS-Committer: betelgeuse X-VCS-Committer-Name: Petteri Räty X-VCS-Revision: 3316cbc65d294bd54022a86ed86433ae7a65fc93 Date: Wed, 1 Jun 2011 12:03:11 +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: 84194bec32f915a55ce9d49f13163879 commit: 3316cbc65d294bd54022a86ed86433ae7a65fc93 Author: Mu Qiao gentoo org> AuthorDate: Mon May 30 09:25:00 2011 +0000 Commit: Petteri R=C3=A4ty gentoo org> CommitDate: Wed Jun 1 06:12:20 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/libbash.git;a= =3Dcommit;h=3D3316cbc6 Parser: fix brace expansion We need to support expansions like {$a/$b,c}. The previous implementation can not match $a/$b as a whole string. Now it's fixed. --- bashast/bashast.g | 6 ++---- bashast/gunit/brace.gunit | 1 + 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/bashast/bashast.g b/bashast/bashast.g index 88a44cf..104dd36 100644 --- a/bashast/bashast.g +++ b/bashast/bashast.g @@ -180,10 +180,8 @@ brace_expansion_inside range : DIGIT DOTDOT^ DIGIT | LETTER DOTDOT^ LETTER; brace_expansion_part - : brace_expansion - | ((~COMMA) =3D> fname_part)+ -> ^(STRING fname_part+) - | var_ref - | command_sub + : (((~COMMA) =3D> fname_part)+ -> ^(STRING fname_part+))+ + | brace_expansion | -> EMPTY_BRACE_EXPANSION_ATOM; commasep: brace_expansion_part(COMMA! brace_expansion_part)+; command_sub diff --git a/bashast/gunit/brace.gunit b/bashast/gunit/brace.gunit index c9a7ba9..584face 100644 --- a/bashast/gunit/brace.gunit +++ b/bashast/gunit/brace.gunit @@ -20,6 +20,7 @@ gunit bashast; =20 brace_expansion: "{a,b}"-> (BRACE_EXP (STRING a) (STRING b)) +"{$a/$b,b}"-> (BRACE_EXP (STRING (VAR_REF a) / (VAR_REF b)) (STRING b)) "{a,b,c}" -> (BRACE_EXP (STRING a) (STRING b) (STRING c)) "{a..d}" -> (BRACE_EXP (.. a d)) "{{a,b},c,d}" -> (BRACE_EXP (BRACE_EXP (STRING a) (STRING b)) (STRING c)= (STRING d))