aboutsummaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorMu Qiao <qiaomuf@gentoo.org>2011-04-26 16:22:20 +0800
committerMu Qiao <qiaomuf@gentoo.org>2011-04-28 10:52:42 +0800
commite86cc25a58e07c717606dbfd95d2497a9dd6f638 (patch)
treeafe9d7b8b8a0d8c2d751d9093ed8cc72acd3b389 /utils
parentBuiltin: add interpreter object as a protected member (diff)
downloadlibbash-e86cc25a58e07c717606dbfd95d2497a9dd6f638.tar.gz
libbash-e86cc25a58e07c717606dbfd95d2497a9dd6f638.tar.bz2
libbash-e86cc25a58e07c717606dbfd95d2497a9dd6f638.zip
Core: use reference/pointer for the interpreter object
We don't share interpreter object and it's safer to use reference rather than shared_ptr. Raw pointer is used in the generated C source code.
Diffstat (limited to 'utils')
-rw-r--r--utils/ast_printer.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/utils/ast_printer.cpp b/utils/ast_printer.cpp
index 66d8c8a..dae4233 100644
--- a/utils/ast_printer.cpp
+++ b/utils/ast_printer.cpp
@@ -33,7 +33,7 @@
#include <boost/spirit/include/qi.hpp>
#include <boost/fusion/include/adapt_struct.hpp>
-#include "core/parser_builder.h"
+#include "core/bash_ast.h"
#include "libbashParser.h"
namespace po = boost::program_options;
@@ -50,15 +50,15 @@ BOOST_FUSION_ADAPT_STRUCT(
static void print_ast(std::istream& input, bool silent, bool dot)
{
- parser_builder parser(input);
+ bash_ast ast(input);
if(silent)
return;
if(dot)
- std::cout << parser.get_dot_graph() << std::endl;
+ std::cout << ast.get_dot_graph() << std::endl;
else
- std::cout << parser.get_string_tree() << std::endl;
+ std::cout << ast.get_string_tree() << std::endl;
}
static inline std::string token_mapper(std::unordered_map<ANTLR3_INT32, std::string> token_map,
@@ -90,14 +90,14 @@ static inline void print_token(std::istream& input,
if(silent)
return;
- parser_builder parser(input);
+ bash_ast ast(input);
std::unordered_map<ANTLR3_INT32, std::string> token_map;
if(build_token_map(token_map, token_path))
{
- std::cout << parser.get_tokens(std::bind(&token_mapper,
- token_map,
- std::placeholders::_1))
+ std::cout << ast.get_tokens(std::bind(&token_mapper,
+ token_map,
+ std::placeholders::_1))
<< std::endl;
}
else