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 1QfBeP-0000De-1A for garchives@archives.gentoo.org; Fri, 08 Jul 2011 14:03:25 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 4994221C181; Fri, 8 Jul 2011 14:03:03 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 1671A21C181 for ; Fri, 8 Jul 2011 14:03:03 +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 8C7CF2AC0EF for ; Fri, 8 Jul 2011 14:03:02 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 4AA1A8004A for ; Fri, 8 Jul 2011 14:03:01 +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: 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: c6f7de39b7e8ea59a02c768af17f9a5c8dc217cd Date: Fri, 8 Jul 2011 14:03:01 +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: 9af1e398a7ff5b9e1c01ab17b5a6af72 commit: c6f7de39b7e8ea59a02c768af17f9a5c8dc217cd Author: Mu Qiao gentoo org> AuthorDate: Tue Jul 5 15:15:34 2011 +0000 Commit: Petteri R=C3=A4ty gentoo org> CommitDate: Tue Jul 5 15:15:34 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/libbash.git;a= =3Dcommit;h=3Dc6f7de39 Merge branch 'multithreading' Makefile.am | 4 +- bashast/libbashWalker.g | 2 +- src/builtins/source_builtin.cpp | 51 +++++++++++-------- src/core/bash_ast.cpp | 39 +++++++++++++- src/core/bash_ast.h | 8 ++- utils/instruo.cpp | 108 ++++++++++++++++++---------------= ------ 6 files changed, 125 insertions(+), 87 deletions(-) diff --cc src/core/bash_ast.h index fb42663,190b020..1dd7be2 --- a/src/core/bash_ast.h +++ b/src/core/bash_ast.h @@@ -63,18 -58,15 +63,18 @@@ class bash_ast: public boost::noncopyab antlr_pointer token_stream; antlr_pointer parser; pANTLR3_BASE_TREE ast; - antlr_pointer nodes; std::function parse; =20 - typedef std::unique_ptr> walker_pointer; + typedef std::unique_ptr> walker_pointer; =20 void init_parser(const std::string& script, const std::string& script= _path); - walker_pointer create_walker(interpreter& walker); + walker_pointer create_walker(interpreter& walker, + antlr_pointer& nodes); =20 public: + /// \brief build AST from istream + /// \param source input source + /// \param p the parser rule for building the AST bash_ast(const std::istream& source, std::function = p=3Dparser_start); =20 @@@ -108,14 -86,15 +108,16 @@@ =20 /// /// \brief interpret the script with a given interpreter - /// \param the interpreter object + /// \param walker the interpreter object + /// \param walk the walker rule to evaluate the AST /// \return the interpreted result template - typename std::result_of::type + typename std::result_of::type interpret_with(interpreter& walker, Functor walk) { - walker_pointer p_tree_parser =3D create_walker(walker); + antlr_pointer nodes( + antlr3CommonTreeNodeStreamNewTree(ast, ANTLR3_SIZE_HINT)); + walker_pointer p_tree_parser =3D create_walker(walker, nodes); return walk(p_tree_parser.get()); } =20