From 8d808f75c0a113ca9ec12cac883435e8f6e28b38 Mon Sep 17 00:00:00 2001 From: Jason Turner Date: Wed, 13 Apr 2016 12:04:55 -0600 Subject: [PATCH] Remove pretty_print functionality --- .../chaiscript/language/chaiscript_common.hpp | 4 +- .../chaiscript/language/chaiscript_eval.hpp | 85 ------------------- 2 files changed, 2 insertions(+), 87 deletions(-) diff --git a/include/chaiscript/language/chaiscript_common.hpp b/include/chaiscript/language/chaiscript_common.hpp index 14b9034..ca29b16 100644 --- a/include/chaiscript/language/chaiscript_common.hpp +++ b/include/chaiscript/language/chaiscript_common.hpp @@ -461,7 +461,7 @@ namespace chaiscript return location.end; } - virtual std::string pretty_print() const + std::string pretty_print() const { std::ostringstream oss; @@ -528,7 +528,7 @@ namespace chaiscript } private: - // Copy and assignment explicitly unimplemented + // Copy and assignment explicitly deleted AST_Node(const AST_Node &) = delete; AST_Node& operator=(const AST_Node &) = delete; }; diff --git a/include/chaiscript/language/chaiscript_eval.hpp b/include/chaiscript/language/chaiscript_eval.hpp index 6ef776b..0b9311d 100644 --- a/include/chaiscript/language/chaiscript_eval.hpp +++ b/include/chaiscript/language/chaiscript_eval.hpp @@ -93,11 +93,6 @@ namespace chaiscript return do_oper(t_ss, m_oper, text, lhs, rhs); } - std::string pretty_print() const override - { - return "(" + this->children[0]->pretty_print() + " " + text + " " + this->children[1]->pretty_print() + ")"; - } - protected: Boxed_Value do_oper(const chaiscript::detail::Dispatch_State &t_ss, Operators::Opers t_oper, const std::string &t_oper_string, const Boxed_Value &t_lhs, const Boxed_Value &t_rhs) const @@ -212,25 +207,6 @@ namespace chaiscript } } - std::string pretty_print() const override - { - std::ostringstream oss; - - int count = 0; - for (const auto &child : this->children) { - oss << child->pretty_print(); - - if (count == 0) - { - oss << "("; - } - ++count; - } - - oss << ")"; - - return oss.str(); - } }; @@ -240,40 +216,12 @@ namespace chaiscript Arg_AST_Node(std::string t_ast_node_text, Parse_Location t_loc, std::vector t_children) : AST_Node(std::move(t_ast_node_text), AST_Node_Type::Arg_List, std::move(t_loc), std::move(t_children)) { } - std::string pretty_print() const override - { - std::ostringstream oss; - for (size_t j = 0; j < this->children.size(); ++j) { - if (j != 0) - { - oss << " "; - } - - oss << this->children[j]->pretty_print(); - } - - return oss.str(); - } }; struct Arg_List_AST_Node final : AST_Node { Arg_List_AST_Node(std::string t_ast_node_text, Parse_Location t_loc, std::vector t_children) : AST_Node(std::move(t_ast_node_text), AST_Node_Type::Arg_List, std::move(t_loc), std::move(t_children)) { } - std::string pretty_print() const override - { - std::ostringstream oss; - for (size_t j = 0; j < this->children.size(); ++j) { - if (j != 0) - { - oss << ", "; - } - - oss << this->children[j]->pretty_print(); - } - - return oss.str(); - } static std::string get_arg_name(const AST_NodePtr &t_node) { if (t_node->children.empty()) @@ -451,10 +399,6 @@ namespace chaiscript } - std::string pretty_print() const override - { - return "var " + this->children[0]->text; - } }; @@ -477,20 +421,6 @@ namespace chaiscript } } - std::string pretty_print() const override - { - std::ostringstream oss; - oss << this->children[0]->pretty_print(); - - for (size_t i = 1; i < this->children.size(); ++i) - { - oss << "["; - oss << this->children[i]->pretty_print(); - oss << "]"; - } - - return oss.str(); - } private: mutable std::atomic_uint_fast32_t m_loc; @@ -886,11 +816,6 @@ namespace chaiscript } } - std::string pretty_print() const override - { - return "[" + AST_Node::pretty_print() + "]"; - } - private: mutable std::atomic_uint_fast32_t m_loc; }; @@ -1327,10 +1252,6 @@ namespace chaiscript && get_bool_condition(children[1]->eval(t_ss))); } - std::string pretty_print() const override - { - return "(" + AST_Node::pretty_print() + ")"; - } }; struct Logical_Or_AST_Node final : AST_Node { @@ -1343,12 +1264,6 @@ namespace chaiscript return const_var(get_bool_condition(children[0]->eval(t_ss)) || get_bool_condition(children[1]->eval(t_ss))); } - - std::string pretty_print() const override - { - return "(" + AST_Node::pretty_print() + ")"; - } - }; }