diff --git a/include/chaiscript/language/chaiscript_eval.hpp b/include/chaiscript/language/chaiscript_eval.hpp index 15cfb8e..bb131c3 100644 --- a/include/chaiscript/language/chaiscript_eval.hpp +++ b/include/chaiscript/language/chaiscript_eval.hpp @@ -471,6 +471,7 @@ namespace chaiscript virtual ~Equation_AST_Node() {} virtual Boxed_Value eval_internal(chaiscript::detail::Dispatch_Engine &t_ss) const CHAISCRIPT_OVERRIDE { + chaiscript::eval::detail::Function_Push_Pop fpp(t_ss); Boxed_Value rhs = this->children[2]->eval(t_ss); Boxed_Value lhs = this->children[0]->eval(t_ss); @@ -488,7 +489,6 @@ namespace chaiscript } try { - chaiscript::eval::detail::Function_Push_Pop fpp(t_ss); if (lhs.is_undef()) { if (!this->children.empty() && @@ -529,7 +529,6 @@ namespace chaiscript } else { try { - chaiscript::eval::detail::Function_Push_Pop fpp(t_ss); return t_ss.call_function(this->children[1]->text, std::move(lhs), rhs); } catch(const exception::dispatch_error &e){ throw exception::eval_error("Unable to find appropriate'" + this->children[1]->text + "' operator.", e.parameters, e.functions, false, t_ss); diff --git a/include/chaiscript/language/chaiscript_parser.hpp b/include/chaiscript/language/chaiscript_parser.hpp index 89dd9df..071a724 100644 --- a/include/chaiscript/language/chaiscript_parser.hpp +++ b/include/chaiscript/language/chaiscript_parser.hpp @@ -296,7 +296,7 @@ namespace chaiscript void build_match(size_t t_match_start, std::string t_text = "") { bool is_deep = false; - Parse_Location filepos = [&](){ + Parse_Location filepos = [&]()->Parse_Location{ //so we want to take everything to the right of this and make them children if (t_match_start != m_match_stack.size()) { is_deep = true; @@ -318,17 +318,15 @@ namespace chaiscript } }(); - std::vector new_children = - [&](){ - if (is_deep) { - std::vector c(std::make_move_iterator(m_match_stack.begin() + static_cast(t_match_start)), - std::make_move_iterator(m_match_stack.end())); - m_match_stack.erase(m_match_stack.begin() + static_cast(t_match_start), m_match_stack.end()); - return c; - } else { - return std::vector(); - } - }(); + std::vector new_children; + + if (is_deep) { + new_children.assign(std::make_move_iterator(m_match_stack.begin() + static_cast(t_match_start)), + std::make_move_iterator(m_match_stack.end())); +// new_children = std::vector(std::make_move_iterator(m_match_stack.begin() + static_cast(t_match_start)), +// std::make_move_iterator(m_match_stack.end())); + m_match_stack.erase(m_match_stack.begin() + static_cast(t_match_start), m_match_stack.end()); + } /// \todo fix the fact that a successful match that captured no ast_nodes doesn't have any real start position m_match_stack.push_back( @@ -738,7 +736,7 @@ namespace chaiscript ++pos; } - Boxed_Value i = [&](){ + Boxed_Value i = [&]()->Boxed_Value{ if (match.length() <= sizeof(int) * 8) { return const_var(static_cast(temp_int));