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 1QoyP5-0006Mu-BY for garchives@archives.gentoo.org; Thu, 04 Aug 2011 13:56:03 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 4B02F21C208; Thu, 4 Aug 2011 13:53:51 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 0F5E321C208 for ; Thu, 4 Aug 2011 13:53:45 +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 76C052AC020 for ; Thu, 4 Aug 2011 13:53:45 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id D22AA80042 for ; Thu, 4 Aug 2011 13:53:44 +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: <1edf5ee2f0f778282b3d967d65a5028844fada29.betelgeuse@gentoo> Subject: [gentoo-commits] proj/libbash:master commit in: scripts/, bashast/, bashast/gunit/ X-VCS-Repository: proj/libbash X-VCS-Files: bashast/bashast.g bashast/gunit/pipeline.gunit bashast/gunit/simp_command.gunit bashast/libbashWalker.g scripts/command_execution.bash X-VCS-Directories: scripts/ bashast/ bashast/gunit/ X-VCS-Committer: betelgeuse X-VCS-Committer-Name: Petteri Räty X-VCS-Revision: 1edf5ee2f0f778282b3d967d65a5028844fada29 Date: Thu, 4 Aug 2011 13:53:44 +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: ff00639e8dd80b2fdcc96db54ea69562 commit: 1edf5ee2f0f778282b3d967d65a5028844fada29 Author: Mu Qiao gentoo org> AuthorDate: Thu Jul 28 07:40:00 2011 +0000 Commit: Petteri R=C3=A4ty gentoo org> CommitDate: Tue Aug 2 07:52:18 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/libbash.git;a= =3Dcommit;h=3D1edf5ee2 Walker: support brace expansion for local and export --- bashast/bashast.g | 4 ++-- bashast/gunit/pipeline.gunit | 2 +- bashast/gunit/simp_command.gunit | 2 +- bashast/libbashWalker.g | 8 +++++--- scripts/command_execution.bash | 1 + 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/bashast/bashast.g b/bashast/bashast.g index cb0a63d..818a598 100644 --- a/bashast/bashast.g +++ b/bashast/bashast.g @@ -379,9 +379,9 @@ command_atom | -> ^(VARIABLE_DEFINITIONS variable_definitions) ) | (EXPORT) =3D> EXPORT BLANK builtin_variable_definition_item - -> ^(STRING EXPORT) ^(STRING ^(DOUBLE_QUOTED_STRING builtin_variable_= definition_item)) + -> ^(STRING EXPORT) ^(STRING builtin_variable_definition_item) | (LOCAL) =3D> LOCAL BLANK builtin_variable_definition_item - -> ^(STRING LOCAL) ^(STRING ^(DOUBLE_QUOTED_STRING builtin_variable_d= efinition_item)) + -> ^(STRING LOCAL) ^(STRING builtin_variable_definition_item) | command_name ( (BLANK? parens) =3D> BLANK? parens wspace? compound_command diff --git a/bashast/gunit/pipeline.gunit b/bashast/gunit/pipeline.gunit index 8f6dd43..aea66f0 100644 --- a/bashast/gunit/pipeline.gunit +++ b/bashast/gunit/pipeline.gunit @@ -20,7 +20,7 @@ gunit java_libbash; =20 pipeline: "cat asdf" -> (COMMAND (STRING cat) (STRING asdf)) -"export VAR=3Dbar LAA=3D(1 2 3) foo" -> (COMMAND (STRING export) (STRING= (DOUBLE_QUOTED_STRING VAR =3D bar LAA =3D ( 1 2 3 ) foo))) +"export VAR=3Dbar LAA=3D(1 2 3) foo" -> (COMMAND (STRING export) (STRING= VAR =3D bar LAA =3D ( 1 2 3 ) foo)) "LOCAL1=3Da LOCAL2=3Db export GLOBAL1=3D2 GLOBAL2 GLOBAL3" -> (COMMAND= (STRING export) (STRING GLOBAL1 =3D 2) (STRING GLOBAL2) (STRING GLOBAL3)= (=3D LOCAL1 (STRING a)) (=3D LOCAL2 (STRING b))) "time -p cat file" -> (COMMAND (STRING cat) (STRING file) (time p)) "time cat file | grep search" -> (| (COMMAND (STRING cat) (STRING file) = time) (COMMAND (STRING grep) (STRING search))) diff --git a/bashast/gunit/simp_command.gunit b/bashast/gunit/simp_comman= d.gunit index 2d98061..e6a8602 100644 --- a/bashast/gunit/simp_command.gunit +++ b/bashast/gunit/simp_command.gunit @@ -27,7 +27,7 @@ command_atom: "./foob=C3=A4r" -> (STRING . / foob =C3=A4 r) "cat ~/Documents/todo.txt" -> (STRING cat) (STRING ~ / Documents / todo = . txt) "dodir ${foo}/${bar}" -> (STRING dodir) (STRING (VAR_REF foo) / (VAR_REF= bar)) -"local a=3D123 b=3D(1 2 3) c" -> (STRING local) (STRING (DOUBLE_QUOTED_S= TRING a =3D 123 b =3D ( 1 2 3 ) c)) +"local a=3D123 b=3D(1 2 3) c" -> (STRING local) (STRING a =3D 123 b =3D= ( 1 2 3 ) c) "echo {}{}}{{{}}{{}" -> (STRING echo) (STRING { } { } } { { { } } { { }) "echo \"ab#af ###\" #abc" -> (STRING echo) (STRING (DOUBLE_QUOTED_STRING= ab # af # # #)) =20 diff --git a/bashast/libbashWalker.g b/bashast/libbashWalker.g index 65fade5..fc05b91 100644 --- a/bashast/libbashWalker.g +++ b/bashast/libbashWalker.g @@ -576,8 +576,10 @@ command_atom simple_command @declarations { std::vector libbash_args; + bool split; } - :string_expr (argument[libbash_args])* execute_command[$string_expr.lib= bash_value, libbash_args]; + :string_expr{ split =3D ($string_expr.libbash_value !=3D "local" && $st= ring_expr.libbash_value !=3D "export"); } + (argument[libbash_args, split])* execute_command[$string_expr.libbash_v= alue, libbash_args]; =20 execute_command[std::string& name, std::vector& libbash_arg= s] @declarations { @@ -664,11 +666,11 @@ redirect_destination_input[std::unique_ptr& in] std::cerr << "FILE_DESCRIPTOR_MOVE redirection is not supported yet" <= < std::endl; }; =20 -argument[std::vector& args] +argument[std::vector& args, bool split] : string_expr { if(!$string_expr.libbash_value.empty()) { - if($string_expr.quoted) + if($string_expr.quoted || !split) args.push_back($string_expr.libbash_value); else walker->split_word($string_expr.libbash_value, args); diff --git a/scripts/command_execution.bash b/scripts/command_execution.b= ash index 1721fa9..a10d229 100644 --- a/scripts/command_execution.bash +++ b/scripts/command_execution.bash @@ -35,6 +35,7 @@ function unset_outer() { local FOO006=3D1 FOO007=3D2 local gjl_${FOO006}=3D"${FOO007}" + local f version install{{site,vendor}{arch,lib},archlib} unset_inner echo "FOO006=3D$FOO006 in unset_outer" echo "FOO007=3D$FOO007 in unset_outer"