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 1QOFlX-0000Ci-2u for garchives@archives.gentoo.org; Sun, 22 May 2011 21:00:47 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id BF9731C08D; Sun, 22 May 2011 21:00:24 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 785F41C08D for ; Sun, 22 May 2011 21:00:24 +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 CABE01B4022 for ; Sun, 22 May 2011 21:00:23 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 206C180506 for ; Sun, 22 May 2011 21:00:23 +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: <2abce7d61e0e76f0e116b530ada1e2af244cf1f7.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/libbashWalker.g scripts/command_execution.bash scripts/command_execution.bash.result X-VCS-Directories: scripts/ bashast/ bashast/gunit/ X-VCS-Committer: betelgeuse X-VCS-Committer-Name: Petteri Räty X-VCS-Revision: 2abce7d61e0e76f0e116b530ada1e2af244cf1f7 Date: Sun, 22 May 2011 21:00:23 +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: 790ca5f8c31ec141c06de9d73a3c9c3f commit: 2abce7d61e0e76f0e116b530ada1e2af244cf1f7 Author: Mu Qiao gentoo org> AuthorDate: Wed May 18 13:38:00 2011 +0000 Commit: Petteri R=C3=A4ty gentoo org> CommitDate: Sun May 22 20:42:40 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/libbash.git;a= =3Dcommit;h=3D2abce7d6 Builtin: support export built-in. We do not support command env before the export built-in for now. You also can't override the built-in by defining a function with the same name as it's currently purely a parser level construct. --- bashast/bashast.g | 9 +++++++-- bashast/gunit/pipeline.gunit | 2 +- bashast/libbashWalker.g | 5 +++++ scripts/command_execution.bash | 2 ++ scripts/command_execution.bash.result | 4 ++++ 5 files changed, 19 insertions(+), 3 deletions(-) diff --git a/bashast/bashast.g b/bashast/bashast.g index 2a8e20b..48ae78d 100644 --- a/bashast/bashast.g +++ b/bashast/bashast.g @@ -134,7 +134,11 @@ simple_command | variable_definitions -> ^(VARIABLE_DEFINITIONS variable_definitions) | bash_command^ redirect*; variable_definitions - : (LOCAL BLANK!+)? var_def (BLANK!+ var_def)*; + : (LOCAL BLANK!+)? var_def (BLANK!+ var_def)* + | EXPORT! (BLANK!+ export_item)+; +export_item + :var_def + |name ->; bash_command : fname_no_res_word (BLANK+ fname)* -> ^(COMMAND fname_no_res_word fnam= e*); redirect: BLANK!* here_string_op^ BLANK!* fname @@ -408,7 +412,7 @@ ns_str_part |OTHER|EQUALS|PCT|PCTPCT|MINUS|DOT|DOTDOT|COLON|TEST_EXPR |TILDE|MUL_ASSIGN|DIVIDE_ASSIGN|MOD_ASSIGN|PLUS_ASSIGN|MINUS_ASSIGN |TIME_POSIX|LSHIFT_ASSIGN|RSHIFT_ASSIGN|AND_ASSIGN|XOR_ASSIGN - |OR_ASSIGN|CARET|POUND|POUNDPOUND|COMMA; + |OR_ASSIGN|CARET|POUND|POUNDPOUND|COMMA|EXPORT; =20 //Generic strings/filenames. fname : (~POUND) =3D> fname_part fname_part* -> ^(STRING fname_part+); @@ -660,6 +664,7 @@ QMARK : '?'; //Operators for conditional statements TEST_EXPR : 'test'; LOCAL : 'local'; +EXPORT : 'export'; LOGICAND : '&&'; LOGICOR : '||'; //Tokens for strings diff --git a/bashast/gunit/pipeline.gunit b/bashast/gunit/pipeline.gunit index 8101566..f2c0cb0 100644 --- a/bashast/gunit/pipeline.gunit +++ b/bashast/gunit/pipeline.gunit @@ -20,7 +20,7 @@ gunit bashast; =20 pipeline: "cat asdf" -> (COMMAND (STRING cat) (STRING asdf)) -"export VAR=3Dbar LAA=3Dlaa" -> (COMMAND (STRING export) (STRING VAR =3D= bar) (STRING LAA =3D laa)) +"export VAR=3Dbar LAA=3Dlaa foo" -> (VARIABLE_DEFINITIONS (=3D VAR (STRI= NG bar)) (=3D LAA (STRING laa))) "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/libbashWalker.g b/bashast/libbashWalker.g index 1ae6616..d781a03 100644 --- a/bashast/libbashWalker.g +++ b/bashast/libbashWalker.g @@ -466,6 +466,11 @@ execute_command[const std::string& name, std::vector= & libbash_args] { walker->set_status(walker->execute_builtin(name, libbash_args)); } + else if(name =3D=3D "export") + { + std::cerr << "We do not support command env before the export builtin= ." << std::endl; + walker->set_status(1); + } else { std::cerr << name << " is not supported yet" << std::endl; diff --git a/scripts/command_execution.bash b/scripts/command_execution.b= ash index 9e1901c..6e655e4 100644 --- a/scripts/command_execution.bash +++ b/scripts/command_execution.bash @@ -15,3 +15,5 @@ true || echo "wrong" echo "end" : ${DEFAULTED:=3D"yes"} FOO=3D"abc" echo "command environment" +export FOO003=3D1 FOO004=3Dabc FOO005=3D(1 2 3) FOO002 +abc=3D1 export foo diff --git a/scripts/command_execution.bash.result b/scripts/command_exec= ution.bash.result index 7ee093d..9f2ba11 100644 --- a/scripts/command_execution.bash.result +++ b/scripts/command_execution.bash.result @@ -4,6 +4,10 @@ right right end command environment +We do not support command env before the export builtin. DEFAULTED=3Dyes FOO001=3Dhello FOO002=3DHello World +FOO003=3D1 +FOO004=3Dabc +FOO005=3D1 2 3