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 1QXFpG-0005Qu-IE for garchives@archives.gentoo.org; Thu, 16 Jun 2011 16:53:50 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 9C7D91C09C; Thu, 16 Jun 2011 16:53:28 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 5C2791C097 for ; Thu, 16 Jun 2011 16:53:28 +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 D4B9A64242 for ; Thu, 16 Jun 2011 16:53:27 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id D6CD18004F for ; Thu, 16 Jun 2011 16:53:26 +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: <6911bc054a5684377ab303a3133ca91349675b30.betelgeuse@gentoo> Subject: [gentoo-commits] proj/libbash:master commit in: / X-VCS-Repository: proj/libbash X-VCS-Committer: betelgeuse X-VCS-Committer-Name: Petteri Räty X-VCS-Revision: 6911bc054a5684377ab303a3133ca91349675b30 Date: Thu, 16 Jun 2011 16:53:26 +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: 2cd29353ce4b0cac5efe142b0c2b92a5 commit: 6911bc054a5684377ab303a3133ca91349675b30 Author: Petteri R=C3=A4ty petteriraty eu> AuthorDate: Thu Jun 16 16:49:41 2011 +0000 Commit: Petteri R=C3=A4ty gentoo org> CommitDate: Thu Jun 16 16:49:41 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/libbash.git;a= =3Dcommit;h=3D6911bc05 Merge remote-tracking branch 'mu/bash_options' into review Conflicts: bashast/libbashWalker.g src/core/interpreter.cpp src/core/tests/interpreter_test.cpp bashast/libbashWalker.g | 6 ++- scripts/var_def.bash | 2 +- scripts/var_def.bash.result | 2 +- src/builtins/shopt_builtin.cpp | 4 +- src/builtins/tests/shopt_tests.cpp | 10 +++--- src/core/interpreter.cpp | 55 +++++++++++++++++++++++++++++= +---- src/core/interpreter.h | 18 +++++++---- src/core/tests/interpreter_test.cpp | 19 ++++++++---- utils/variable_printer.cpp | 2 +- 9 files changed, 86 insertions(+), 32 deletions(-) diff --cc bashast/libbashWalker.g index 9d297d2,458dcd8..f74f64e --- a/bashast/libbashWalker.g +++ b/bashast/libbashWalker.g @@@ -247,8 -247,8 +247,8 @@@ bash_pattern[boost::xpressive::sregex&=20 bool do_append =3D false; sregex pattern_list; auto check_extglob =3D [&]() { - if(!walker->get_option("extglob")) + if(!walker->get_additional_option("extglob")) - throw interpreter_exception("Entered extended pattern matching with = extglob disabled"); + throw libbash::interpreter_exception("Entered extended pattern match= ing with extglob disabled"); }; } :^(STRING ( diff --cc src/core/interpreter.cpp index c71233d,eca7987..d34ce96 --- a/src/core/interpreter.cpp +++ b/src/core/interpreter.cpp @@@ -372,20 -413,20 +413,20 @@@ void interpreter::unset(const std::stri } } =20 - bool interpreter::get_option(const std::string& name) const + bool interpreter::get_additional_option(const std::string& name) const { - auto iter =3D bash_options.find(name); - if(iter =3D=3D bash_options.end()) + auto iter =3D additional_options.find(name); + if(iter =3D=3D additional_options.end()) - throw interpreter_exception("Invalid bash option"); + throw libbash::interpreter_exception("Invalid bash option"); =20 return iter->second; } =20 - void interpreter::set_option(const std::string& name, bool value) + void interpreter::set_additional_option(const std::string& name, bool v= alue) { - auto iter =3D bash_options.find(name); - if(iter =3D=3D bash_options.end()) + auto iter =3D additional_options.find(name); + if(iter =3D=3D additional_options.end()) - throw interpreter_exception(name + " is not a valid bash option"); + throw libbash::interpreter_exception(name + " is not a valid bash o= ption"); =20 iter->second =3D value; } diff --cc src/core/tests/interpreter_test.cpp index 678ac00,54971ab..f207bfb --- a/src/core/tests/interpreter_test.cpp +++ b/src/core/tests/interpreter_test.cpp @@@ -240,10 -240,17 +240,17 @@@ TEST(interpreter, bash_additional_optio { interpreter walker; =20 - EXPECT_THROW(walker.set_option("not exist", false), libbash::interpre= ter_exception); - EXPECT_THROW(walker.get_option("not exist"), libbash::interpreter_exc= eption); - EXPECT_THROW(walker.set_additional_option("not exist", false), interp= reter_exception); - EXPECT_THROW(walker.get_additional_option("not exist"), interpreter_e= xception); ++ EXPECT_THROW(walker.set_additional_option("not exist", false), libbas= h::interpreter_exception); ++ EXPECT_THROW(walker.get_additional_option("not exist"), libbash::inte= rpreter_exception); +=20 + EXPECT_FALSE(walker.get_additional_option("extglob")); + walker.set_additional_option("extglob", true); + EXPECT_TRUE(walker.get_additional_option("extglob")); + } +=20 + TEST(interpreter, bash_option) + { + interpreter walker; =20 - EXPECT_FALSE(walker.get_option("extglob")); - walker.set_option("extglob", true); - EXPECT_TRUE(walker.get_option("extglob")); + EXPECT_STREQ("Bh", walker.resolve("-").c_str()); }