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 1QoyQQ-0006q4-QY for garchives@archives.gentoo.org; Thu, 04 Aug 2011 13:57:26 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 9E52421C1C5; Thu, 4 Aug 2011 13:53:39 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 731BB21C1C9 for ; Thu, 4 Aug 2011 13:53:39 +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 DFB1A1B403B for ; Thu, 4 Aug 2011 13:53:38 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id CDD1F8004F for ; Thu, 4 Aug 2011 13:53:37 +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: <4fe9d8a7e2655c54dccc651664eda0f22b761707.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/expansions.gunit X-VCS-Directories: bashast/ bashast/gunit/ X-VCS-Committer: betelgeuse X-VCS-Committer-Name: Petteri Räty X-VCS-Revision: 4fe9d8a7e2655c54dccc651664eda0f22b761707 Date: Thu, 4 Aug 2011 13:53:37 +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: 6aaa57ee80fb97f49800fbc08c66f164 commit: 4fe9d8a7e2655c54dccc651664eda0f22b761707 Author: Mu Qiao gentoo org> AuthorDate: Wed Jul 20 12:11:15 2011 +0000 Commit: Petteri R=C3=A4ty gentoo org> CommitDate: Wed Jul 20 15:08:32 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/libbash.git;a= =3Dcommit;h=3D4fe9d8a7 Parser: add rules to perform bash expansions The rule will be called in the walker grammar to perform bash expansions on raw strings. --- bashast/bashast.g | 7 +++++++ bashast/gunit/expansions.gunit | 3 +++ 2 files changed, 10 insertions(+), 0 deletions(-) diff --git a/bashast/bashast.g b/bashast/bashast.g index f712f2e..c54adae 100644 --- a/bashast/bashast.g +++ b/bashast/bashast.g @@ -619,6 +619,13 @@ double_quoted_string_part | (ESC DOLLAR) =3D> ESC DOLLAR -> DOLLAR | ~(TICK|DQUOTE); =20 +// Perform all kinds of expansions +all_expansions + : expansion_atom+ -> ^(STRING expansion_atom+); +expansion_atom + : (DQUOTE) =3D> double_quoted_string + | double_quoted_string_part; + string_part : ns_string_part | SLASH; diff --git a/bashast/gunit/expansions.gunit b/bashast/gunit/expansions.gu= nit index 24c3702..4608994 100644 --- a/bashast/gunit/expansions.gunit +++ b/bashast/gunit/expansions.gunit @@ -30,3 +30,6 @@ echo $each done" -> (LIST (COMMAND (for each (STRING (COMMAND_SUB `ls |grep output`= )) (LIST (COMMAND (STRING echo) (STRING (VAR_REF each))))))) "wc <(cat /usr/share/dict/linux.words)" -> (LIST (COMMAND (STRING wc) (P= ROCESS_SUBSTITUTION < (LIST (COMMAND (STRING cat) (STRING / usr / share /= dict / linux . words)))))) */ + +all_expansions: +"abc $(ab) ${ab} $((ab)) `ab` \"ab\" 'ab'" -> (STRING abc (COMMAND_SUB= $(ab)) (VAR_REF ab) (ARITHMETIC_EXPRESSION (VAR_REF ab)) (COMMAND_= SUB `ab`) (DOUBLE_QUOTED_STRING ab) 'ab')