From bd5f92894890f4ee059f42eb683d2c279a82168b Mon Sep 17 00:00:00 2001 From: ArashPartow <partow@gmail.com> Date: Sun, 27 Aug 2017 17:31:37 +1000 Subject: [PATCH] Added fixes for a clean GCC 7.+ compile Added case-sensitivity mode Added error line location in exprtk.hpp for error_t --- src/core/math/extern/exprtk.h | 2266 ++++++++++++++++++++------------- 1 file changed, 1375 insertions(+), 891 deletions(-) diff --git a/src/core/math/extern/exprtk.h b/src/core/math/extern/exprtk.h index 55d682cf6..187763626 100644 --- a/src/core/math/extern/exprtk.h +++ b/src/core/math/extern/exprtk.h @@ -64,6 +64,23 @@ namespace exprtk #define exprtk_debug(params) (void)0 #endif + #define exprtk_error_location \ + "exprtk.hpp:" + details::to_str(__LINE__) \ + + #if __GNUC__ >= 7 + + #define exprtk_disable_fallthrough_begin \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wimplicit-fallthrough\"") \ + + #define exprtk_disable_fallthrough_end \ + _Pragma ("GCC diagnostic pop") \ + + #else + #define exprtk_disable_fallthrough_begin (void)0; + #define exprtk_disable_fallthrough_end (void)0; + #endif + namespace details { typedef unsigned char uchar_t; @@ -141,6 +158,13 @@ namespace exprtk ('\'' != c); } + #ifndef exprtk_disable_caseinsensitivity + inline void case_normalise(std::string& s) + { + std::transform + (s.begin(), s.end(), s.begin(), static_cast<int(*)(int)>(std::tolower)); + } + inline bool imatch(const char_t c1, const char_t c2) { return std::tolower(c1) == std::tolower(c2); @@ -164,6 +188,50 @@ namespace exprtk return false; } + struct ilesscompare + { + inline bool operator() (const std::string& s1, const std::string& s2) const + { + const std::size_t length = std::min(s1.size(),s2.size()); + + for (std::size_t i = 0; i < length; ++i) + { + const char_t c1 = static_cast<char>(std::tolower(s1[i])); + const char_t c2 = static_cast<char>(std::tolower(s2[i])); + + if (c1 > c2) + return false; + else if (c1 < c2) + return true; + } + + return s1.size() < s2.size(); + } + }; + + #else + inline void case_normalise(std::string&) + {} + + inline bool imatch(const char_t c1, const char_t c2) + { + return c1 == c2; + } + + inline bool imatch(const std::string& s1, const std::string& s2) + { + return s1 == s2; + } + + struct ilesscompare + { + inline bool operator() (const std::string& s1, const std::string& s2) const + { + return s1 < s2; + } + }; + #endif + inline bool is_valid_sf_symbol(const std::string& symbol) { // Special function: $f12 or $F34 @@ -174,12 +242,12 @@ namespace exprtk is_digit(symbol[3]); } - inline const char& front(const std::string& s) + inline const char_t& front(const std::string& s) { return s[0]; } - inline const char& back(const std::string& s) + inline const char_t& back(const std::string& s) { return s[s.size() - 1]; } @@ -314,7 +382,7 @@ namespace exprtk return (*this); } - inline build_string& operator << (const char* s) + inline build_string& operator << (const char_t* s) { data_ += std::string(s); return (*this); @@ -335,27 +403,6 @@ namespace exprtk std::string data_; }; - struct ilesscompare - { - inline bool operator()(const std::string& s1, const std::string& s2) const - { - const std::size_t length = std::min(s1.size(),s2.size()); - - for (std::size_t i = 0; i < length; ++i) - { - const char_t c1 = static_cast<char>(std::tolower(s1[i])); - const char_t c2 = static_cast<char>(std::tolower(s2[i])); - - if (c1 > c2) - return false; - else if (c1 < c2) - return true; - } - - return s1.size() < s2.size(); - } - }; - static const std::string reserved_words[] = { "break", "case", "continue", "default", "false", "for", @@ -443,7 +490,7 @@ namespace exprtk { for (std::size_t i = 0; i < reserved_words_size; ++i) { - if (imatch(symbol,reserved_words[i])) + if (imatch(symbol, reserved_words[i])) { return true; } @@ -456,7 +503,7 @@ namespace exprtk { for (std::size_t i = 0; i < reserved_symbols_size; ++i) { - if (imatch(symbol,reserved_symbols[i])) + if (imatch(symbol, reserved_symbols[i])) { return true; } @@ -469,7 +516,7 @@ namespace exprtk { for (std::size_t i = 0; i < base_function_list_size; ++i) { - if (imatch(function_name,base_function_list[i])) + if (imatch(function_name, base_function_list[i])) { return true; } @@ -482,7 +529,7 @@ namespace exprtk { for (std::size_t i = 0; i < cntrl_struct_list_size; ++i) { - if (imatch(cntrl_strct,cntrl_struct_list[i])) + if (imatch(cntrl_strct, cntrl_struct_list[i])) { return true; } @@ -495,7 +542,7 @@ namespace exprtk { for (std::size_t i = 0; i < logic_ops_list_size; ++i) { - if (imatch(lgc_opr,logic_ops_list[i])) + if (imatch(lgc_opr, logic_ops_list[i])) { return true; } @@ -582,29 +629,29 @@ namespace exprtk inline bool wc_match(const std::string& wild_card, const std::string& str) { - return match_impl<const char*,cs_match>(wild_card.data(), - wild_card.data() + wild_card.size(), - str.data(), - str.data() + str.size(), - '*', - '?'); + return match_impl<const char_t*,cs_match>(wild_card.data(), + wild_card.data() + wild_card.size(), + str.data(), + str.data() + str.size(), + '*', + '?'); } inline bool wc_imatch(const std::string& wild_card, const std::string& str) { - return match_impl<const char*,cis_match>(wild_card.data(), - wild_card.data() + wild_card.size(), - str.data(), - str.data() + str.size(), - '*', - '?'); + return match_impl<const char_t*,cis_match>(wild_card.data(), + wild_card.data() + wild_card.size(), + str.data(), + str.data() + str.size(), + '*', + '?'); } inline bool sequence_match(const std::string& pattern, const std::string& str, std::size_t& diff_index, - char& diff_value) + char_t& diff_value) { if (str.empty()) { @@ -1633,6 +1680,7 @@ namespace exprtk if (length <= 4) { + exprtk_disable_fallthrough_begin switch (length) { #ifdef exprtk_use_lut @@ -1666,6 +1714,7 @@ namespace exprtk #undef exprtk_process_digit } + exprtk_disable_fallthrough_end } else return_result = false; @@ -1725,7 +1774,7 @@ namespace exprtk if ((3 != length) && (inf_length != length)) return false; - const char* inf_itr = ('i' == (*itr)) ? inf_lc : inf_uc; + const char_t* inf_itr = ('i' == (*itr)) ? inf_lc : inf_uc; while (end != itr) { @@ -1845,7 +1894,7 @@ namespace exprtk { int exp = 0; - if (!details::string_to_type_converter_impl_ref(++itr,end,exp)) + if (!details::string_to_type_converter_impl_ref(++itr, end, exp)) { if (end == itr) return false; @@ -1868,11 +1917,11 @@ namespace exprtk { if (('i' == (*itr)) || ('I' == (*itr))) { - return parse_inf(itr,end,t,negative); + return parse_inf(itr, end, t, negative); } else if (('n' == (*itr)) || ('N' == (*itr))) { - return parse_nan(itr,end,t); + return parse_nan(itr, end, t); } else return false; @@ -1884,11 +1933,11 @@ namespace exprtk { if (('i' == (*itr)) || ('I' == (*itr))) { - return parse_inf(itr,end,t,negative); + return parse_inf(itr, end, t, negative); } else if (('n' == (*itr)) || ('N' == (*itr))) { - return parse_nan(itr,end,t); + return parse_nan(itr, end, t); } else return false; @@ -1911,9 +1960,11 @@ namespace exprtk template <typename T> inline bool string_to_real(const std::string& s, T& t) { - const char* begin = s.data(); - const char* end = s.data() + s.size(); - typename numeric::details::number_type<T>::type num_type; + const typename numeric::details::number_type<T>::type num_type; + + const char_t* begin = s.data(); + const char_t* end = s.data() + s.size(); + return string_to_real(begin, end, t, num_type); } @@ -1973,13 +2024,15 @@ namespace exprtk } template <typename Iterator> - inline token& set_operator(const token_type tt, const Iterator begin, const Iterator end, const Iterator base_begin = Iterator(0)) + inline token& set_operator(const token_type tt, + const Iterator begin, const Iterator end, + const Iterator base_begin = Iterator(0)) { type = tt; value.assign(begin,end); if (base_begin) position = static_cast<std::size_t>(std::distance(base_begin,begin)); - return *this; + return (*this); } template <typename Iterator> @@ -1989,7 +2042,7 @@ namespace exprtk value.assign(begin,end); if (base_begin) position = static_cast<std::size_t>(std::distance(base_begin,begin)); - return *this; + return (*this); } template <typename Iterator> @@ -1999,7 +2052,7 @@ namespace exprtk value.assign(begin,end); if (base_begin) position = static_cast<std::size_t>(std::distance(base_begin,begin)); - return *this; + return (*this); } template <typename Iterator> @@ -2009,7 +2062,7 @@ namespace exprtk value.assign(begin,end); if (base_begin) position = static_cast<std::size_t>(std::distance(base_begin,begin)); - return *this; + return (*this); } inline token& set_string(const std::string& s, const std::size_t p) @@ -2017,11 +2070,13 @@ namespace exprtk type = e_string; value = s; position = p; - return *this; + return (*this); } template <typename Iterator> - inline token& set_error(const token_type et, const Iterator begin, const Iterator end, const Iterator base_begin = Iterator(0)) + inline token& set_error(const token_type et, + const Iterator begin, const Iterator end, + const Iterator base_begin = Iterator(0)) { if ( (e_error == et) || @@ -2041,7 +2096,7 @@ namespace exprtk if (base_begin) position = static_cast<std::size_t>(std::distance(base_begin,begin)); - return *this; + return (*this); } static inline std::string to_str(token_type t) @@ -2239,8 +2294,8 @@ namespace exprtk inline std::string substr(const std::size_t& begin, const std::size_t& end) { - const char* begin_itr = ((base_itr_ + begin) < s_end_) ? (base_itr_ + begin) : s_end_; - const char* end_itr = ((base_itr_ + end) < s_end_) ? (base_itr_ + end) : s_end_; + const char_t* begin_itr = ((base_itr_ + begin) < s_end_) ? (base_itr_ + begin) : s_end_; + const char_t* end_itr = ((base_itr_ + end) < s_end_) ? (base_itr_ + end) : s_end_; return std::string(begin_itr,end_itr); } @@ -2257,7 +2312,7 @@ namespace exprtk private: - inline bool is_end(const char* itr) + inline bool is_end(const char_t* itr) { return (s_end_ == itr); } @@ -2305,12 +2360,12 @@ namespace exprtk if (is_end(s_itr_) || is_end((s_itr_ + 1))) return; - else if (!test::comment_start(*s_itr_,*(s_itr_ + 1),mode,increment)) + else if (!test::comment_start(*s_itr_, *(s_itr_ + 1), mode, increment)) return; s_itr_ += increment; - while (!is_end(s_itr_) && !test::comment_end(*s_itr_,*(s_itr_ + 1),mode)) + while (!is_end(s_itr_) && !test::comment_end(*s_itr_, *(s_itr_ + 1), mode)) { ++s_itr_; } @@ -2318,8 +2373,9 @@ namespace exprtk if (!is_end(s_itr_)) { s_itr_ += mode; + skip_whitespace(); - skip_comments(); + skip_comments (); } #endif } @@ -2327,8 +2383,7 @@ namespace exprtk inline void scan_token() { skip_whitespace(); - - skip_comments(); + skip_comments (); if (is_end(s_itr_)) { @@ -2427,11 +2482,11 @@ namespace exprtk } if ('<' == c0) - t.set_operator(token_t::e_lt ,s_itr_, s_itr_ + 1, base_itr_); + t.set_operator(token_t::e_lt , s_itr_, s_itr_ + 1, base_itr_); else if ('>' == c0) - t.set_operator(token_t::e_gt ,s_itr_, s_itr_ + 1, base_itr_); + t.set_operator(token_t::e_gt , s_itr_, s_itr_ + 1, base_itr_); else if (';' == c0) - t.set_operator(token_t::e_eof,s_itr_, s_itr_ + 1, base_itr_); + t.set_operator(token_t::e_eof, s_itr_, s_itr_ + 1, base_itr_); else if ('&' == c0) t.set_symbol(s_itr_, s_itr_ + 1, base_itr_); else if ('|' == c0) @@ -2445,7 +2500,7 @@ namespace exprtk inline void scan_symbol() { - const char* initial_itr = s_itr_; + const char_t* initial_itr = s_itr_; while (!is_end(s_itr_)) { @@ -2496,11 +2551,11 @@ namespace exprtk (15) .1234e-3 */ - const char* initial_itr = s_itr_; - bool dot_found = false; - bool e_found = false; - bool post_e_sign_found = false; - bool post_e_digit_found = false; + const char_t* initial_itr = s_itr_; + bool dot_found = false; + bool e_found = false; + bool post_e_sign_found = false; + bool post_e_digit_found = false; token_t t; while (!is_end(s_itr_)) @@ -2519,9 +2574,9 @@ namespace exprtk continue; } - else if (details::imatch('e',(*s_itr_))) + else if ('e' == std::tolower(*s_itr_)) { - const char& c = *(s_itr_ + 1); + const char_t& c = *(s_itr_ + 1); if (is_end(s_itr_ + 1)) { @@ -2583,7 +2638,7 @@ namespace exprtk inline void scan_special_function() { - const char* initial_itr = s_itr_; + const char_t* initial_itr = s_itr_; token_t t; // $fdd(x,x,x) = at least 11 chars @@ -2619,7 +2674,7 @@ namespace exprtk #ifndef exprtk_disable_string_capabilities inline void scan_string() { - const char* initial_itr = s_itr_ + 1; + const char_t* initial_itr = s_itr_ + 1; token_t t; if (std::distance(s_itr_,s_end_) < 2) @@ -2723,9 +2778,9 @@ namespace exprtk token_list_itr_t token_itr_; token_list_itr_t store_token_itr_; token_t eof_token_; - const char* base_itr_; - const char* s_itr_; - const char* s_end_; + const char_t* base_itr_; + const char_t* s_itr_; + const char_t* s_end_; friend class token_scanner; friend class token_modifier; @@ -2786,7 +2841,7 @@ namespace exprtk const token& t0 = g.token_list_[i ]; const token& t1 = g.token_list_[i + 1]; - if (!operator()(t0,t1)) + if (!operator()(t0, t1)) { return i; } @@ -2799,7 +2854,7 @@ namespace exprtk const token& t1 = g.token_list_[i + 1]; const token& t2 = g.token_list_[i + 2]; - if (!operator()(t0,t1,t2)) + if (!operator()(t0, t1, t2)) { return i; } @@ -2813,7 +2868,7 @@ namespace exprtk const token& t2 = g.token_list_[i + 2]; const token& t3 = g.token_list_[i + 3]; - if (!operator()(t0,t1,t2,t3)) + if (!operator()(t0, t1, t2, t3)) { return i; } @@ -2826,22 +2881,22 @@ namespace exprtk return (g.token_list_.size() - stride_ + 1); } - virtual bool operator()(const token&) + virtual bool operator() (const token&) { return false; } - virtual bool operator()(const token&, const token&) + virtual bool operator() (const token&, const token&) { return false; } - virtual bool operator()(const token&, const token&, const token&) + virtual bool operator() (const token&, const token&, const token&) { return false; } - virtual bool operator()(const token&, const token&, const token&, const token&) + virtual bool operator() (const token&, const token&, const token&, const token&) { return false; } @@ -2977,7 +3032,7 @@ namespace exprtk } } - virtual bool join(const token&, const token&, token&) { return false; } + virtual bool join(const token&, const token&, token&) { return false; } virtual bool join(const token&, const token&, const token&, token&) { return false; } private: @@ -3327,7 +3382,7 @@ namespace exprtk error_token_.clear(); } - bool operator()(const lexer::token& t) + bool operator() (const lexer::token& t) { if ( !t.value.empty() && @@ -3338,7 +3393,7 @@ namespace exprtk { details::char_t c = t.value[0]; - if (t.type == lexer::token::e_lbracket) stack_.push(std::make_pair(')',t.position)); + if (t.type == lexer::token::e_lbracket ) stack_.push(std::make_pair(')',t.position)); else if (t.type == lexer::token::e_lcrlbracket) stack_.push(std::make_pair('}',t.position)); else if (t.type == lexer::token::e_lsqrbracket) stack_.push(std::make_pair(']',t.position)); else if (exprtk::details::is_right_bracket(c)) @@ -3394,7 +3449,7 @@ namespace exprtk current_index_ = 0; } - bool operator()(const lexer::token& t) + bool operator() (const lexer::token& t) { if (token::e_number == t.type) { @@ -3445,7 +3500,7 @@ namespace exprtk bool remove(const std::string& target_symbol) { - replace_map_t::iterator itr = replace_map_.find(target_symbol); + const replace_map_t::iterator itr = replace_map_.find(target_symbol); if (replace_map_.end() == itr) return false; @@ -3459,7 +3514,7 @@ namespace exprtk const std::string& replace_symbol, const lexer::token::token_type token_type = lexer::token::e_symbol) { - replace_map_t::iterator itr = replace_map_.find(target_symbol); + const replace_map_t::iterator itr = replace_map_.find(target_symbol); if (replace_map_.end() != itr) { @@ -3485,7 +3540,7 @@ namespace exprtk if (replace_map_.empty()) return false; - replace_map_t::iterator itr = replace_map_.find(t.value); + const replace_map_t::iterator itr = replace_map_.find(t.value); if (replace_map_.end() != itr) { @@ -3546,7 +3601,7 @@ namespace exprtk return error_list_.empty(); } - bool operator()(const lexer::token& t0, const lexer::token& t1) + bool operator() (const lexer::token& t0, const lexer::token& t1) { set_t::value_type p = std::make_pair(t0.type,t1.type); @@ -3679,7 +3734,7 @@ namespace exprtk inline bool register_scanner(lexer::token_scanner* scanner) { if (token_scanner_list.end() != std::find(token_scanner_list.begin(), - token_scanner_list.end(), + token_scanner_list.end (), scanner)) { return false; @@ -3693,7 +3748,7 @@ namespace exprtk inline bool register_modifier(lexer::token_modifier* modifier) { if (token_modifier_list.end() != std::find(token_modifier_list.begin(), - token_modifier_list.end(), + token_modifier_list.end (), modifier)) { return false; @@ -3707,7 +3762,7 @@ namespace exprtk inline bool register_joiner(lexer::token_joiner* joiner) { if (token_joiner_list.end() != std::find(token_joiner_list.begin(), - token_joiner_list.end(), + token_joiner_list.end (), joiner)) { return false; @@ -3721,7 +3776,7 @@ namespace exprtk inline bool register_inserter(lexer::token_inserter* inserter) { if (token_inserter_list.end() != std::find(token_inserter_list.begin(), - token_inserter_list.end(), + token_inserter_list.end (), inserter)) { return false; @@ -4066,8 +4121,8 @@ namespace exprtk enum store_type { e_unknown, - e_scalar, - e_vector, + e_scalar , + e_vector , e_string }; @@ -4195,12 +4250,12 @@ namespace exprtk : v_(*reinterpret_cast<value_t*>(const_cast<type_store_t&>(ts).data)) {} - inline value_t& operator()() + inline value_t& operator() () { return v_; } - inline const value_t& operator()() const + inline const value_t& operator() () const { return v_; } @@ -4426,7 +4481,7 @@ namespace exprtk { details(const std::size_t& vsize, const unsigned int loop_batch_size = global_loop_batch_size) - : batch_size(loop_batch_size), + : batch_size(loop_batch_size ), remainder (vsize % batch_size), upper_bound(static_cast<int>(vsize - (remainder ? loop_batch_size : 0))) {} @@ -4492,7 +4547,7 @@ namespace exprtk { dump_ptr("~control_block() data",data); delete[] data; - data = 0; + data = reinterpret_cast<data_t>(0); } } @@ -4501,12 +4556,12 @@ namespace exprtk if (dsize) { if (0 == data_ptr) - return new control_block(dsize); + return (new control_block(dsize)); else - return new control_block(dsize, data_ptr, dstrct); + return (new control_block(dsize, data_ptr, dstrct)); } else - return new control_block; + return (new control_block); } static inline void destroy(control_block*& cntrl_blck) @@ -4587,7 +4642,7 @@ namespace exprtk } } - return *this; + return (*this); } inline data_t data() @@ -5143,10 +5198,17 @@ namespace exprtk return; node_allocator.free(node); - node = 0; + node = reinterpret_cast<expression_node<T>*>(0); } } + template <typename T> + inline void destroy_node(expression_node<T>*& node) + { + delete node; + node = reinterpret_cast<expression_node<T>*>(0); + } + template <typename Type> class vector_holder { @@ -5160,7 +5222,7 @@ namespace exprtk { public: - virtual ~vector_holder_base(){} + virtual ~vector_holder_base() {} inline value_ptr operator[](const std::size_t& index) const { @@ -5330,7 +5392,7 @@ namespace exprtk void set_ref(value_ptr* ref) { - return vector_holder_base_->set_ref(ref); + vector_holder_base_->set_ref(ref); } bool rebaseable() const @@ -5377,8 +5439,7 @@ namespace exprtk { if (branch_ && branch_deletable_) { - delete branch_; - branch_ = 0; + destroy_node(branch_); } } @@ -5442,7 +5503,7 @@ namespace exprtk private: literal_node(literal_node<T>&) {} - literal_node<T>& operator=(literal_node<T>&) { return *this; } + literal_node<T>& operator=(literal_node<T>&) { return (*this); } const T value_; }; @@ -5481,7 +5542,7 @@ namespace exprtk virtual std::string str () const = 0; - virtual const char* base() const = 0; + virtual const char_t* base() const = 0; virtual std::size_t size() const = 0; }; @@ -5524,7 +5585,7 @@ namespace exprtk return value_; } - const char* base() const + const char_t* base() const { return value_.data(); } @@ -5572,8 +5633,7 @@ namespace exprtk { if (branch_ && branch_deletable_) { - delete branch_; - branch_ = 0; + destroy_node(branch_); } } @@ -5666,8 +5726,7 @@ namespace exprtk { if (branch[i].first && branch[i].second) { - delete branch[i].first; - branch[i].first = 0; + destroy_node(branch[i].first); } } } @@ -5681,8 +5740,7 @@ namespace exprtk { if (branch[i].first && branch[i].second) { - delete branch[i].first; - branch[i].first = 0; + destroy_node(branch[i].first); } } } @@ -5910,9 +5968,20 @@ namespace exprtk ~conditional_node() { - if (test_ && test_deletable_ ) delete test_; - if (consequent_ && consequent_deletable_ ) delete consequent_; - if (alternative_ && alternative_deletable_) delete alternative_; + if (test_ && test_deletable_) + { + destroy_node(test_); + } + + if (consequent_ && consequent_deletable_ ) + { + destroy_node(consequent_); + } + + if (alternative_ && alternative_deletable_) + { + destroy_node(alternative_); + } } inline T value() const @@ -5956,8 +6025,15 @@ namespace exprtk ~cons_conditional_node() { - if (test_ && test_deletable_ ) delete test_; - if (consequent_ && consequent_deletable_) delete consequent_; + if (test_ && test_deletable_) + { + destroy_node(test_); + } + + if (consequent_ && consequent_deletable_) + { + destroy_node(consequent_); + } } inline T value() const @@ -6013,7 +6089,7 @@ namespace exprtk { if (return_deletable_) { - delete return_; + destroy_node(return_); } } @@ -6074,12 +6150,12 @@ namespace exprtk { if (condition_ && condition_deletable_) { - delete condition_; + destroy_node(condition_); } if (loop_body_ && loop_body_deletable_) { - delete loop_body_; + destroy_node(loop_body_); } } @@ -6126,12 +6202,12 @@ namespace exprtk { if (condition_ && condition_deletable_) { - delete condition_; + destroy_node(condition_); } if (loop_body_ && loop_body_deletable_) { - delete loop_body_; + destroy_node(loop_body_); } } @@ -6173,9 +6249,9 @@ namespace exprtk expression_ptr incrementor, expression_ptr loop_body) : initialiser_(initialiser), - condition_ (condition), + condition_ (condition ), incrementor_(incrementor), - loop_body_ (loop_body), + loop_body_ (loop_body ), initialiser_deletable_(branch_deletable(initialiser_)), condition_deletable_ (branch_deletable(condition_ )), incrementor_deletable_(branch_deletable(incrementor_)), @@ -6186,22 +6262,22 @@ namespace exprtk { if (initialiser_ && initialiser_deletable_) { - delete initialiser_; + destroy_node(initialiser_); } if (condition_ && condition_deletable_) { - delete condition_; + destroy_node(condition_); } if (incrementor_ && incrementor_deletable_) { - delete incrementor_; + destroy_node(incrementor_); } if (loop_body_ && loop_body_deletable_) { - delete loop_body_; + destroy_node(loop_body_); } } @@ -6267,12 +6343,12 @@ namespace exprtk { if (condition_ && condition_deletable_) { - delete condition_; + destroy_node(condition_); } if (loop_body_ && loop_body_deletable_) { - delete loop_body_; + destroy_node(loop_body_); } } @@ -6328,12 +6404,12 @@ namespace exprtk { if (condition_ && condition_deletable_) { - delete condition_; + destroy_node(condition_); } if (loop_body_ && loop_body_deletable_) { - delete loop_body_; + destroy_node(loop_body_); } } @@ -6397,22 +6473,22 @@ namespace exprtk { if (initialiser_ && initialiser_deletable_) { - delete initialiser_; + destroy_node(initialiser_); } if (condition_ && condition_deletable_) { - delete condition_; + destroy_node(condition_); } if (incrementor_ && incrementor_deletable_) { - delete incrementor_; + destroy_node(incrementor_); } if (loop_body_ && loop_body_deletable_) { - delete loop_body_; + destroy_node(loop_body_); } } @@ -6518,8 +6594,7 @@ namespace exprtk { if (arg_list_[i] && delete_branch_[i]) { - delete arg_list_[i]; - arg_list_[i] = 0; + destroy_node(arg_list_[i]); } } } @@ -6616,8 +6691,7 @@ namespace exprtk { if (arg_list_[i] && delete_branch_[i]) { - delete arg_list_[i]; - arg_list_[i] = 0; + destroy_node(arg_list_[i]); } } } @@ -6753,8 +6827,7 @@ namespace exprtk !is_string_node (n0_e.second) ) { - delete n0_e.second; - n0_e.second = expression_node_ptr(0); + destroy_node(n0_e.second); } } @@ -6767,8 +6840,7 @@ namespace exprtk !is_string_node (n1_e.second) ) { - delete n1_e.second; - n1_e.second = expression_node_ptr(0); + destroy_node(n1_e.second); } } } @@ -6785,7 +6857,7 @@ namespace exprtk (!n0_c.first && !n1_c.first); } - bool operator()(std::size_t& r0, std::size_t& r1, const std::size_t& size = std::numeric_limits<std::size_t>::max()) const + bool operator() (std::size_t& r0, std::size_t& r1, const std::size_t& size = std::numeric_limits<std::size_t>::max()) const { if (n0_c.first) r0 = n0_c.second; @@ -6986,7 +7058,7 @@ namespace exprtk { if (index_ && index_deletable_) { - delete index_; + destroy_node(index_); } } @@ -7047,7 +7119,7 @@ namespace exprtk { if (index_ && index_deletable_) { - delete index_; + destroy_node(index_); } } @@ -7158,7 +7230,7 @@ namespace exprtk { if (branch_deletable(initialiser_list_[i])) { - delete initialiser_list_[i]; + destroy_node(initialiser_list_[i]); } } } @@ -7247,7 +7319,7 @@ namespace exprtk typedef ivariable<T>* ivariable_ptr; swap_generic_node(expression_ptr var0, expression_ptr var1) - : binary_node<T>(details::e_swap,var0,var1), + : binary_node<T>(details::e_swap, var0, var1), var0_(dynamic_cast<ivariable_ptr>(var0)), var1_(dynamic_cast<ivariable_ptr>(var1)) {} @@ -7281,7 +7353,7 @@ namespace exprtk swap_vecvec_node(expression_ptr branch0, expression_ptr branch1) - : binary_node<T>(details::e_swap,branch0,branch1), + : binary_node<T>(details::e_swap, branch0, branch1), vec0_node_ptr_(0), vec1_node_ptr_(0), vec_size_ (0), @@ -7420,7 +7492,7 @@ namespace exprtk return ref(); } - const char* base() const + const char_t* base() const { return &(*value_)[0]; } @@ -7500,7 +7572,7 @@ namespace exprtk return (*value_); } - const char* base() const + const char_t* base() const { return &(*value_)[0]; } @@ -7578,7 +7650,7 @@ namespace exprtk return value_; } - const char* base() const + const char_t* base() const { return value_.data(); } @@ -7666,8 +7738,7 @@ namespace exprtk if (branch_ && branch_deletable_) { - delete branch_; - branch_ = 0; + destroy_node(branch_); } } @@ -7709,7 +7780,7 @@ namespace exprtk return value_; } - const char* base() const + const char_t* base() const { return &value_[0]; } @@ -7763,7 +7834,7 @@ namespace exprtk string_concat_node(const operator_type& opr, expression_ptr branch0, expression_ptr branch1) - : binary_node<T>(opr,branch0,branch1), + : binary_node<T>(opr, branch0, branch1), initialised_(false), str0_base_ptr_ (0), str1_base_ptr_ (0), @@ -7848,7 +7919,7 @@ namespace exprtk return value_; } - const char* base() const + const char_t* base() const { return &value_[0]; } @@ -7900,7 +7971,7 @@ namespace exprtk typedef irange_t* irange_ptr; swap_string_node(expression_ptr branch0, expression_ptr branch1) - : binary_node<T>(details::e_swap,branch0,branch1), + : binary_node<T>(details::e_swap, branch0, branch1), initialised_(false), str0_node_ptr_(0), str1_node_ptr_(0) @@ -7936,7 +8007,7 @@ namespace exprtk return str0_node_ptr_->str(); } - const char* base() const + const char_t* base() const { return str0_node_ptr_->base(); } @@ -7982,7 +8053,7 @@ namespace exprtk swap_genstrings_node(expression_ptr branch0, expression_ptr branch1) - : binary_node<T>(details::e_default,branch0,branch1), + : binary_node<T>(details::e_default, branch0, branch1), str0_base_ptr_ (0), str1_base_ptr_ (0), str0_range_ptr_(0), @@ -8050,11 +8121,11 @@ namespace exprtk const std::size_t size1 = range1.cache_size(); const std::size_t max_size = std::min(size0,size1); - char* s0 = const_cast<char*>(str0_base_ptr_->base() + str0_r0); - char* s1 = const_cast<char*>(str1_base_ptr_->base() + str1_r0); + char_t* s0 = const_cast<char_t*>(str0_base_ptr_->base() + str0_r0); + char_t* s1 = const_cast<char_t*>(str1_base_ptr_->base() + str1_r0); loop_unroll::details lud(max_size); - const char* upper_bound = s0 + lud.upper_bound; + const char_t* upper_bound = s0 + lud.upper_bound; while (s0 < upper_bound) { @@ -8078,6 +8149,7 @@ namespace exprtk int i = 0; + exprtk_disable_fallthrough_begin switch (lud.remainder) { #define case_stmt(N) \ @@ -8094,6 +8166,7 @@ namespace exprtk case_stmt( 3) case_stmt( 2) case_stmt( 1) } + exprtk_disable_fallthrough_end #undef exprtk_loop #undef case_stmt @@ -8179,8 +8252,7 @@ namespace exprtk { if (branch_ && branch_deletable_) { - delete branch_; - branch_ = 0; + destroy_node(branch_); } } @@ -8211,13 +8283,13 @@ namespace exprtk struct asn_assignment { - static inline void execute(std::string& s, const char* data, const std::size_t size) + static inline void execute(std::string& s, const char_t* data, const std::size_t size) { s.assign(data,size); } }; struct asn_addassignment { - static inline void execute(std::string& s, const char* data, const std::size_t size) + static inline void execute(std::string& s, const char_t* data, const std::size_t size) { s.append(data,size); } }; @@ -8239,7 +8311,7 @@ namespace exprtk assignment_string_node(const operator_type& opr, expression_ptr branch0, expression_ptr branch1) - : binary_node<T>(opr,branch0,branch1), + : binary_node<T>(opr, branch0, branch1), initialised_(false), str0_base_ptr_ (0), str1_base_ptr_ (0), @@ -8285,7 +8357,7 @@ namespace exprtk range_t& range = (*str1_range_ptr_); - if (range(r0,r1,str1_base_ptr_->size())) + if (range(r0, r1, str1_base_ptr_->size())) { AssignmentProcess::execute(str0_node_ptr_->ref(), str1_base_ptr_->base() + r0, @@ -8303,7 +8375,7 @@ namespace exprtk return str0_node_ptr_->str(); } - const char* base() const + const char_t* base() const { return str0_node_ptr_->base(); } @@ -8355,7 +8427,7 @@ namespace exprtk assignment_string_range_node(const operator_type& opr, expression_ptr branch0, expression_ptr branch1) - : binary_node<T>(opr,branch0,branch1), + : binary_node<T>(opr, branch0, branch1), initialised_(false), str0_base_ptr_ (0), str1_base_ptr_ (0), @@ -8416,15 +8488,15 @@ namespace exprtk range_t& range1 = (*str1_range_ptr_); if ( - range0(s0_r0,s0_r1,str0_base_ptr_->size()) && - range1(s1_r0,s1_r1,str1_base_ptr_->size()) + range0(s0_r0, s0_r1, str0_base_ptr_->size()) && + range1(s1_r0, s1_r1, str1_base_ptr_->size()) ) { std::size_t size = std::min((s0_r1 - s0_r0),(s1_r1 - s1_r0)) + 1; std::copy(str1_base_ptr_->base() + s1_r0, str1_base_ptr_->base() + s1_r0 + size, - const_cast<char*>(base() + s0_r0)); + const_cast<char_t*>(base() + s0_r0)); } } @@ -8436,7 +8508,7 @@ namespace exprtk return str0_node_ptr_->str(); } - const char* base() const + const char_t* base() const { return str0_node_ptr_->base(); } @@ -8590,7 +8662,7 @@ namespace exprtk return value_; } - const char* base() const + const char_t* base() const { return &value_[0]; } @@ -8646,7 +8718,7 @@ namespace exprtk cons_conditional_str_node(expression_ptr test, expression_ptr consequent) - : binary_node<T>(details::e_default,consequent,test), + : binary_node<T>(details::e_default, consequent, test), initialised_(false), str0_base_ptr_ (0), str0_range_ptr_(0), @@ -8710,7 +8782,7 @@ namespace exprtk return value_; } - const char* base() const + const char_t* base() const { return &value_[0]; } @@ -8815,16 +8887,14 @@ namespace exprtk { if (final_node_ && final_deletable_) { - delete final_node_; - final_node_ = 0; + destroy_node(final_node_); } for (std::size_t i = 0; i < arg_list_.size(); ++i) { if (arg_list_[i] && delete_branch_[i]) { - delete arg_list_[i]; - arg_list_[i] = 0; + destroy_node(arg_list_[i]); } } } @@ -8846,7 +8916,7 @@ namespace exprtk return str_base_ptr_->str(); } - const char* base() const + const char_t* base() const { return str_base_ptr_->base(); } @@ -9115,7 +9185,7 @@ namespace exprtk expression_ptr branch0, expression_ptr branch1, expression_ptr branch2) - : trinary_node<T>(opr,branch0,branch1,branch2) + : trinary_node<T>(opr, branch0, branch1, branch2) {} inline T value() const @@ -9124,7 +9194,7 @@ namespace exprtk const T y = trinary_node<T>::branch_[1].first->value(); const T z = trinary_node<T>::branch_[2].first->value(); - return SpecialFunction::process(x,y,z); + return SpecialFunction::process(x, y, z); } }; @@ -9140,7 +9210,7 @@ namespace exprtk expression_ptr branch1, expression_ptr branch2, expression_ptr branch3) - : quaternary_node<T>(opr,branch0,branch1,branch2,branch3) + : quaternary_node<T>(opr, branch0, branch1, branch2, branch3) {} inline T value() const @@ -9150,7 +9220,7 @@ namespace exprtk const T z = quaternary_node<T>::branch_[2].first->value(); const T w = quaternary_node<T>::branch_[3].first->value(); - return SpecialFunction::process(x,y,z,w); + return SpecialFunction::process(x, y, z, w); } }; @@ -9169,7 +9239,7 @@ namespace exprtk inline T value() const { - return SpecialFunction::process(v0_,v1_,v2_); + return SpecialFunction::process(v0_, v1_, v2_); } inline typename expression_node<T>::node_type type() const @@ -9203,7 +9273,7 @@ namespace exprtk inline T value() const { - return SpecialFunction::process(v0_,v1_,v2_,v3_); + return SpecialFunction::process(v0_, v1_, v2_, v3_); } inline typename expression_node<T>::node_type type() const @@ -9233,7 +9303,7 @@ namespace exprtk template <typename,typename> class Sequence> vararg_node(const Sequence<expression_ptr,Allocator>& arg_list) { - arg_list_.resize(arg_list.size()); + arg_list_ .resize(arg_list.size()); delete_branch_.resize(arg_list.size()); for (std::size_t i = 0; i < arg_list.size(); ++i) @@ -9258,8 +9328,7 @@ namespace exprtk { if (arg_list_[i] && delete_branch_[i]) { - delete arg_list_[i]; - arg_list_[i] = 0; + destroy_node(arg_list_[i]); } } } @@ -9353,7 +9422,7 @@ namespace exprtk { if (v_ && v_deletable_) { - delete v_; + destroy_node(v_); } } @@ -9390,7 +9459,7 @@ namespace exprtk assignment_node(const operator_type& opr, expression_ptr branch0, expression_ptr branch1) - : binary_node<T>(opr,branch0,branch1), + : binary_node<T>(opr, branch0, branch1), var_node_ptr_(0) { if (is_variable_node(binary_node<T>::branch_[0].first)) @@ -9428,7 +9497,7 @@ namespace exprtk assignment_vec_elem_node(const operator_type& opr, expression_ptr branch0, expression_ptr branch1) - : binary_node<T>(opr,branch0,branch1), + : binary_node<T>(opr, branch0, branch1), vec_node_ptr_(0) { if (is_vector_elem_node(binary_node<T>::branch_[0].first)) @@ -9466,7 +9535,7 @@ namespace exprtk assignment_rebasevec_elem_node(const operator_type& opr, expression_ptr branch0, expression_ptr branch1) - : binary_node<T>(opr,branch0,branch1), + : binary_node<T>(opr, branch0, branch1), rbvec_node_ptr_(0) { if (is_rebasevector_elem_node(binary_node<T>::branch_[0].first)) @@ -9504,7 +9573,7 @@ namespace exprtk assignment_rebasevec_celem_node(const operator_type& opr, expression_ptr branch0, expression_ptr branch1) - : binary_node<T>(opr,branch0,branch1), + : binary_node<T>(opr, branch0, branch1), rbvec_node_ptr_(0) { if (is_rebasevector_celem_node(binary_node<T>::branch_[0].first)) @@ -9545,7 +9614,7 @@ namespace exprtk assignment_vec_node(const operator_type& opr, expression_ptr branch0, expression_ptr branch1) - : binary_node<T>(opr,branch0,branch1), + : binary_node<T>(opr, branch0, branch1), vec_node_ptr_(0) { if (is_vector_node(binary_node<T>::branch_[0].first)) @@ -9585,6 +9654,7 @@ namespace exprtk vec += lud.batch_size; } + exprtk_disable_fallthrough_begin switch (lud.remainder) { #define case_stmt(N) \ @@ -9601,6 +9671,7 @@ namespace exprtk case_stmt( 3) case_stmt( 2) case_stmt( 1) } + exprtk_disable_fallthrough_end #undef exprtk_loop #undef case_stmt @@ -9660,7 +9731,7 @@ namespace exprtk assignment_vecvec_node(const operator_type& opr, expression_ptr branch0, expression_ptr branch1) - : binary_node<T>(opr,branch0,branch1), + : binary_node<T>(opr, branch0, branch1), vec0_node_ptr_(0), vec1_node_ptr_(0), initialised_(false), @@ -9733,6 +9804,7 @@ namespace exprtk vec1 += lud.batch_size; } + exprtk_disable_fallthrough_begin switch (lud.remainder) { #define case_stmt(N) \ @@ -9749,6 +9821,7 @@ namespace exprtk case_stmt( 3) case_stmt( 2) case_stmt( 1) } + exprtk_disable_fallthrough_end #undef exprtk_loop #undef case_stmt @@ -9808,7 +9881,7 @@ namespace exprtk assignment_op_node(const operator_type& opr, expression_ptr branch0, expression_ptr branch1) - : binary_node<T>(opr,branch0,branch1), + : binary_node<T>(opr, branch0, branch1), var_node_ptr_(0) { if (is_variable_node(binary_node<T>::branch_[0].first)) @@ -9845,7 +9918,7 @@ namespace exprtk assignment_vec_elem_op_node(const operator_type& opr, expression_ptr branch0, expression_ptr branch1) - : binary_node<T>(opr,branch0,branch1), + : binary_node<T>(opr, branch0, branch1), vec_node_ptr_(0) { if (is_vector_elem_node(binary_node<T>::branch_[0].first)) @@ -9882,7 +9955,7 @@ namespace exprtk assignment_rebasevec_elem_op_node(const operator_type& opr, expression_ptr branch0, expression_ptr branch1) - : binary_node<T>(opr,branch0,branch1), + : binary_node<T>(opr, branch0, branch1), rbvec_node_ptr_(0) { if (is_rebasevector_elem_node(binary_node<T>::branch_[0].first)) @@ -9919,7 +9992,7 @@ namespace exprtk assignment_rebasevec_celem_op_node(const operator_type& opr, expression_ptr branch0, expression_ptr branch1) - : binary_node<T>(opr,branch0,branch1), + : binary_node<T>(opr, branch0, branch1), rbvec_node_ptr_(0) { if (is_rebasevector_celem_node(binary_node<T>::branch_[0].first)) @@ -9959,7 +10032,7 @@ namespace exprtk assignment_vec_op_node(const operator_type& opr, expression_ptr branch0, expression_ptr branch1) - : binary_node<T>(opr,branch0,branch1), + : binary_node<T>(opr, branch0, branch1), vec_node_ptr_(0) { if (is_vector_node(binary_node<T>::branch_[0].first)) @@ -9999,6 +10072,7 @@ namespace exprtk vec += lud.batch_size; } + exprtk_disable_fallthrough_begin switch (lud.remainder) { #define case_stmt(N) \ @@ -10015,6 +10089,8 @@ namespace exprtk case_stmt( 3) case_stmt( 2) case_stmt( 1) } + exprtk_disable_fallthrough_end + #undef exprtk_loop #undef case_stmt @@ -10079,7 +10155,7 @@ namespace exprtk assignment_vecvec_op_node(const operator_type& opr, expression_ptr branch0, expression_ptr branch1) - : binary_node<T>(opr,branch0,branch1), + : binary_node<T>(opr, branch0, branch1), vec0_node_ptr_(0), vec1_node_ptr_(0), initialised_(false) @@ -10146,6 +10222,7 @@ namespace exprtk int i = 0; + exprtk_disable_fallthrough_begin switch (lud.remainder) { #define case_stmt(N) \ @@ -10162,6 +10239,7 @@ namespace exprtk case_stmt( 3) case_stmt( 2) case_stmt( 1) } + exprtk_disable_fallthrough_end #undef exprtk_loop #undef case_stmt @@ -10229,7 +10307,7 @@ namespace exprtk vec_binop_vecvec_node(const operator_type& opr, expression_ptr branch0, expression_ptr branch1) - : binary_node<T>(opr,branch0,branch1), + : binary_node<T>(opr, branch0, branch1), vec0_node_ptr_(0), vec1_node_ptr_(0), temp_ (0), @@ -10331,6 +10409,7 @@ namespace exprtk int i = 0; + exprtk_disable_fallthrough_begin switch (lud.remainder) { #define case_stmt(N) \ @@ -10347,6 +10426,7 @@ namespace exprtk case_stmt( 3) case_stmt( 2) case_stmt( 1) } + exprtk_disable_fallthrough_end #undef exprtk_loop #undef case_stmt @@ -10411,7 +10491,7 @@ namespace exprtk vec_binop_vecval_node(const operator_type& opr, expression_ptr branch0, expression_ptr branch1) - : binary_node<T>(opr,branch0,branch1), + : binary_node<T>(opr, branch0, branch1), vec0_node_ptr_(0), temp_ (0), temp_vec_node_(0) @@ -10486,6 +10566,7 @@ namespace exprtk int i = 0; + exprtk_disable_fallthrough_begin switch (lud.remainder) { #define case_stmt(N) \ @@ -10502,6 +10583,7 @@ namespace exprtk case_stmt( 3) case_stmt( 2) case_stmt( 1) } + exprtk_disable_fallthrough_end #undef exprtk_loop #undef case_stmt @@ -10564,7 +10646,7 @@ namespace exprtk vec_binop_valvec_node(const operator_type& opr, expression_ptr branch0, expression_ptr branch1) - : binary_node<T>(opr,branch0,branch1), + : binary_node<T>(opr, branch0, branch1), vec1_node_ptr_(0), temp_ (0), temp_vec_node_(0) @@ -10639,6 +10721,7 @@ namespace exprtk int i = 0; + exprtk_disable_fallthrough_begin switch (lud.remainder) { #define case_stmt(N) \ @@ -10655,6 +10738,7 @@ namespace exprtk case_stmt( 3) case_stmt( 2) case_stmt( 1) } + exprtk_disable_fallthrough_end #undef exprtk_loop #undef case_stmt @@ -10715,7 +10799,7 @@ namespace exprtk typedef vec_data_store<T> vds_t; unary_vector_node(const operator_type& opr, expression_ptr branch0) - : unary_node<T>(opr,branch0), + : unary_node<T>(opr, branch0), vec0_node_ptr_(0), temp_ (0), temp_vec_node_(0) @@ -10789,6 +10873,7 @@ namespace exprtk int i = 0; + exprtk_disable_fallthrough_begin switch (lud.remainder) { #define case_stmt(N) \ @@ -10805,6 +10890,7 @@ namespace exprtk case_stmt( 3) case_stmt( 2) case_stmt( 1) } + exprtk_disable_fallthrough_end #undef exprtk_loop #undef case_stmt @@ -10863,7 +10949,7 @@ namespace exprtk scand_node(const operator_type& opr, expression_ptr branch0, expression_ptr branch1) - : binary_node<T>(opr,branch0,branch1) + : binary_node<T>(opr, branch0, branch1) {} inline T value() const @@ -10887,7 +10973,7 @@ namespace exprtk scor_node(const operator_type& opr, expression_ptr branch0, expression_ptr branch1) - : binary_node<T>(opr,branch0,branch1) + : binary_node<T>(opr, branch0, branch1) {} inline T value() const @@ -11250,8 +11336,7 @@ namespace exprtk { if (arg_list_[i] && !details::is_variable_node(arg_list_[i])) { - delete arg_list_[i]; - arg_list_[i] = 0; + destroy_node(arg_list_[i]); } } } @@ -11356,7 +11441,7 @@ namespace exprtk return false; ts.size = sbn->size(); - ts.data = reinterpret_cast<void*>(const_cast<char*>(sbn->base())); + ts.data = reinterpret_cast<void*>(const_cast<char_t*>(sbn->base())); ts.type = type_store_t::e_string; range_list_[i].data = ts.data; @@ -11377,7 +11462,7 @@ namespace exprtk ) { ts.size = rp.const_size(); - ts.data = static_cast<char*>(ts.data) + rp.n0_c.second; + ts.data = static_cast<char_t*>(ts.data) + rp.n0_c.second; range_list_[i].range = reinterpret_cast<range_t*>(0); } else @@ -11459,10 +11544,10 @@ namespace exprtk ts.size = rp.cache_size(); #ifndef exprtk_disable_string_capabilities if (ts.type == type_store_t::e_string) - ts.data = const_cast<char*>(rdt.str_node->base()) + rp.cache.first; + ts.data = const_cast<char_t*>(rdt.str_node->base()) + rp.cache.first; else #endif - ts.data = static_cast<char*>(rdt.data) + (rp.cache.first * rdt.type_size); + ts.data = static_cast<char_t*>(rdt.data) + (rp.cache.first * rdt.type_size); } else return false; @@ -11542,7 +11627,7 @@ namespace exprtk return ret_string_; } - const char* base() const + const char_t* base() const { return &ret_string_[0]; } @@ -11677,7 +11762,7 @@ namespace exprtk typedef type_store<T> generic_type; typedef typename generic_type::parameter_list parameter_list_t; - inline virtual T operator()(parameter_list_t) + inline virtual T operator() (parameter_list_t) { return std::numeric_limits<T>::quiet_NaN(); } @@ -11737,9 +11822,9 @@ namespace exprtk typedef results_context<T> results_context_t; return_envelope_node(expression_ptr body, results_context_t& rc) - : results_context_(&rc), + : results_context_(&rc ), return_invoked_ (false), - body_ (body), + body_ (body ), body_deletable_ (branch_deletable(body_)) {} @@ -11747,7 +11832,7 @@ namespace exprtk { if (body_ && body_deletable_) { - delete body_; + destroy_node(body_); } } @@ -12731,6 +12816,7 @@ namespace exprtk T result = T(0); int i = 0; + exprtk_disable_fallthrough_begin switch (vec_size) { #define case_stmt(N) \ @@ -12747,6 +12833,7 @@ namespace exprtk case_stmt( 4) case_stmt( 3) case_stmt( 2) case_stmt( 1) } + exprtk_disable_fallthrough_end #undef case_stmt @@ -12781,6 +12868,7 @@ namespace exprtk int i = 0; + exprtk_disable_fallthrough_begin switch (lud.remainder) { #define case_stmt(N) \ @@ -12797,6 +12885,7 @@ namespace exprtk case_stmt( 3) case_stmt( 2) case_stmt( 1) } + exprtk_disable_fallthrough_end #undef exprtk_loop #undef case_stmt @@ -12828,6 +12917,7 @@ namespace exprtk T result = T(1); int i = 0; + exprtk_disable_fallthrough_begin switch (vec_size) { #define case_stmt(N) \ @@ -12844,6 +12934,7 @@ namespace exprtk case_stmt( 4) case_stmt( 3) case_stmt( 2) case_stmt( 1) } + exprtk_disable_fallthrough_end #undef case_stmt @@ -12878,6 +12969,7 @@ namespace exprtk int i = 0; + exprtk_disable_fallthrough_begin switch (lud.remainder) { #define case_stmt(N) \ @@ -12894,6 +12986,7 @@ namespace exprtk case_stmt( 3) case_stmt( 2) case_stmt( 1) } + exprtk_disable_fallthrough_end #undef exprtk_loop #undef case_stmt @@ -13207,9 +13300,9 @@ namespace exprtk ufunc_t uf0, ufunc_t uf1, bfunc_t bf) : v0_(var0), v1_(var1), - u0_(uf0), - u1_(uf1), - f_ (bf) + u0_(uf0 ), + u1_(uf1 ), + f_ (bf ) {} inline T value() const @@ -13281,8 +13374,7 @@ namespace exprtk { if (branch_ && branch_deletable_) { - delete branch_; - branch_ = 0; + destroy_node(branch_); } } @@ -13618,13 +13710,15 @@ namespace exprtk T0 p0, T1 p1, bfunc_t p2) { - return allocator.template allocate_type<node_type,T0,T1,bfunc_t&>(p0,p1,p2); + return allocator + .template allocate_type<node_type,T0,T1,bfunc_t&> + (p0, p1, p2); } private: T0oT1(T0oT1<T,T0,T1>&) {} - T0oT1<T,T0,T1>& operator=(T0oT1<T,T0,T1>&) { return *this; } + T0oT1<T,T0,T1>& operator=(T0oT1<T,T0,T1>&) { return (*this); } T0 t0_; T1 t1_; @@ -13704,13 +13798,15 @@ namespace exprtk template <typename Allocator> static inline expression_node<T>* allocate(Allocator& allocator, T0 p0, T1 p1, T2 p2, bfunc_t p3, bfunc_t p4) { - return allocator.template allocate_type<node_type,T0,T1,T2,bfunc_t,bfunc_t>(p0,p1,p2,p3,p4); + return allocator + .template allocate_type<node_type,T0,T1,T2,bfunc_t,bfunc_t> + (p0, p1, p2, p3, p4); } private: T0oT1oT2(node_type&) {} - node_type& operator=(node_type&) { return *this; } + node_type& operator=(node_type&) { return (*this); } T0 t0_; T1 t1_; @@ -13746,7 +13842,7 @@ namespace exprtk inline T value() const { - return ProcessMode::process(t0_,t1_,t2_,t3_,f0_,f1_,f2_); + return ProcessMode::process(t0_, t1_, t2_, t3_, f0_, f1_, f2_); } inline T0 t0() const @@ -13799,13 +13895,15 @@ namespace exprtk T0 p0, T1 p1, T2 p2, T3 p3, bfunc_t p4, bfunc_t p5, bfunc_t p6) { - return allocator.template allocate_type<node_type,T0,T1,T2,T3,bfunc_t,bfunc_t>(p0,p1,p2,p3,p4,p5,p6); + return allocator + .template allocate_type<node_type,T0,T1,T2,T3,bfunc_t,bfunc_t> + (p0, p1, p2, p3, p4, p5, p6); } private: T0oT1oT2oT3(node_type&) {} - node_type& operator=(node_type&) { return *this; } + node_type& operator=(node_type&) { return (*this); } T0 t0_; T1 t1_; @@ -13846,7 +13944,7 @@ namespace exprtk inline T value() const { - return f_(t0_,t1_,t2_); + return f_(t0_, t1_, t2_); } inline T0 t0() const @@ -13882,13 +13980,15 @@ namespace exprtk template <typename Allocator> static inline expression_node<T>* allocate(Allocator& allocator, T0 p0, T1 p1, T2 p2, tfunc_t p3) { - return allocator.template allocate_type<node_type,T0,T1,T2,tfunc_t>(p0,p1,p2,p3); + return allocator + .template allocate_type<node_type,T0,T1,T2,tfunc_t> + (p0, p1, p2, p3); } private: T0oT1oT2_sf3(node_type&) {} - node_type& operator=(node_type&) { return *this; } + node_type& operator=(node_type&) { return (*this); } T0 t0_; T1 t1_; @@ -13940,7 +14040,7 @@ namespace exprtk inline T value() const { - return SF3Operation::process(t0_,t1_,t2_); + return SF3Operation::process(t0_, t1_, t2_); } T0 t0() const @@ -13971,13 +14071,15 @@ namespace exprtk template <typename Allocator> static inline expression_node<T>* allocate(Allocator& allocator, T0 p0, T1 p1, T2 p2) { - return allocator.template allocate_type<node_type,T0,T1,T2>(p0,p1,p2); + return allocator + .template allocate_type<node_type,T0,T1,T2> + (p0, p1, p2); } private: T0oT1oT2_sf3ext(node_type&) {} - node_type& operator=(node_type&) { return *this; } + node_type& operator=(node_type&) { return (*this); } T0 t0_; T1 t1_; @@ -14029,7 +14131,7 @@ namespace exprtk inline T value() const { - return f_(t0_,t1_,t2_,t3_); + return f_(t0_, t1_, t2_, t3_); } inline T0 t0() const @@ -14070,13 +14172,15 @@ namespace exprtk template <typename Allocator> static inline expression_node<T>* allocate(Allocator& allocator, T0 p0, T1 p1, T2 p2, T3 p3, qfunc_t p4) { - return allocator.template allocate_type<node_type,T0,T1,T2,T3,qfunc_t>(p0,p1,p2,p3,p4); + return allocator + .template allocate_type<node_type,T0,T1,T2,T3,qfunc_t> + (p0, p1, p2, p3, p4); } private: T0oT1oT2oT3_sf4(node_type&) {} - node_type& operator=(node_type&) { return *this; } + node_type& operator=(node_type&) { return (*this); } T0 t0_; T1 t1_; @@ -14115,7 +14219,7 @@ namespace exprtk inline T value() const { - return SF4Operation::process(t0_,t1_,t2_,t3_); + return SF4Operation::process(t0_, t1_, t2_, t3_); } inline T0 t0() const @@ -14151,13 +14255,15 @@ namespace exprtk template <typename Allocator> static inline expression_node<T>* allocate(Allocator& allocator, T0 p0, T1 p1, T2 p2, T3 p3) { - return allocator.template allocate_type<node_type,T0,T1,T2,T3>(p0,p1,p2,p3); + return allocator + .template allocate_type<node_type,T0,T1,T2,T3> + (p0, p1, p2, p3); } private: T0oT1oT2oT3_sf4ext(node_type&) {} - node_type& operator=(node_type&) { return *this; } + node_type& operator=(node_type&) { return (*this); } T0 t0_; T1 t1_; @@ -14637,8 +14743,8 @@ namespace exprtk // string-range op string node explicit str_xrox_node(SType0 p0, SType1 p1, RangePack rp0) - : s0_(p0), - s1_(p1), + : s0_ (p0 ), + s1_ (p1 ), rp0_(rp0) {} @@ -14844,7 +14950,7 @@ namespace exprtk str_sogens_node(const operator_type& opr, expression_ptr branch0, expression_ptr branch1) - : binary_node<T>(opr,branch0,branch1), + : binary_node<T>(opr, branch0, branch1), str0_base_ptr_ (0), str1_base_ptr_ (0), str0_range_ptr_(0), @@ -15312,7 +15418,7 @@ namespace exprtk template <typename node_type> inline expression_node<typename node_type::value_type>* allocate() const { - return new node_type(); + return (new node_type()); } template <typename node_type, @@ -15321,89 +15427,89 @@ namespace exprtk template <typename,typename> class Sequence> inline expression_node<typename node_type::value_type>* allocate(const Sequence<Type,Allocator>& seq) const { - return new node_type(seq); + return (new node_type(seq)); } template <typename node_type, typename T1> inline expression_node<typename node_type::value_type>* allocate(T1& t1) const { - return new node_type(t1); + return (new node_type(t1)); } template <typename node_type, typename T1> inline expression_node<typename node_type::value_type>* allocate_c(const T1& t1) const { - return new node_type(t1); + return (new node_type(t1)); } template <typename node_type, typename T1, typename T2> inline expression_node<typename node_type::value_type>* allocate(const T1& t1, const T2& t2) const { - return new node_type(t1,t2); + return (new node_type(t1,t2)); } template <typename node_type, typename T1, typename T2> inline expression_node<typename node_type::value_type>* allocate_cr(const T1& t1, T2& t2) const { - return new node_type(t1,t2); + return (new node_type(t1,t2)); } template <typename node_type, typename T1, typename T2> inline expression_node<typename node_type::value_type>* allocate_rc(T1& t1, const T2& t2) const { - return new node_type(t1,t2); + return (new node_type(t1,t2)); } template <typename node_type, typename T1, typename T2> inline expression_node<typename node_type::value_type>* allocate_rr(T1& t1, T2& t2) const { - return new node_type(t1,t2); + return (new node_type(t1,t2)); } template <typename node_type, typename T1, typename T2> inline expression_node<typename node_type::value_type>* allocate_tt(T1 t1, T2 t2) const { - return new node_type(t1,t2); + return (new node_type(t1,t2)); } template <typename node_type, typename T1, typename T2, typename T3> inline expression_node<typename node_type::value_type>* allocate_ttt(T1 t1, T2 t2, T3 t3) const { - return new node_type(t1,t2,t3); + return (new node_type(t1,t2,t3)); } template <typename node_type, typename T1, typename T2, typename T3, typename T4> inline expression_node<typename node_type::value_type>* allocate_tttt(T1 t1, T2 t2, T3 t3, T4 t4) const { - return new node_type(t1,t2,t3,t4); + return (new node_type(t1,t2,t3,t4)); } template <typename node_type, typename T1, typename T2, typename T3> inline expression_node<typename node_type::value_type>* allocate_rrr(T1& t1, T2& t2, T3& t3) const { - return new node_type(t1,t2,t3); + return (new node_type(t1,t2,t3)); } template <typename node_type, typename T1, typename T2, typename T3, typename T4> inline expression_node<typename node_type::value_type>* allocate_rrrr(T1& t1, T2& t2, T3& t3, T4& t4) const { - return new node_type(t1,t2,t3,t4); + return (new node_type(t1,t2,t3,t4)); } template <typename node_type, typename T1, typename T2, typename T3, typename T4, typename T5> inline expression_node<typename node_type::value_type>* allocate_rrrrr(T1& t1, T2& t2, T3& t3, T4& t4, T5& t5) const { - return new node_type(t1,t2,t3,t4,t5); + return (new node_type(t1,t2,t3,t4,t5)); } template <typename node_type, @@ -15411,7 +15517,7 @@ namespace exprtk inline expression_node<typename node_type::value_type>* allocate(const T1& t1, const T2& t2, const T3& t3) const { - return new node_type(t1,t2,t3); + return (new node_type(t1,t2,t3)); } template <typename node_type, @@ -15420,7 +15526,7 @@ namespace exprtk inline expression_node<typename node_type::value_type>* allocate(const T1& t1, const T2& t2, const T3& t3, const T4& t4) const { - return new node_type(t1,t2,t3,t4); + return (new node_type(t1,t2,t3,t4)); } template <typename node_type, @@ -15430,7 +15536,7 @@ namespace exprtk const T3& t3, const T4& t4, const T5& t5) const { - return new node_type(t1,t2,t3,t4,t5); + return (new node_type(t1,t2,t3,t4,t5)); } template <typename node_type, @@ -15440,7 +15546,7 @@ namespace exprtk const T3& t3, const T4& t4, const T5& t5, const T6& t6) const { - return new node_type(t1,t2,t3,t4,t5,t6); + return (new node_type(t1,t2,t3,t4,t5,t6)); } template <typename node_type, @@ -15452,7 +15558,7 @@ namespace exprtk const T5& t5, const T6& t6, const T7& t7) const { - return new node_type(t1,t2,t3,t4,t5,t6,t7); + return (new node_type(t1,t2,t3,t4,t5,t6,t7)); } template <typename node_type, @@ -15465,7 +15571,7 @@ namespace exprtk const T5& t5, const T6& t6, const T7& t7, const T8& t8) const { - return new node_type(t1,t2,t3,t4,t5,t6,t7,t8); + return (new node_type(t1,t2,t3,t4,t5,t6,t7,t8)); } template <typename node_type, @@ -15479,7 +15585,7 @@ namespace exprtk const T7& t7, const T8& t8, const T9& t9) const { - return new node_type(t1,t2,t3,t4,t5,t6,t7,t8,t9); + return (new node_type(t1,t2,t3,t4,t5,t6,t7,t8,t9)); } template <typename node_type, @@ -15494,14 +15600,14 @@ namespace exprtk const T7& t7, const T8& t8, const T9& t9, const T10& t10) const { - return new node_type(t1,t2,t3,t4,t5,t6,t7,t8,t9,t10); + return (new node_type(t1,t2,t3,t4,t5,t6,t7,t8,t9,t10)); } template <typename node_type, typename T1, typename T2, typename T3> inline expression_node<typename node_type::value_type>* allocate_type(T1 t1, T2 t2, T3 t3) const { - return new node_type(t1,t2,t3); + return (new node_type(t1,t2,t3)); } template <typename node_type, @@ -15510,7 +15616,7 @@ namespace exprtk inline expression_node<typename node_type::value_type>* allocate_type(T1 t1, T2 t2, T3 t3, T4 t4) const { - return new node_type(t1,t2,t3,t4); + return (new node_type(t1,t2,t3,t4)); } template <typename node_type, @@ -15521,7 +15627,18 @@ namespace exprtk T3 t3, T4 t4, T5 t5) const { - return new node_type(t1,t2,t3,t4,t5); + return (new node_type(t1,t2,t3,t4,t5)); + } + + template <typename node_type, + typename T1, typename T2, + typename T3, typename T4, + typename T5, typename T6> + inline expression_node<typename node_type::value_type>* allocate_type(T1 t1, T2 t2, + T3 t3, T4 t4, + T5 t5, T6 t6) const + { + return (new node_type(t1,t2,t3,t4,t5,t6)); } template <typename node_type, @@ -15533,7 +15650,7 @@ namespace exprtk T5 t5, T6 t6, T7 t7) const { - return new node_type(t1,t2,t3,t4,t5,t6,t7); + return (new node_type(t1,t2,t3,t4,t5,t6,t7)); } template <typename T> @@ -15706,77 +15823,77 @@ namespace exprtk return std::numeric_limits<T>::quiet_NaN(); \ } \ - inline virtual T operator()() + inline virtual T operator() () empty_method_body - inline virtual T operator()(const T&) + inline virtual T operator() (const T&) empty_method_body - inline virtual T operator()(const T&,const T&) + inline virtual T operator() (const T&,const T&) empty_method_body - inline virtual T operator()(const T&, const T&, const T&) + inline virtual T operator() (const T&, const T&, const T&) empty_method_body - inline virtual T operator()(const T&, const T&, const T&, const T&) + inline virtual T operator() (const T&, const T&, const T&, const T&) empty_method_body - inline virtual T operator()(const T&, const T&, const T&, const T&, const T&) + inline virtual T operator() (const T&, const T&, const T&, const T&, const T&) empty_method_body - inline virtual T operator()(const T&, const T&, const T&, const T&, const T&, const T&) + inline virtual T operator() (const T&, const T&, const T&, const T&, const T&, const T&) empty_method_body - inline virtual T operator()(const T&, const T&, const T&, const T&, const T&, const T&, const T&) + inline virtual T operator() (const T&, const T&, const T&, const T&, const T&, const T&, const T&) empty_method_body - inline virtual T operator()(const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&) + inline virtual T operator() (const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&) empty_method_body - inline virtual T operator()(const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&) + inline virtual T operator() (const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&) empty_method_body - inline virtual T operator()(const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&) + inline virtual T operator() (const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&) empty_method_body - inline virtual T operator()(const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, + inline virtual T operator() (const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&) empty_method_body - inline virtual T operator()(const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, - const T&, const T&) + inline virtual T operator() (const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, + const T&, const T&) empty_method_body - inline virtual T operator()(const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, - const T&, const T&, const T&) + inline virtual T operator() (const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, + const T&, const T&, const T&) empty_method_body - inline virtual T operator()(const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, - const T&, const T&, const T&, const T&) + inline virtual T operator() (const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, + const T&, const T&, const T&, const T&) empty_method_body - inline virtual T operator()(const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, - const T&, const T&, const T&, const T&, const T&) + inline virtual T operator() (const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, + const T&, const T&, const T&, const T&, const T&) empty_method_body - inline virtual T operator()(const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, - const T&, const T&, const T&, const T&, const T&, const T&) + inline virtual T operator() (const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, + const T&, const T&, const T&, const T&, const T&, const T&) empty_method_body - inline virtual T operator()(const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, - const T&, const T&, const T&, const T&, const T&, const T&, const T&) + inline virtual T operator() (const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, + const T&, const T&, const T&, const T&, const T&, const T&, const T&) empty_method_body - inline virtual T operator()(const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, - const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&) + inline virtual T operator() (const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, + const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&) empty_method_body - inline virtual T operator()(const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, - const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&) + inline virtual T operator() (const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, + const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&) empty_method_body - inline virtual T operator()(const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, - const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&) + inline virtual T operator() (const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, + const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&, const T&) empty_method_body #undef empty_method_body @@ -15792,7 +15909,7 @@ namespace exprtk virtual ~ivararg_function() {} - inline virtual T operator()(const std::vector<T>&) + inline virtual T operator() (const std::vector<T>&) { exprtk_debug(("ivararg_function::operator() - Operator has not been overridden.\n")); return std::numeric_limits<T>::quiet_NaN(); @@ -15829,19 +15946,19 @@ namespace exprtk } \ // f(i_0,i_1,....,i_N) --> Scalar - inline virtual T operator()(parameter_list_t) + inline virtual T operator() (parameter_list_t) igeneric_function_empty_body(1) // f(i_0,i_1,....,i_N) --> String - inline virtual T operator()(std::string&, parameter_list_t) + inline virtual T operator() (std::string&, parameter_list_t) igeneric_function_empty_body(2) // f(psi,i_0,i_1,....,i_N) --> Scalar - inline virtual T operator()(const std::size_t&, parameter_list_t) + inline virtual T operator() (const std::size_t&, parameter_list_t) igeneric_function_empty_body(3) // f(psi,i_0,i_1,....,i_N) --> String - inline virtual T operator()(const std::size_t&, std::string&, parameter_list_t) + inline virtual T operator() (const std::size_t&, std::string&, parameter_list_t) igeneric_function_empty_body(4) std::string parameter_sequence; @@ -15879,7 +15996,7 @@ namespace exprtk using exprtk::ifunction<T>::operator(); freefunc01(ff01_functor ff) : exprtk::ifunction<T>(1), f(ff) {} - inline T operator()(const T& v0) + inline T operator() (const T& v0) { return f(v0); } ff01_functor f; }; @@ -15889,7 +16006,7 @@ namespace exprtk using exprtk::ifunction<T>::operator(); freefunc02(ff02_functor ff) : exprtk::ifunction<T>(2), f(ff) {} - inline T operator()(const T& v0, const T& v1) + inline T operator() (const T& v0, const T& v1) { return f(v0, v1); } ff02_functor f; }; @@ -15899,7 +16016,7 @@ namespace exprtk using exprtk::ifunction<T>::operator(); freefunc03(ff03_functor ff) : exprtk::ifunction<T>(3), f(ff) {} - inline T operator()(const T& v0, const T& v1, const T& v2) + inline T operator() (const T& v0, const T& v1, const T& v2) { return f(v0, v1, v2); } ff03_functor f; }; @@ -15909,7 +16026,7 @@ namespace exprtk using exprtk::ifunction<T>::operator(); freefunc04(ff04_functor ff) : exprtk::ifunction<T>(4), f(ff) {} - inline T operator()(const T& v0, const T& v1, const T& v2, const T& v3) + inline T operator() (const T& v0, const T& v1, const T& v2, const T& v3) { return f(v0, v1, v2, v3); } ff04_functor f; }; @@ -15919,7 +16036,7 @@ namespace exprtk using exprtk::ifunction<T>::operator(); freefunc05(ff05_functor ff) : exprtk::ifunction<T>(5), f(ff) {} - inline T operator()(const T& v0, const T& v1, const T& v2, const T& v3, const T& v4) + inline T operator() (const T& v0, const T& v1, const T& v2, const T& v3, const T& v4) { return f(v0, v1, v2, v3, v4); } ff05_functor f; }; @@ -15929,7 +16046,7 @@ namespace exprtk using exprtk::ifunction<T>::operator(); freefunc06(ff06_functor ff) : exprtk::ifunction<T>(6), f(ff) {} - inline T operator()(const T& v0, const T& v1, const T& v2, const T& v3, const T& v4, const T& v5) + inline T operator() (const T& v0, const T& v1, const T& v2, const T& v3, const T& v4, const T& v5) { return f(v0, v1, v2, v3, v4, v5); } ff06_functor f; }; @@ -15939,8 +16056,8 @@ namespace exprtk using exprtk::ifunction<T>::operator(); freefunc07(ff07_functor ff) : exprtk::ifunction<T>(7), f(ff) {} - inline T operator()(const T& v0, const T& v1, const T& v2, const T& v3, const T& v4, - const T& v5, const T& v6) + inline T operator() (const T& v0, const T& v1, const T& v2, const T& v3, const T& v4, + const T& v5, const T& v6) { return f(v0, v1, v2, v3, v4, v5, v6); } ff07_functor f; }; @@ -15950,8 +16067,8 @@ namespace exprtk using exprtk::ifunction<T>::operator(); freefunc08(ff08_functor ff) : exprtk::ifunction<T>(8), f(ff) {} - inline T operator()(const T& v0, const T& v1, const T& v2, const T& v3, const T& v4, - const T& v5, const T& v6, const T& v7) + inline T operator() (const T& v0, const T& v1, const T& v2, const T& v3, const T& v4, + const T& v5, const T& v6, const T& v7) { return f(v0, v1, v2, v3, v4, v5, v6, v7); } ff08_functor f; }; @@ -15961,8 +16078,8 @@ namespace exprtk using exprtk::ifunction<T>::operator(); freefunc09(ff09_functor ff) : exprtk::ifunction<T>(9), f(ff) {} - inline T operator()(const T& v0, const T& v1, const T& v2, const T& v3, const T& v4, - const T& v5, const T& v6, const T& v7, const T& v8) + inline T operator() (const T& v0, const T& v1, const T& v2, const T& v3, const T& v4, + const T& v5, const T& v6, const T& v7, const T& v8) { return f(v0, v1, v2, v3, v4, v5, v6, v7, v8); } ff09_functor f; }; @@ -15972,8 +16089,8 @@ namespace exprtk using exprtk::ifunction<T>::operator(); freefunc10(ff10_functor ff) : exprtk::ifunction<T>(10), f(ff) {} - inline T operator()(const T& v0, const T& v1, const T& v2, const T& v3, const T& v4, - const T& v5, const T& v6, const T& v7, const T& v8, const T& v9) + inline T operator() (const T& v0, const T& v1, const T& v2, const T& v3, const T& v4, + const T& v5, const T& v6, const T& v7, const T& v8, const T& v9) { return f(v0, v1, v2, v3, v4, v5, v6, v7, v8, v9); } ff10_functor f; }; @@ -15983,8 +16100,8 @@ namespace exprtk using exprtk::ifunction<T>::operator(); freefunc11(ff11_functor ff) : exprtk::ifunction<T>(11), f(ff) {} - inline T operator()(const T& v0, const T& v1, const T& v2, const T& v3, const T& v4, - const T& v5, const T& v6, const T& v7, const T& v8, const T& v9, const T& v10) + inline T operator() (const T& v0, const T& v1, const T& v2, const T& v3, const T& v4, + const T& v5, const T& v6, const T& v7, const T& v8, const T& v9, const T& v10) { return f(v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10); } ff11_functor f; }; @@ -15994,9 +16111,9 @@ namespace exprtk using exprtk::ifunction<T>::operator(); freefunc12(ff12_functor ff) : exprtk::ifunction<T>(12), f(ff) {} - inline T operator()(const T& v00, const T& v01, const T& v02, const T& v03, const T& v04, - const T& v05, const T& v06, const T& v07, const T& v08, const T& v09, - const T& v10, const T& v11) + inline T operator() (const T& v00, const T& v01, const T& v02, const T& v03, const T& v04, + const T& v05, const T& v06, const T& v07, const T& v08, const T& v09, + const T& v10, const T& v11) { return f(v00, v01, v02, v03, v04, v05, v06, v07, v08, v09, v10, v11); } ff12_functor f; }; @@ -16006,9 +16123,9 @@ namespace exprtk using exprtk::ifunction<T>::operator(); freefunc13(ff13_functor ff) : exprtk::ifunction<T>(13), f(ff) {} - inline T operator()(const T& v00, const T& v01, const T& v02, const T& v03, const T& v04, - const T& v05, const T& v06, const T& v07, const T& v08, const T& v09, - const T& v10, const T& v11, const T& v12) + inline T operator() (const T& v00, const T& v01, const T& v02, const T& v03, const T& v04, + const T& v05, const T& v06, const T& v07, const T& v08, const T& v09, + const T& v10, const T& v11, const T& v12) { return f(v00, v01, v02, v03, v04, v05, v06, v07, v08, v09, v10, v11, v12); } ff13_functor f; }; @@ -16018,9 +16135,9 @@ namespace exprtk using exprtk::ifunction<T>::operator(); freefunc14(ff14_functor ff) : exprtk::ifunction<T>(14), f(ff) {} - inline T operator()(const T& v00, const T& v01, const T& v02, const T& v03, const T& v04, - const T& v05, const T& v06, const T& v07, const T& v08, const T& v09, - const T& v10, const T& v11, const T& v12, const T& v13) + inline T operator() (const T& v00, const T& v01, const T& v02, const T& v03, const T& v04, + const T& v05, const T& v06, const T& v07, const T& v08, const T& v09, + const T& v10, const T& v11, const T& v12, const T& v13) { return f(v00, v01, v02, v03, v04, v05, v06, v07, v08, v09, v10, v11, v12, v13); } ff14_functor f; }; @@ -16030,9 +16147,9 @@ namespace exprtk using exprtk::ifunction<T>::operator(); freefunc15(ff15_functor ff) : exprtk::ifunction<T>(15), f(ff) {} - inline T operator()(const T& v00, const T& v01, const T& v02, const T& v03, const T& v04, - const T& v05, const T& v06, const T& v07, const T& v08, const T& v09, - const T& v10, const T& v11, const T& v12, const T& v13, const T& v14) + inline T operator() (const T& v00, const T& v01, const T& v02, const T& v03, const T& v04, + const T& v05, const T& v06, const T& v07, const T& v08, const T& v09, + const T& v10, const T& v11, const T& v12, const T& v13, const T& v14) { return f(v00, v01, v02, v03, v04, v05, v06, v07, v08, v09, v10, v11, v12, v13, v14); } ff15_functor f; }; @@ -16103,7 +16220,7 @@ namespace exprtk return false; else { - tm_const_itr_t itr = map.find(symbol_name); + const tm_const_itr_t itr = map.find(symbol_name); if (map.end() == itr) return false; @@ -16126,7 +16243,7 @@ namespace exprtk } } - tm_itr_t itr = map.find(symbol_name); + const tm_itr_t itr = map.find(symbol_name); if (map.end() == itr) { @@ -16236,7 +16353,7 @@ namespace exprtk } }; - tm_itr_t itr = map.find(symbol_name); + const tm_itr_t itr = map.find(symbol_name); if (map.end() == itr) { @@ -16249,7 +16366,7 @@ namespace exprtk inline type_ptr get(const std::string& symbol_name) const { - tm_const_itr_t itr = map.find(symbol_name); + const tm_const_itr_t itr = map.find(symbol_name); if (map.end() == itr) return reinterpret_cast<type_ptr>(0); @@ -16297,7 +16414,7 @@ namespace exprtk inline bool remove(const std::string& symbol_name, const bool delete_node = true) { - tm_itr_t itr = map.find(symbol_name); + const tm_itr_t itr = map.find(symbol_name); if (map.end() != itr) { @@ -16337,7 +16454,7 @@ namespace exprtk static RawType null_type = init_type::set(RawType()); - tm_const_itr_t itr = map.find(symbol_name); + const tm_const_itr_t itr = map.find(symbol_name); if (map.end() == itr) return null_type; @@ -16362,7 +16479,7 @@ namespace exprtk if (delete_node) { tm_itr_t itr = map.begin(); - tm_itr_t end = map.end(); + tm_itr_t end = map.end (); while (end != itr) { @@ -16386,7 +16503,7 @@ namespace exprtk if (!map.empty()) { tm_const_itr_t itr = map.begin(); - tm_const_itr_t end = map.end(); + tm_const_itr_t end = map.end (); while (end != itr) { @@ -16408,7 +16525,7 @@ namespace exprtk if (!map.empty()) { tm_const_itr_t itr = map.begin(); - tm_const_itr_t end = map.end(); + tm_const_itr_t end = map.end (); while (end != itr) { @@ -16480,6 +16597,17 @@ namespace exprtk return (reserved_symbol_table_.end() != reserved_symbol_table_.find(symbol)); } + static inline st_data* create() + { + return (new st_data); + } + + static inline void destroy(st_data*& sd) + { + delete sd; + sd = reinterpret_cast<st_data*>(0); + } + std::list<T> local_symbol_list_; std::list<std::string> local_stringvar_list_; std::set<std::string> reserved_symbol_table_; @@ -16488,7 +16616,7 @@ namespace exprtk control_block() : ref_count(1), - data_(new st_data) + data_(st_data::create()) {} control_block(st_data* data) @@ -16500,14 +16628,13 @@ namespace exprtk { if (data_ && (0 == ref_count)) { - delete data_; - data_ = 0; + st_data::destroy(data_); } } static inline control_block* create() { - return new control_block; + return (new control_block); } template <typename SymTab> @@ -16563,7 +16690,7 @@ namespace exprtk control_block_->ref_count++; } - return *this; + return (*this); } inline bool operator==(const symbol_table<T>& st) @@ -16979,6 +17106,8 @@ namespace exprtk return false; else if (symbol_exists(vector_name)) return false; + else if (0 == v_size) + return false; else return local_data().vector_store.add(vector_name,v,v_size); } @@ -16992,6 +17121,8 @@ namespace exprtk return false; else if (symbol_exists(vector_name)) return false; + else if (0 == v.size()) + return false; else return local_data().vector_store.add(vector_name,v); } @@ -17004,6 +17135,8 @@ namespace exprtk return false; else if (symbol_exists(vector_name)) return false; + else if (0 == v.size()) + return false; else return local_data().vector_store.add(vector_name,v); } @@ -17441,8 +17574,7 @@ namespace exprtk { if (expr && details::branch_deletable(expr)) { - delete expr; - expr = reinterpret_cast<expression_ptr>(0); + destroy_node(expr); } if (!local_data_list.empty()) @@ -17517,7 +17649,7 @@ namespace exprtk } expression(const expression<T>& e) - : control_block_(e.control_block_), + : control_block_ (e.control_block_ ), symbol_table_list_(e.symbol_table_list_) { control_block_->ref_count++; @@ -17565,7 +17697,7 @@ namespace exprtk { control_block::destroy(control_block_); - return *this; + return (*this); } ~expression() @@ -17578,7 +17710,7 @@ namespace exprtk return control_block_->expr->value(); } - inline T operator()() const + inline T operator() () const { return value(); } @@ -17805,27 +17937,35 @@ namespace exprtk lexer::token token; error_mode mode; std::string diagnostic; + std::string src_location; std::string error_line; std::size_t line_no; std::size_t column_no; }; - inline type make_error(error_mode mode, const std::string& diagnostic = "") + inline type make_error(error_mode mode, + const std::string& diagnostic = "", + const std::string& src_location = "") { type t; - t.mode = mode; - t.token.type = lexer::token::e_error; - t.diagnostic = diagnostic; + t.mode = mode; + t.token.type = lexer::token::e_error; + t.diagnostic = diagnostic; + t.src_location = src_location; exprtk_debug(("%s\n",diagnostic .c_str())); return t; } - inline type make_error(error_mode mode, const lexer::token& tk, const std::string& diagnostic = "") + inline type make_error(error_mode mode, + const lexer::token& tk, + const std::string& diagnostic = "", + const std::string& src_location = "") { type t; t.mode = mode; t.token = tk; t.diagnostic = diagnostic; + t.src_location = src_location; exprtk_debug(("%s\n",diagnostic .c_str())); return t; } @@ -17982,6 +18122,7 @@ namespace exprtk typedef details::scor_node<T> scor_node_t; typedef lexer::token token_t; typedef expression_node_t* expression_node_ptr; + typedef expression<T> expression_t; typedef symbol_table<T> symbol_table_t; typedef typename expression<T>::symtab_list_t symbol_table_list_t; typedef details::vector_holder<T>* vector_holder_ptr; @@ -18291,7 +18432,7 @@ namespace exprtk se.active && se.var_node && details::is_variable_node(se.var_node) - ) + ) { variable_node_ptr vn = reinterpret_cast<variable_node_ptr>(se.var_node); @@ -18900,14 +19041,13 @@ namespace exprtk for (std::size_t i = 0; i < symbol_name_list_.size(); ++i) { - std::string& s = symbol_name_list_[i].first; - std::transform(s.begin(),s.end(),s.begin(),static_cast<int(*)(int)>(std::tolower)); + details::case_normalise(symbol_name_list_[i].first); } std::sort(symbol_name_list_.begin(),symbol_name_list_.end()); std::unique_copy(symbol_name_list_.begin(), - symbol_name_list_.end(), + symbol_name_list_.end (), std::back_inserter(symbols_list)); return symbols_list.size(); @@ -18924,14 +19064,13 @@ namespace exprtk for (std::size_t i = 0; i < assignment_name_list_.size(); ++i) { - std::string& s = assignment_name_list_[i].first; - std::transform(s.begin(), s.end(), s.begin(), static_cast<int(*)(int)>(std::tolower)); + details::case_normalise(assignment_name_list_[i].first); } std::sort(assignment_name_list_.begin(),assignment_name_list_.end()); std::unique_copy(assignment_name_list_.begin(), - assignment_name_list_.end(), + assignment_name_list_.end (), std::back_inserter(assignment_list)); return assignment_list.size(); @@ -19135,43 +19274,43 @@ namespace exprtk settings_store& enable_all_base_functions() { disabled_func_set_.clear(); - return *this; + return (*this); } settings_store& enable_all_control_structures() { disabled_ctrl_set_.clear(); - return *this; + return (*this); } settings_store& enable_all_logic_ops() { disabled_logic_set_.clear(); - return *this; + return (*this); } settings_store& enable_all_arithmetic_ops() { disabled_arithmetic_set_.clear(); - return *this; + return (*this); } settings_store& enable_all_assignment_ops() { disabled_assignment_set_.clear(); - return *this; + return (*this); } settings_store& enable_all_inequality_ops() { disabled_inequality_set_.clear(); - return *this; + return (*this); } settings_store& enable_local_vardef() { disable_vardef_ = false; - return *this; + return (*this); } settings_store& disable_all_base_functions() @@ -19180,7 +19319,7 @@ namespace exprtk details::base_function_list + details::base_function_list_size, std::insert_iterator<disabled_entity_set_t> (disabled_func_set_, disabled_func_set_.begin())); - return *this; + return (*this); } settings_store& disable_all_control_structures() @@ -19189,7 +19328,7 @@ namespace exprtk details::cntrl_struct_list + details::cntrl_struct_list_size, std::insert_iterator<disabled_entity_set_t> (disabled_ctrl_set_, disabled_ctrl_set_.begin())); - return *this; + return (*this); } settings_store& disable_all_logic_ops() @@ -19198,7 +19337,7 @@ namespace exprtk details::logic_ops_list + details::logic_ops_list_size, std::insert_iterator<disabled_entity_set_t> (disabled_logic_set_, disabled_logic_set_.begin())); - return *this; + return (*this); } settings_store& disable_all_arithmetic_ops() @@ -19207,7 +19346,7 @@ namespace exprtk details::arithmetic_ops_list + details::arithmetic_ops_list_size, std::insert_iterator<disabled_entity_set_t> (disabled_arithmetic_set_, disabled_arithmetic_set_.begin())); - return *this; + return (*this); } settings_store& disable_all_assignment_ops() @@ -19216,7 +19355,7 @@ namespace exprtk details::assignment_ops_list + details::assignment_ops_list_size, std::insert_iterator<disabled_entity_set_t> (disabled_assignment_set_, disabled_assignment_set_.begin())); - return *this; + return (*this); } settings_store& disable_all_inequality_ops() @@ -19225,13 +19364,13 @@ namespace exprtk details::inequality_ops_list + details::inequality_ops_list_size, std::insert_iterator<disabled_entity_set_t> (disabled_inequality_set_, disabled_inequality_set_.begin())); - return *this; + return (*this); } settings_store& disable_local_vardef() { disable_vardef_ = true; - return *this; + return (*this); } bool replacer_enabled () const { return enable_replacer_; } @@ -19360,7 +19499,7 @@ namespace exprtk disabled_func_set_.insert(details::base_function_list[bf - 1]); } - return *this; + return (*this); } settings_store& disable_control_structure(settings_control_structs ctrl_struct) @@ -19373,7 +19512,7 @@ namespace exprtk disabled_ctrl_set_.insert(details::cntrl_struct_list[ctrl_struct - 1]); } - return *this; + return (*this); } settings_store& disable_logic_operation(settings_logic_opr logic) @@ -19386,7 +19525,7 @@ namespace exprtk disabled_logic_set_.insert(details::logic_ops_list[logic - 1]); } - return *this; + return (*this); } settings_store& disable_arithmetic_operation(settings_arithmetic_opr arithmetic) @@ -19399,7 +19538,7 @@ namespace exprtk disabled_arithmetic_set_.insert(details::arithmetic_ops_list[arithmetic - 1]); } - return *this; + return (*this); } settings_store& disable_assignment_operation(settings_assignment_opr assignment) @@ -19412,7 +19551,7 @@ namespace exprtk disabled_assignment_set_.insert(details::assignment_ops_list[assignment - 1]); } - return *this; + return (*this); } settings_store& disable_inequality_operation(settings_inequality_opr inequality) @@ -19425,7 +19564,7 @@ namespace exprtk disabled_inequality_set_.insert(details::inequality_ops_list[inequality - 1]); } - return *this; + return (*this); } settings_store& enable_base_function(settings_base_funcs bf) @@ -19435,7 +19574,7 @@ namespace exprtk (static_cast<std::size_t>(bf) < (details::base_function_list_size + 1)) ) { - des_itr_t itr = disabled_func_set_.find(details::base_function_list[bf - 1]); + const des_itr_t itr = disabled_func_set_.find(details::base_function_list[bf - 1]); if (disabled_func_set_.end() != itr) { @@ -19443,7 +19582,7 @@ namespace exprtk } } - return *this; + return (*this); } settings_store& enable_control_structure(settings_control_structs ctrl_struct) @@ -19453,7 +19592,7 @@ namespace exprtk (static_cast<std::size_t>(ctrl_struct) < (details::cntrl_struct_list_size + 1)) ) { - des_itr_t itr = disabled_ctrl_set_.find(details::cntrl_struct_list[ctrl_struct - 1]); + const des_itr_t itr = disabled_ctrl_set_.find(details::cntrl_struct_list[ctrl_struct - 1]); if (disabled_ctrl_set_.end() != itr) { @@ -19461,7 +19600,7 @@ namespace exprtk } } - return *this; + return (*this); } settings_store& enable_logic_operation(settings_logic_opr logic) @@ -19471,7 +19610,7 @@ namespace exprtk (static_cast<std::size_t>(logic) < (details::logic_ops_list_size + 1)) ) { - des_itr_t itr = disabled_logic_set_.find(details::logic_ops_list[logic - 1]); + const des_itr_t itr = disabled_logic_set_.find(details::logic_ops_list[logic - 1]); if (disabled_logic_set_.end() != itr) { @@ -19479,7 +19618,7 @@ namespace exprtk } } - return *this; + return (*this); } settings_store& enable_arithmetic_operation(settings_arithmetic_opr arithmetic) @@ -19489,7 +19628,7 @@ namespace exprtk (static_cast<std::size_t>(arithmetic) < (details::arithmetic_ops_list_size + 1)) ) { - des_itr_t itr = disabled_arithmetic_set_.find(details::arithmetic_ops_list[arithmetic - 1]); + const des_itr_t itr = disabled_arithmetic_set_.find(details::arithmetic_ops_list[arithmetic - 1]); if (disabled_arithmetic_set_.end() != itr) { @@ -19497,7 +19636,7 @@ namespace exprtk } } - return *this; + return (*this); } settings_store& enable_assignment_operation(settings_assignment_opr assignment) @@ -19507,7 +19646,7 @@ namespace exprtk (static_cast<std::size_t>(assignment) < (details::assignment_ops_list_size + 1)) ) { - des_itr_t itr = disabled_assignment_set_.find(details::assignment_ops_list[assignment - 1]); + const des_itr_t itr = disabled_assignment_set_.find(details::assignment_ops_list[assignment - 1]); if (disabled_assignment_set_.end() != itr) { @@ -19515,7 +19654,7 @@ namespace exprtk } } - return *this; + return (*this); } settings_store& enable_inequality_operation(settings_inequality_opr inequality) @@ -19525,7 +19664,7 @@ namespace exprtk (static_cast<std::size_t>(inequality) < (details::inequality_ops_list_size + 1)) ) { - des_itr_t itr = disabled_inequality_set_.find(details::inequality_ops_list[inequality - 1]); + const des_itr_t itr = disabled_inequality_set_.find(details::inequality_ops_list[inequality - 1]); if (disabled_inequality_set_.end() != itr) { @@ -19533,7 +19672,7 @@ namespace exprtk } } - return *this; + return (*this); } private: @@ -19741,7 +19880,8 @@ namespace exprtk { set_error( make_error(parser_error::e_syntax, - "ERR000 - Empty expression!")); + "ERR000 - Empty expression!", + exprtk_error_location)); return false; } @@ -19756,7 +19896,8 @@ namespace exprtk { set_error( make_error(parser_error::e_syntax, - "ERR001 - Empty expression!")); + "ERR001 - Empty expression!", + exprtk_error_location)); return false; } @@ -19802,7 +19943,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR002 - Invalid expression encountered")); + "ERR002 - Invalid expression encountered", + exprtk_error_location)); } dec_.clear (); @@ -19811,13 +19953,24 @@ namespace exprtk if ((0 != e) && branch_deletable(e)) { - delete e; + destroy_node(e); } return false; } } + inline expression_t compile(const std::string& expression_string, symbol_table_t& symtab) + { + expression_t expr; + + expr.register_symbol_table(symtab); + + compile(expression_string,expr); + + return expr; + } + void process_lexer_errors() { for (std::size_t i = 0; i < lexer().size(); ++i) @@ -19849,7 +20002,8 @@ namespace exprtk set_error( make_error(parser_error::e_lexer, lexer()[i], - diagnostic + ": " + lexer()[i].value)); + diagnostic + ": " + lexer()[i].value, + exprtk_error_location)); } } } @@ -19890,7 +20044,8 @@ namespace exprtk set_error( make_error(parser_error::e_token, bracket_checker_ptr->error_token(), - "ERR004 - Mismatched brackets: '" + bracket_checker_ptr->error_token().value + "'")); + "ERR004 - Mismatched brackets: '" + bracket_checker_ptr->error_token().value + "'", + exprtk_error_location)); } else if (0 != (numeric_checker_ptr = dynamic_cast<lexer::helper::numeric_checker*>(helper_assembly_.error_token_scanner))) { @@ -19901,7 +20056,8 @@ namespace exprtk set_error( make_error(parser_error::e_token, error_token, - "ERR005 - Invalid numeric token: '" + error_token.value + "'")); + "ERR005 - Invalid numeric token: '" + error_token.value + "'", + exprtk_error_location)); } if (numeric_checker_ptr->error_count()) @@ -19920,7 +20076,8 @@ namespace exprtk error_token.first, "ERR006 - Invalid token sequence: '" + error_token.first.value + "' and '" + - error_token.second.value + "'")); + error_token.second.value + "'", + exprtk_error_location)); } if (sequence_validator_ptr->error_count()) @@ -20090,7 +20247,7 @@ namespace exprtk expression_node_ptr result = error_node(); - scoped_vec_delete<expression_node_t> sdd(*this,arg_list); + scoped_vec_delete<expression_node_t> sdd((*this),arg_list); lexer::token begin_token; lexer::token end_token; @@ -20110,7 +20267,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR007 - Invalid expression encountered")); + "ERR007 - Invalid expression encountered", + exprtk_error_location)); } return error_node(); @@ -20341,7 +20499,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, prev_token, - "ERR008 - Invalid arithmetic operation '" + details::to_str(current_state.operation) + "'")); + "ERR008 - Invalid arithmetic operation '" + details::to_str(current_state.operation) + "'", + exprtk_error_location)); return error_node(); } @@ -20352,7 +20511,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, prev_token, - "ERR009 - Invalid inequality operation '" + details::to_str(current_state.operation) + "'")); + "ERR009 - Invalid inequality operation '" + details::to_str(current_state.operation) + "'", + exprtk_error_location)); return error_node(); } @@ -20363,7 +20523,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, prev_token, - "ERR010 - Invalid assignment operation '" + details::to_str(current_state.operation) + "'")); + "ERR010 - Invalid assignment operation '" + details::to_str(current_state.operation) + "'", + exprtk_error_location)); return error_node(); } @@ -20381,7 +20542,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, prev_token, - "ERR011 - Return statements cannot be part of sub-expressions")); + "ERR011 - Return statements cannot be part of sub-expressions", + exprtk_error_location)); return error_node(); } @@ -20403,7 +20565,8 @@ namespace exprtk prev_token, !synthesis_error_.empty() ? synthesis_error_ : - "ERR012 - General parsing error at token: '" + prev_token.value + "'")); + "ERR012 - General parsing error at token: '" + prev_token.value + "'", + exprtk_error_location)); } free_node(node_allocator_,expression); @@ -20471,7 +20634,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR013 - Failed to find variable node in symbol table")); + "ERR013 - Failed to find variable node in symbol table", + exprtk_error_location)); free_node(node_allocator_,node); @@ -20650,7 +20814,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR014 - Invalid number of parameters for function: '" + function_name + "'")); + "ERR014 - Invalid number of parameters for function: '" + function_name + "'", + exprtk_error_location)); return error_node(); } @@ -20663,7 +20828,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR015 - Failed to generate call to function: '" + function_name + "'")); + "ERR015 - Failed to generate call to function: '" + function_name + "'", + exprtk_error_location)); return error_node(); } @@ -20681,7 +20847,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR016 - Expecting ifunction '" + function_name + "' to have non-zero parameter count")); + "ERR016 - Expecting ifunction '" + function_name + "' to have non-zero parameter count", + exprtk_error_location)); return error_node(); } @@ -20694,7 +20861,7 @@ namespace exprtk std::fill_n(branch, NumberofParameters, reinterpret_cast<expression_node_ptr>(0)); - scoped_delete<expression_node_t,NumberofParameters> sd(*this,branch); + scoped_delete<expression_node_t,NumberofParameters> sd((*this),branch); next_token(); @@ -20703,7 +20870,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR017 - Expecting argument list for function: '" + function_name + "'")); + "ERR017 - Expecting argument list for function: '" + function_name + "'", + exprtk_error_location)); return error_node(); } @@ -20717,7 +20885,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR018 - Failed to parse argument " + details::to_str(i) + " for function: '" + function_name + "'")); + "ERR018 - Failed to parse argument " + details::to_str(i) + " for function: '" + function_name + "'", + exprtk_error_location)); return error_node(); } @@ -20728,7 +20897,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR019 - Invalid number of arguments for function: '" + function_name + "'")); + "ERR019 - Invalid number of arguments for function: '" + function_name + "'", + exprtk_error_location)); return error_node(); } @@ -20740,7 +20910,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR020 - Invalid number of arguments for function: '" + function_name + "'")); + "ERR020 - Invalid number of arguments for function: '" + function_name + "'", + exprtk_error_location)); return error_node(); } @@ -20768,7 +20939,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR021 - Expecting '()' to proceed call to function: '" + function_name + "'")); + "ERR021 - Expecting '()' to proceed call to function: '" + function_name + "'", + exprtk_error_location)); free_node(node_allocator_,result); @@ -20783,7 +20955,7 @@ namespace exprtk { std::fill_n(param_list, MaxNumberofParameters, reinterpret_cast<expression_node_ptr>(0)); - scoped_delete<expression_node_t,MaxNumberofParameters> sd(*this,param_list); + scoped_delete<expression_node_t,MaxNumberofParameters> sd((*this),param_list); next_token(); @@ -20792,7 +20964,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR022 - Expected a '(' at start of function call, instead got: '" + current_token().value + "'")); + "ERR022 - Expected a '(' at start of function call, instead got: '" + current_token().value + "'", + exprtk_error_location)); return 0; } @@ -20814,7 +20987,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR023 - Expected a ',' between function input parameters, instead got: '" + current_token().value + "'")); + "ERR023 - Expected a ',' between function input parameters, instead got: '" + current_token().value + "'", + exprtk_error_location)); return 0; } @@ -20838,7 +21012,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR024 - No entry found for base operation: " + operation_name)); + "ERR024 - No entry found for base operation: " + operation_name, + exprtk_error_location)); return error_node(); } @@ -20888,7 +21063,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR025 - Invalid number of parameters for call to function: '" + operation_name + "'")); + "ERR025 - Invalid number of parameters for call to function: '" + operation_name + "'", + exprtk_error_location)); return error_node(); } @@ -20907,7 +21083,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR026 - Expected ',' between if-statement condition and consequent")); + "ERR026 - Expected ',' between if-statement condition and consequent", + exprtk_error_location)); result = false; } else if (0 == (consequent = parse_expression())) @@ -20915,7 +21092,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR027 - Failed to parse consequent for if-statement")); + "ERR027 - Failed to parse consequent for if-statement", + exprtk_error_location)); result = false; } else if (!token_is(token_t::e_comma)) @@ -20923,7 +21101,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR028 - Expected ',' between if-statement consequent and alternative")); + "ERR028 - Expected ',' between if-statement consequent and alternative", + exprtk_error_location)); result = false; } else if (0 == (alternative = parse_expression())) @@ -20931,7 +21110,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR029 - Failed to parse alternative for if-statement")); + "ERR029 - Failed to parse alternative for if-statement", + exprtk_error_location)); result = false; } else if (!token_is(token_t::e_rbracket)) @@ -20939,7 +21119,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR030 - Expected ')' at the end of if-statement")); + "ERR030 - Expected ')' at the end of if-statement", + exprtk_error_location)); result = false; } @@ -20960,7 +21141,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR031 - Return types of ternary if-statement differ")); + "ERR031 - Return types of ternary if-statement differ", + exprtk_error_location)); result = false; } @@ -20994,7 +21176,9 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR032 - Failed to parse body of consequent for if-statement")); + "ERR032 - Failed to parse body of consequent for if-statement", + exprtk_error_location)); + result = false; } } @@ -21015,7 +21199,9 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR033 - Expected ';' at the end of the consequent for if-statement")); + "ERR033 - Expected ';' at the end of the consequent for if-statement", + exprtk_error_location)); + result = false; } } @@ -21024,7 +21210,9 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR034 - Failed to parse body of consequent for if-statement")); + "ERR034 - Failed to parse body of consequent for if-statement", + exprtk_error_location)); + result = false; } } @@ -21042,7 +21230,9 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR035 - Failed to parse body of the 'else' for if-statement")); + "ERR035 - Failed to parse body of the 'else' for if-statement", + exprtk_error_location)); + result = false; } } @@ -21053,7 +21243,9 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR036 - Failed to parse body of if-else statement")); + "ERR036 - Failed to parse body of if-else statement", + exprtk_error_location)); + result = false; } } @@ -21064,7 +21256,9 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR037 - Expected ';' at the end of the 'else-if' for the if-statement")); + "ERR037 - Expected ';' at the end of the 'else-if' for the if-statement", + exprtk_error_location)); + result = false; } } @@ -21073,7 +21267,9 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR038 - Failed to parse body of the 'else' for if-statement")); + "ERR038 - Failed to parse body of the 'else' for if-statement", + exprtk_error_location)); + result = false; } } @@ -21096,7 +21292,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR039 - Return types of ternary if-statement differ")); + "ERR039 - Return types of ternary if-statement differ", + exprtk_error_location)); result = false; } @@ -21127,7 +21324,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR040 - Expected '(' at start of if-statement, instead got: '" + current_token().value + "'")); + "ERR040 - Expected '(' at start of if-statement, instead got: '" + current_token().value + "'", + exprtk_error_location)); return error_node(); } @@ -21136,7 +21334,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR041 - Failed to parse condition for if-statement")); + "ERR041 - Failed to parse condition for if-statement", + exprtk_error_location)); return error_node(); } @@ -21167,7 +21366,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR042 - Invalid if-statement")); + "ERR042 - Invalid if-statement", + exprtk_error_location)); free_node(node_allocator_,condition); @@ -21187,7 +21387,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR043 - Encountered invalid condition branch for ternary if-statement")); + "ERR043 - Encountered invalid condition branch for ternary if-statement", + exprtk_error_location)); return error_node(); } @@ -21196,7 +21397,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR044 - Expected '?' after condition of ternary if-statement")); + "ERR044 - Expected '?' after condition of ternary if-statement", + exprtk_error_location)); result = false; } @@ -21205,7 +21407,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR045 - Failed to parse consequent for ternary if-statement")); + "ERR045 - Failed to parse consequent for ternary if-statement", + exprtk_error_location)); result = false; } @@ -21214,7 +21417,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR046 - Expected ':' between ternary if-statement consequent and alternative")); + "ERR046 - Expected ':' between ternary if-statement consequent and alternative", + exprtk_error_location)); result = false; } @@ -21223,7 +21427,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR047 - Failed to parse alternative for ternary if-statement")); + "ERR047 - Failed to parse alternative for ternary if-statement", + exprtk_error_location)); result = false; } @@ -21245,7 +21450,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR048 - Return types of ternary if-statement differ")); + "ERR048 - Return types of ternary if-statement differ", + exprtk_error_location)); result = false; } @@ -21281,7 +21487,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR049 - Expected '(' at start of while-loop condition statement")); + "ERR049 - Expected '(' at start of while-loop condition statement", + exprtk_error_location)); return error_node(); } @@ -21290,7 +21497,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR050 - Failed to parse condition for while-loop")); + "ERR050 - Failed to parse condition for while-loop", + exprtk_error_location)); return error_node(); } @@ -21299,7 +21507,9 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR051 - Expected ')' at end of while-loop condition statement")); + "ERR051 - Expected ')' at end of while-loop condition statement", + exprtk_error_location)); + result = false; } @@ -21322,7 +21532,9 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR053 - Failed to synthesize while-loop")); + "ERR053 - Failed to synthesize while-loop", + exprtk_error_location)); + result = false; } } @@ -21351,7 +21563,7 @@ namespace exprtk std::vector<expression_node_ptr> arg_list; std::vector<bool> side_effect_list; - scoped_vec_delete<expression_node_t> sdd(*this,arg_list); + scoped_vec_delete<expression_node_t> sdd((*this),arg_list); brkcnt_list_.push_front(false); @@ -21396,7 +21608,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR054 - Expected '" + token_t::to_str(seperator) + "' in body of repeat until loop")); + "ERR054 - Expected '" + token_t::to_str(seperator) + "' in body of repeat until loop", + exprtk_error_location)); return error_node(); } @@ -21419,7 +21632,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR055 - Failed to parse body of repeat until loop")); + "ERR055 - Failed to parse body of repeat until loop", + exprtk_error_location)); return error_node(); } @@ -21432,7 +21646,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR056 - Expected '(' before condition statement of repeat until loop")); + "ERR056 - Expected '(' before condition statement of repeat until loop", + exprtk_error_location)); free_node(node_allocator_,branch); @@ -21445,7 +21660,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR057 - Failed to parse condition for repeat until loop")); + "ERR057 - Failed to parse condition for repeat until loop", + exprtk_error_location)); free_node(node_allocator_,branch); @@ -21456,7 +21672,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR058 - Expected ')' after condition of repeat until loop")); + "ERR058 - Expected ')' after condition of repeat until loop", + exprtk_error_location)); free_node(node_allocator_, branch); free_node(node_allocator_, condition); @@ -21476,7 +21693,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR059 - Failed to synthesize repeat until loop")); + "ERR059 - Failed to synthesize repeat until loop", + exprtk_error_location)); free_node(node_allocator_,condition); @@ -21511,7 +21729,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR060 - Expected '(' at start of for-loop")); + "ERR060 - Expected '(' at start of for-loop", + exprtk_error_location)); return error_node(); } @@ -21530,7 +21749,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR061 - Expected a variable at the start of initialiser section of for-loop")); + "ERR061 - Expected a variable at the start of initialiser section of for-loop", + exprtk_error_location)); return error_node(); } @@ -21539,7 +21759,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR062 - Expected variable assignment of initialiser section of for-loop")); + "ERR062 - Expected variable assignment of initialiser section of for-loop", + exprtk_error_location)); return error_node(); } @@ -21553,7 +21774,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR063 - For-loop variable '" + loop_counter_symbol+ "' is being shadowed by a previous declaration")); + "ERR063 - For-loop variable '" + loop_counter_symbol+ "' is being shadowed by a previous declaration", + exprtk_error_location)); return error_node(); } @@ -21584,7 +21806,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR064 - Failed to add new local variable '" + loop_counter_symbol + "' to SEM")); + "ERR064 - Failed to add new local variable '" + loop_counter_symbol + "' to SEM", + exprtk_error_location)); sem_.free_element(nse); @@ -21605,7 +21828,9 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR065 - Failed to parse initialiser of for-loop")); + "ERR065 - Failed to parse initialiser of for-loop", + exprtk_error_location)); + result = false; } else if (!token_is(token_t::e_eof)) @@ -21613,7 +21838,9 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR066 - Expected ';' after initialiser of for-loop")); + "ERR066 - Expected ';' after initialiser of for-loop", + exprtk_error_location)); + result = false; } } @@ -21625,7 +21852,9 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR067 - Failed to parse condition of for-loop")); + "ERR067 - Failed to parse condition of for-loop", + exprtk_error_location)); + result = false; } else if (!token_is(token_t::e_eof)) @@ -21633,7 +21862,9 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR068 - Expected ';' after condition section of for-loop")); + "ERR068 - Expected ';' after condition section of for-loop", + exprtk_error_location)); + result = false; } } @@ -21645,7 +21876,9 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR069 - Failed to parse incrementor of for-loop")); + "ERR069 - Failed to parse incrementor of for-loop", + exprtk_error_location)); + result = false; } else if (!token_is(token_t::e_rbracket)) @@ -21653,7 +21886,9 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR070 - Expected ')' after incrementor section of for-loop")); + "ERR070 - Expected ')' after incrementor section of for-loop", + exprtk_error_location)); + result = false; } } @@ -21667,7 +21902,9 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR071 - Failed to parse body of for-loop")); + "ERR071 - Failed to parse body of for-loop", + exprtk_error_location)); + result = false; } } @@ -21717,12 +21954,13 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR072 - Expected keyword 'switch'")); + "ERR072 - Expected keyword 'switch'", + exprtk_error_location)); return error_node(); } - scoped_vec_delete<expression_node_t> svd(*this,arg_list); + scoped_vec_delete<expression_node_t> svd((*this),arg_list); next_token(); @@ -21731,7 +21969,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR073 - Expected '{' for call to switch statement")); + "ERR073 - Expected '{' for call to switch statement", + exprtk_error_location)); return error_node(); } @@ -21743,7 +21982,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR074 - Expected either a 'case' or 'default' statement")); + "ERR074 - Expected either a 'case' or 'default' statement", + exprtk_error_location)); return error_node(); } @@ -21759,7 +21999,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR075 - Expected ':' for case of switch statement")); + "ERR075 - Expected ':' for case of switch statement", + exprtk_error_location)); return error_node(); } @@ -21773,7 +22014,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR076 - Expected ';' at end of case for switch statement")); + "ERR076 - Expected ';' at end of case for switch statement", + exprtk_error_location)); return error_node(); } @@ -21798,7 +22040,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR077 - Expected ':' for default of switch statement")); + "ERR077 - Expected ':' for default of switch statement", + exprtk_error_location)); return error_node(); } @@ -21819,7 +22062,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR078 - Expected ';' at end of default for switch statement")); + "ERR078 - Expected ';' at end of default for switch statement", + exprtk_error_location)); return error_node(); } @@ -21834,7 +22078,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR079 - Expected '}' at end of switch statement")); + "ERR079 - Expected '}' at end of switch statement", + exprtk_error_location)); return error_node(); } @@ -21856,12 +22101,13 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR080 - Expected token '[*]'")); + "ERR080 - Expected token '[*]'", + exprtk_error_location)); return error_node(); } - scoped_vec_delete<expression_node_t> svd(*this,arg_list); + scoped_vec_delete<expression_node_t> svd((*this),arg_list); next_token(); @@ -21870,7 +22116,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR081 - Expected '{' for call to [*] statement")); + "ERR081 - Expected '{' for call to [*] statement", + exprtk_error_location)); return error_node(); } @@ -21882,7 +22129,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR082 - Expected a 'case' statement for multi-switch")); + "ERR082 - Expected a 'case' statement for multi-switch", + exprtk_error_location)); return error_node(); } @@ -21899,7 +22147,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR083 - Expected ':' for case of [*] statement")); + "ERR083 - Expected ':' for case of [*] statement", + exprtk_error_location)); return error_node(); } @@ -21914,7 +22163,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR084 - Expected ';' at end of case for [*] statement")); + "ERR084 - Expected ';' at end of case for [*] statement", + exprtk_error_location)); return error_node(); } @@ -21942,7 +22192,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR085 - Expected '}' at end of [*] statement")); + "ERR085 - Expected '}' at end of [*] statement", + exprtk_error_location)); return error_node(); } @@ -21983,12 +22234,13 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR086 - Unsupported vararg function: " + symbol)); + "ERR086 - Unsupported vararg function: " + symbol, + exprtk_error_location)); return error_node(); } - scoped_vec_delete<expression_node_t> sdd(*this,arg_list); + scoped_vec_delete<expression_node_t> sdd((*this),arg_list); lodge_symbol(symbol,e_st_function); @@ -21999,7 +22251,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR087 - Expected '(' for call to vararg function: " + symbol)); + "ERR087 - Expected '(' for call to vararg function: " + symbol, + exprtk_error_location)); return error_node(); } @@ -22020,7 +22273,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR088 - Expected ',' for call to vararg function: " + symbol)); + "ERR088 - Expected ',' for call to vararg function: " + symbol, + exprtk_error_location)); return error_node(); } @@ -22040,7 +22294,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR089 - Expected '[' as start of string range definition")); + "ERR089 - Expected '[' as start of string range definition", + exprtk_error_location)); free_node(node_allocator_,expression); @@ -22067,7 +22322,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR090 - Failed to generate string range node")); + "ERR090 - Failed to generate string range node", + exprtk_error_location)); free_node(node_allocator_,expression); } @@ -22203,7 +22459,8 @@ namespace exprtk make_error(parser_error::e_syntax, current_token(), "ERR091 - Expected '" + token_t::to_str(close_bracket) + "' for call to multi-sequence" + - ((!source.empty()) ? std::string(" section of " + source): ""))); + ((!source.empty()) ? std::string(" section of " + source): ""), + exprtk_error_location)); return error_node(); } @@ -22218,7 +22475,7 @@ namespace exprtk expression_node_ptr result = error_node(); - scoped_vec_delete<expression_node_t> sdd(*this,arg_list); + scoped_vec_delete<expression_node_t> sdd((*this),arg_list); scope_handler sh(*this); @@ -22248,7 +22505,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR092 - Expected '" + details::to_str(seperator) + "' for call to multi-sequence section of " + source)); + "ERR092 - Expected '" + details::to_str(seperator) + "' for call to multi-sequence section of " + source, + exprtk_error_location)); return error_node(); } @@ -22281,7 +22539,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR093 - Expected '[' for start of range")); + "ERR093 - Expected '[' for start of range", + exprtk_error_location)); return false; } @@ -22301,7 +22560,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR094 - Failed parse begin section of range")); + "ERR094 - Failed parse begin section of range", + exprtk_error_location)); return false; @@ -22324,7 +22584,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR095 - Range lower bound less than zero! Constraint: r0 >= 0")); + "ERR095 - Range lower bound less than zero! Constraint: r0 >= 0", + exprtk_error_location)); return false; } @@ -22340,9 +22601,11 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR096 - Expected ':' for break in range")); + "ERR096 - Expected ':' for break in range", + exprtk_error_location)); rp.free(); + return false; } } @@ -22361,9 +22624,11 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR097 - Failed parse end section of range")); + "ERR097 - Failed parse end section of range", + exprtk_error_location)); rp.free(); + return false; } @@ -22385,7 +22650,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR098 - Range upper bound less than zero! Constraint: r1 >= 0")); + "ERR098 - Range upper bound less than zero! Constraint: r1 >= 0", + exprtk_error_location)); return false; } @@ -22401,9 +22667,11 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR099 - Expected ']' for start of range")); + "ERR099 - Expected ']' for start of range", + exprtk_error_location)); rp.free(); + return false; } } @@ -22420,7 +22688,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR100 - Invalid range, Constraint: r0 <= r1")); + "ERR100 - Invalid range, Constraint: r0 <= r1", + exprtk_error_location)); return false; } @@ -22444,7 +22713,6 @@ namespace exprtk expression_node_ptr result = error_node(); strvar_node_t const_str_node = static_cast<strvar_node_t>(0); - bool is_const_string = false; scope_element& se = sem_.get_active_element(symbol); @@ -22461,16 +22729,15 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR101 - Unknown string symbol")); + "ERR101 - Unknown string symbol", + exprtk_error_location)); return error_node(); } result = symtab_store_.get_stringvar(symbol); - is_const_string = symtab_store_.is_constant_string(symbol); - - if (is_const_string) + if (symtab_store_.is_constant_string(symbol)) { const_str_node = static_cast<strvar_node_t>(result); result = expression_generator_(const_str_node->str()); @@ -22578,7 +22845,8 @@ namespace exprtk current_token(), "ERR102 - Overflow in range for string: '" + const_str + "'[" + (rp.n0_c.first ? details::to_str(static_cast<int>(rp.n0_c.second)) : "?") + ":" + - (rp.n1_c.first ? details::to_str(static_cast<int>(rp.n1_c.second)) : "?") + "]")); + (rp.n1_c.first ? details::to_str(static_cast<int>(rp.n1_c.second)) : "?") + "]", + exprtk_error_location)); return error_node(); } @@ -22619,7 +22887,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR103 - Symbol '" + symbol+ " not a vector")); + "ERR103 - Symbol '" + symbol+ " not a vector", + exprtk_error_location)); return error_node(); } @@ -22644,7 +22913,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR104 - Failed to parse index for vector: '" + symbol + "'")); + "ERR104 - Failed to parse index for vector: '" + symbol + "'", + exprtk_error_location)); return error_node(); } @@ -22653,7 +22923,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR105 - Expected ']' for index of vector: '" + symbol + "'")); + "ERR105 - Expected ']' for index of vector: '" + symbol + "'", + exprtk_error_location)); free_node(node_allocator_,index_expr); @@ -22672,7 +22943,8 @@ namespace exprtk make_error(parser_error::e_syntax, current_token(), "ERR106 - Index of " + details::to_str(index) + " out of range for " - "vector '" + symbol + "' of size " + details::to_str(vec_size))); + "vector '" + symbol + "' of size " + details::to_str(vec_size), + exprtk_error_location)); free_node(node_allocator_,index_expr); @@ -22689,7 +22961,7 @@ namespace exprtk expression_node_ptr result = error_node(); - scoped_vec_delete<expression_node_t> sdd(*this,arg_list); + scoped_vec_delete<expression_node_t> sdd((*this),arg_list); next_token(); @@ -22703,7 +22975,8 @@ namespace exprtk make_error(parser_error::e_syntax, current_token(), "ERR107 - Zero parameter call to vararg function: " - + vararg_function_name + " not allowed")); + + vararg_function_name + " not allowed", + exprtk_error_location)); return error_node(); } @@ -22727,7 +23000,8 @@ namespace exprtk make_error(parser_error::e_syntax, current_token(), "ERR108 - Expected ',' for call to vararg function: " - + vararg_function_name)); + + vararg_function_name, + exprtk_error_location)); return error_node(); } @@ -22740,7 +23014,8 @@ namespace exprtk make_error(parser_error::e_syntax, current_token(), "ERR109 - Zero parameter call to vararg function: " - + vararg_function_name + " not allowed")); + + vararg_function_name + " not allowed", + exprtk_error_location)); return error_node(); } @@ -22752,7 +23027,8 @@ namespace exprtk current_token(), "ERR110 - Invalid number of parameters to call to vararg function: " + vararg_function_name + ", require at least " - + details::to_str(static_cast<int>(vararg_function->min_num_args())) + " parameters")); + + details::to_str(static_cast<int>(vararg_function->min_num_args())) + " parameters", + exprtk_error_location)); return error_node(); } @@ -22763,7 +23039,8 @@ namespace exprtk current_token(), "ERR111 - Invalid number of parameters to call to vararg function: " + vararg_function_name + ", require no more than " - + details::to_str(static_cast<int>(vararg_function->max_num_args())) + " parameters")); + + details::to_str(static_cast<int>(vararg_function->max_num_args())) + " parameters", + exprtk_error_location)); return error_node(); } @@ -22824,7 +23101,8 @@ namespace exprtk make_error(parser_error::e_syntax, parser_.current_token(), "ERR112 - Failed parameter type check for function '" + function_name_ + "', " - "Expected '" + param_seq_list_[0] + "' call set: '" + param_seq +"'")); + "Expected '" + param_seq_list_[0] + "' call set: '" + param_seq +"'", + exprtk_error_location)); } else { @@ -22844,7 +23122,8 @@ namespace exprtk make_error(parser_error::e_syntax, parser_.current_token(), "ERR113 - Failed parameter type check for function '" + function_name_ + "', " - "Best match: '" + param_seq_list_[max_diff_index] + "' call set: '" + param_seq +"'")); + "Best match: '" + param_seq_list_[max_diff_index] + "' call set: '" + param_seq +"'", + exprtk_error_location)); } return false; @@ -22928,7 +23207,8 @@ namespace exprtk make_error(parser_error::e_syntax, parser_.current_token(), "ERR114 - Invalid parameter sequence of '" + err_param_seq + - "' for function: " + function_name_)); + "' for function: " + function_name_, + exprtk_error_location)); return; } @@ -22949,7 +23229,8 @@ namespace exprtk make_error(parser_error::e_syntax, parser_.current_token(), "ERR115 - Invalid parameter sequence of '" + err_param_seq + - "' for function: " + function_name_)); + "' for function: " + function_name_, + exprtk_error_location)); return; } } @@ -22968,20 +23249,21 @@ namespace exprtk { std::vector<expression_node_ptr> arg_list; - scoped_vec_delete<expression_node_t> sdd(*this,arg_list); + scoped_vec_delete<expression_node_t> sdd((*this),arg_list); next_token(); std::string param_type_list; - type_checker tc(*this,function_name,function->parameter_sequence); + type_checker tc((*this), function_name, function->parameter_sequence); if (tc.invalid()) { set_error( make_error(parser_error::e_syntax, current_token(), - "ERR116 - Type checker instantiation failure for generic function: " + function_name)); + "ERR116 - Type checker instantiation failure for generic function: " + function_name, + exprtk_error_location)); return error_node(); } @@ -22996,7 +23278,8 @@ namespace exprtk make_error(parser_error::e_syntax, current_token(), "ERR117 - Mismatch in zero parameter condition for generic function: " - + function_name)); + + function_name, + exprtk_error_location)); return error_node(); } @@ -23014,7 +23297,8 @@ namespace exprtk make_error(parser_error::e_syntax, current_token(), "ERR118 - Zero parameter call to generic function: " - + function_name + " not allowed")); + + function_name + " not allowed", + exprtk_error_location)); return error_node(); } @@ -23044,7 +23328,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR119 - Expected ',' for call to generic function: " + function_name)); + "ERR119 - Expected ',' for call to generic function: " + function_name, + exprtk_error_location)); return error_node(); } @@ -23061,7 +23346,8 @@ namespace exprtk make_error(parser_error::e_syntax, current_token(), "ERR120 - Zero parameter call to generic function: " - + function_name + " not allowed")); + + function_name + " not allowed", + exprtk_error_location)); return error_node(); } @@ -23076,7 +23362,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR121 - Expected ',' for call to generic function: " + function_name)); + "ERR121 - Expected ',' for call to generic function: " + function_name, + exprtk_error_location)); return error_node(); } @@ -23100,13 +23387,13 @@ namespace exprtk { std::vector<expression_node_ptr> arg_list; - scoped_vec_delete<expression_node_t> sdd(*this,arg_list); + scoped_vec_delete<expression_node_t> sdd((*this),arg_list); next_token(); std::string param_type_list; - type_checker tc(*this,function_name,function->parameter_sequence); + type_checker tc((*this), function_name, function->parameter_sequence); if ( (!function->parameter_sequence.empty()) && @@ -23143,7 +23430,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR122 - Expected ',' for call to string function: " + function_name)); + "ERR122 - Expected ',' for call to string function: " + function_name, + exprtk_error_location)); return error_node(); } @@ -23158,7 +23446,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR123 - Expected ',' for call to string function: " + function_name)); + "ERR123 - Expected ',' for call to string function: " + function_name, + exprtk_error_location)); return error_node(); } @@ -23197,7 +23486,8 @@ namespace exprtk p.set_error( make_error(parser_error::e_syntax, p.current_token(), - "ERR124 - Expected '(' for special function")); + "ERR124 - Expected '(' for special function", + exprtk_error_location)); return error_node(); } @@ -23217,7 +23507,8 @@ namespace exprtk p.set_error( make_error(parser_error::e_syntax, p.current_token(), - "ERR125 - Expected ',' before next parameter of special function")); + "ERR125 - Expected ',' before next parameter of special function", + exprtk_error_location)); return p.error_node(); } @@ -23246,7 +23537,8 @@ namespace exprtk set_error( make_error(parser_error::e_token, current_token(), - "ERR126 - Invalid special function[1]: " + current_token().value)); + "ERR126 - Invalid special function[1]: " + current_token().value, + exprtk_error_location)); return error_node(); } @@ -23259,7 +23551,8 @@ namespace exprtk set_error( make_error(parser_error::e_token, current_token(), - "ERR127 - Invalid special function[2]: " + current_token().value)); + "ERR127 - Invalid special function[2]: " + current_token().value, + exprtk_error_location)); return error_node(); } @@ -23270,8 +23563,8 @@ namespace exprtk switch (NumberOfParameters) { - case 3 : return parse_special_function_impl<T,3>::process(*this,opt_type); - case 4 : return parse_special_function_impl<T,4>::process(*this,opt_type); + case 3 : return parse_special_function_impl<T,3>::process((*this),opt_type); + case 4 : return parse_special_function_impl<T,4>::process((*this),opt_type); default : return error_node(); } } @@ -23290,7 +23583,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR128 - Break call within a break call is not allowed")); + "ERR128 - Break call within a break call is not allowed", + exprtk_error_location)); return error_node(); } @@ -23312,7 +23606,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR129 - Failed to parse return expression for 'break' statement")); + "ERR129 - Failed to parse return expression for 'break' statement", + exprtk_error_location)); return error_node(); } @@ -23321,7 +23616,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR130 - Expected ']' at the completion of break's return expression")); + "ERR130 - Expected ']' at the completion of break's return expression", + exprtk_error_location)); free_node(node_allocator_,return_expr); @@ -23338,7 +23634,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR131 - Invalid use of 'break', allowed only in the scope of a loop")); + "ERR131 - Invalid use of 'break', allowed only in the scope of a loop", + exprtk_error_location)); } return error_node(); @@ -23360,7 +23657,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR132 - Invalid use of 'continue', allowed only in the scope of a loop")); + "ERR132 - Invalid use of 'continue', allowed only in the scope of a loop", + exprtk_error_location)); return error_node(); } @@ -23376,7 +23674,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR133 - Expected '[' as part of vector size definition")); + "ERR133 - Expected '[' as part of vector size definition", + exprtk_error_location)); return error_node(); } @@ -23385,7 +23684,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR134 - Failed to determine size of vector '" + vec_name + "'")); + "ERR134 - Failed to determine size of vector '" + vec_name + "'", + exprtk_error_location)); return error_node(); } @@ -23396,7 +23696,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR135 - Expected a literal number as size of vector '" + vec_name + "'")); + "ERR135 - Expected a literal number as size of vector '" + vec_name + "'", + exprtk_error_location)); return error_node(); } @@ -23415,14 +23716,15 @@ namespace exprtk make_error(parser_error::e_syntax, current_token(), "ERR136 - Invalid vector size. Must be an integer greater than zero, size: " + - details::to_str(details::numeric::to_int32(vector_size)))); + details::to_str(details::numeric::to_int32(vector_size)), + exprtk_error_location)); return error_node(); } std::vector<expression_node_ptr> vec_initilizer_list; - scoped_vec_delete<expression_node_t> svd(*this,vec_initilizer_list); + scoped_vec_delete<expression_node_t> svd((*this),vec_initilizer_list); bool single_value_initialiser = false; bool vec_to_vec_initialiser = false; @@ -23433,7 +23735,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR137 - Expected ']' as part of vector size definition")); + "ERR137 - Expected ']' as part of vector size definition", + exprtk_error_location)); return error_node(); } @@ -23444,7 +23747,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR138 - Expected ':=' as part of vector definition")); + "ERR138 - Expected ':=' as part of vector definition", + exprtk_error_location)); return error_node(); } @@ -23457,7 +23761,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR139 - Failed to parse single vector initialiser")); + "ERR139 - Failed to parse single vector initialiser", + exprtk_error_location)); return error_node(); } @@ -23469,7 +23774,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR140 - Expected ']' to close single value vector initialiser")); + "ERR140 - Expected ']' to close single value vector initialiser", + exprtk_error_location)); return error_node(); } @@ -23515,7 +23821,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR141 - Expected '{' as part of vector initialiser list")); + "ERR141 - Expected '{' as part of vector initialiser list", + exprtk_error_location)); return error_node(); } @@ -23534,7 +23841,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR142 - Expected '{' as part of vector initialiser list")); + "ERR142 - Expected '{' as part of vector initialiser list", + exprtk_error_location)); return error_node(); } @@ -23551,7 +23859,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR143 - Expected ',' between vector initialisers")); + "ERR143 - Expected ',' between vector initialisers", + exprtk_error_location)); return error_node(); } @@ -23572,7 +23881,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR144 - Expected ';' at end of vector definition")); + "ERR144 - Expected ';' at end of vector definition", + exprtk_error_location)); return error_node(); } @@ -23583,7 +23893,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR145 - Initialiser list larger than the number of elements in the vector: '" + vec_name + "'")); + "ERR145 - Initialiser list larger than the number of elements in the vector: '" + vec_name + "'", + exprtk_error_location)); return error_node(); } @@ -23602,7 +23913,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR146 - Illegal redefinition of local vector: '" + vec_name + "'")); + "ERR146 - Illegal redefinition of local vector: '" + vec_name + "'", + exprtk_error_location)); return error_node(); } @@ -23635,7 +23947,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR147 - Failed to add new local vector '" + vec_name + "' to SEM")); + "ERR147 - Failed to add new local vector '" + vec_name + "' to SEM", + exprtk_error_location)); sem_.free_element(nse); @@ -23689,7 +24002,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR148 - Illegal redefinition of local variable: '" + str_name + "'")); + "ERR148 - Illegal redefinition of local variable: '" + str_name + "'", + exprtk_error_location)); free_node(node_allocator_,initialisation_expression); @@ -23720,7 +24034,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR149 - Failed to add new local string variable '" + str_name + "' to SEM")); + "ERR149 - Failed to add new local string variable '" + str_name + "' to SEM", + exprtk_error_location)); free_node(node_allocator_,initialisation_expression); @@ -23765,7 +24080,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR150 - Illegal variable definition")); + "ERR150 - Illegal variable definition", + exprtk_error_location)); return error_node(); } @@ -23785,7 +24101,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR151 - Expected a symbol for variable definition")); + "ERR151 - Expected a symbol for variable definition", + exprtk_error_location)); return error_node(); } @@ -23794,7 +24111,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR152 - Illegal redefinition of reserved keyword: '" + var_name + "'")); + "ERR152 - Illegal redefinition of reserved keyword: '" + var_name + "'", + exprtk_error_location)); return error_node(); } @@ -23803,7 +24121,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR153 - Illegal redefinition of variable '" + var_name + "'")); + "ERR153 - Illegal redefinition of variable '" + var_name + "'", + exprtk_error_location)); return error_node(); } @@ -23812,7 +24131,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR154 - Illegal redefinition of local variable: '" + var_name + "'")); + "ERR154 - Illegal redefinition of local variable: '" + var_name + "'", + exprtk_error_location)); return error_node(); } @@ -23831,7 +24151,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR155 - Failed to parse initialisation expression")); + "ERR155 - Failed to parse initialisation expression", + exprtk_error_location)); return error_node(); } @@ -23848,7 +24169,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR156 - Expected ';' after variable definition")); + "ERR156 - Expected ';' after variable definition", + exprtk_error_location)); free_node(node_allocator_,initialisation_expression); @@ -23875,7 +24197,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR157 - Illegal redefinition of local variable: '" + var_name + "'")); + "ERR157 - Illegal redefinition of local variable: '" + var_name + "'", + exprtk_error_location)); free_node(node_allocator_, initialisation_expression); @@ -23906,7 +24229,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR158 - Failed to add new local variable '" + var_name + "' to SEM")); + "ERR158 - Failed to add new local variable '" + var_name + "' to SEM", + exprtk_error_location)); free_node(node_allocator_, initialisation_expression); @@ -23942,7 +24266,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR159 - Expected a '{}' for uninitialised var definition")); + "ERR159 - Expected a '{}' for uninitialised var definition", + exprtk_error_location)); return error_node(); } @@ -23951,7 +24276,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR160 - Expected ';' after uninitialised variable definition")); + "ERR160 - Expected ';' after uninitialised variable definition", + exprtk_error_location)); return error_node(); } @@ -23967,7 +24293,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR161 - Illegal redefinition of local variable: '" + var_name + "'")); + "ERR161 - Illegal redefinition of local variable: '" + var_name + "'", + exprtk_error_location)); return error_node(); } @@ -23996,7 +24323,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR162 - Failed to add new local variable '" + var_name + "' to SEM")); + "ERR162 - Failed to add new local variable '" + var_name + "' to SEM", + exprtk_error_location)); sem_.free_element(nse); @@ -24028,7 +24356,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR163 - Expected '(' at start of swap statement")); + "ERR163 - Expected '(' at start of swap statement", + exprtk_error_location)); return error_node(); } @@ -24046,7 +24375,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR164 - Expected a symbol for variable or vector element definition")); + "ERR164 - Expected a symbol for variable or vector element definition", + exprtk_error_location)); return error_node(); } @@ -24057,7 +24387,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR165 - First parameter to swap is an invalid vector element: '" + var0_name + "'")); + "ERR165 - First parameter to swap is an invalid vector element: '" + var0_name + "'", + exprtk_error_location)); return error_node(); } @@ -24089,7 +24420,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR166 - First parameter to swap is an invalid variable: '" + var0_name + "'")); + "ERR166 - First parameter to swap is an invalid variable: '" + var0_name + "'", + exprtk_error_location)); return error_node(); } @@ -24102,7 +24434,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR167 - Expected ',' between parameters to swap")); + "ERR167 - Expected ',' between parameters to swap", + exprtk_error_location)); if (variable0_generated) { @@ -24119,7 +24452,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR168 - Expected a symbol for variable or vector element definition")); + "ERR168 - Expected a symbol for variable or vector element definition", + exprtk_error_location)); if (variable0_generated) { @@ -24135,7 +24469,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR169 - Second parameter to swap is an invalid vector element: '" + var1_name + "'")); + "ERR169 - Second parameter to swap is an invalid vector element: '" + var1_name + "'", + exprtk_error_location)); if (variable0_generated) { @@ -24172,7 +24507,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR170 - Second parameter to swap is an invalid variable: '" + var1_name + "'")); + "ERR170 - Second parameter to swap is an invalid variable: '" + var1_name + "'", + exprtk_error_location)); if (variable0_generated) { @@ -24190,7 +24526,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR171 - Expected ')' at end of swap statement")); + "ERR171 - Expected ')' at end of swap statement", + exprtk_error_location)); if (variable0_generated) { @@ -24246,7 +24583,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR172 - Return call within a return call is not allowed")); + "ERR172 - Return call within a return call is not allowed", + exprtk_error_location)); return error_node(); } @@ -24255,7 +24593,7 @@ namespace exprtk std::vector<expression_node_ptr> arg_list; - scoped_vec_delete<expression_node_t> sdd(*this,arg_list); + scoped_vec_delete<expression_node_t> sdd((*this),arg_list); if (!details::imatch(current_token().value,"return")) { @@ -24269,7 +24607,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR173 - Expected '[' at start of return statement")); + "ERR173 - Expected '[' at start of return statement", + exprtk_error_location)); return error_node(); } @@ -24291,7 +24630,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR174 - Expected ',' between values during call to return")); + "ERR174 - Expected ',' between values during call to return", + exprtk_error_location)); return error_node(); } @@ -24302,7 +24642,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR175 - Zero parameter return statement not allowed")); + "ERR175 - Zero parameter return statement not allowed", + exprtk_error_location)); return error_node(); } @@ -24316,7 +24657,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, prev_token, - "ERR176 - Invalid ']' found during return call")); + "ERR176 - Invalid ']' found during return call", + exprtk_error_location)); return error_node(); } @@ -24368,7 +24710,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR177 - Invalid sequence of variable '"+ symbol + "' and bracket")); + "ERR177 - Invalid sequence of variable '"+ symbol + "' and bracket", + exprtk_error_location)); return false; } @@ -24415,7 +24758,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR178 - Invalid sequence of brackets")); + "ERR178 - Invalid sequence of brackets", + exprtk_error_location)); return false; } @@ -24511,7 +24855,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR179 - Failed to generate node for function: '" + symbol + "'")); + "ERR179 - Failed to generate node for function: '" + symbol + "'", + exprtk_error_location)); return error_node(); } @@ -24536,7 +24881,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR180 - Failed to generate node for vararg function: '" + symbol + "'")); + "ERR180 - Failed to generate node for vararg function: '" + symbol + "'", + exprtk_error_location)); return error_node(); } @@ -24561,7 +24907,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR181 - Failed to generate node for generic function: '" + symbol + "'")); + "ERR181 - Failed to generate node for generic function: '" + symbol + "'", + exprtk_error_location)); return error_node(); } @@ -24587,7 +24934,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR182 - Failed to generate node for string function: '" + symbol + "'")); + "ERR182 - Failed to generate node for string function: '" + symbol + "'", + exprtk_error_location)); return error_node(); } @@ -24612,7 +24960,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR183 - Invalid use of reserved symbol '" + symbol + "'")); + "ERR183 - Invalid use of reserved symbol '" + symbol + "'", + exprtk_error_location)); return error_node(); } @@ -24675,7 +25024,8 @@ namespace exprtk make_error(parser_error::e_symtab, current_token(), "ERR184 - Failed to create variable: '" + symbol + "'" + - (error_message.empty() ? "" : " - " + error_message))); + (error_message.empty() ? "" : " - " + error_message), + exprtk_error_location)); } else if (unknown_symbol_resolver::e_usrmode_extended == unknown_symbol_resolver_->mode) @@ -24694,7 +25044,8 @@ namespace exprtk make_error(parser_error::e_symtab, current_token(), "ERR185 - Failed to resolve symbol: '" + symbol + "'" + - (error_message.empty() ? "" : " - " + error_message))); + (error_message.empty() ? "" : " - " + error_message), + exprtk_error_location)); } return error_node(); @@ -24704,7 +25055,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR186 - Undefined symbol: '" + symbol + "'")); + "ERR186 - Undefined symbol: '" + symbol + "'", + exprtk_error_location)); return error_node(); } @@ -24810,7 +25162,8 @@ namespace exprtk set_error( make_error(parser_error::e_symtab, current_token(), - "ERR187 - Variable or function detected, yet symbol-table is invalid, Symbol: " + current_token().value)); + "ERR187 - Variable or function detected, yet symbol-table is invalid, Symbol: " + current_token().value, + exprtk_error_location)); return error_node(); } @@ -24827,6 +25180,18 @@ namespace exprtk if (details::string_to_real(current_token().value, numeric_value)) { expression_node_ptr literal_exp = expression_generator_(numeric_value); + + if (0 == literal_exp) + { + set_error( + make_error(parser_error::e_numeric, + current_token(), + "ERR188 - Failed generate node for scalar: '" + current_token().value + "'", + exprtk_error_location)); + + return error_node(); + } + next_token(); branch = literal_exp; } @@ -24835,7 +25200,8 @@ namespace exprtk set_error( make_error(parser_error::e_numeric, current_token(), - "ERR188 - Failed to convert '" + current_token().value + "' to a number")); + "ERR189 - Failed to convert '" + current_token().value + "' to a number", + exprtk_error_location)); return error_node(); } @@ -24861,7 +25227,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR189 - Expected ')' instead of: '" + current_token().value + "'")); + "ERR190 - Expected ')' instead of: '" + current_token().value + "'", + exprtk_error_location)); free_node(node_allocator_,branch); @@ -24885,7 +25252,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR190 - Expected ']' instead of: '" + current_token().value + "'")); + "ERR191 - Expected ']' instead of: '" + current_token().value + "'", + exprtk_error_location)); free_node(node_allocator_,branch); @@ -24909,7 +25277,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR191 - Expected '}' instead of: '" + current_token().value + "'")); + "ERR192 - Expected '}' instead of: '" + current_token().value + "'", + exprtk_error_location)); free_node(node_allocator_,branch); @@ -24948,7 +25317,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR192 - Premature end of expression[1]")); + "ERR193 - Premature end of expression[1]", + exprtk_error_location)); return error_node(); } @@ -24957,7 +25327,8 @@ namespace exprtk set_error( make_error(parser_error::e_syntax, current_token(), - "ERR193 - Premature end of expression[2]")); + "ERR194 - Premature end of expression[2]", + exprtk_error_location)); return error_node(); } @@ -25135,28 +25506,28 @@ namespace exprtk return (*inv_binary_op_map_).find(bop)->second; } - inline expression_node_ptr operator()(const Type& v) const + inline expression_node_ptr operator() (const Type& v) const { return node_allocator_->allocate<literal_node_t>(v); } #ifndef exprtk_disable_string_capabilities - inline expression_node_ptr operator()(const std::string& s) const + inline expression_node_ptr operator() (const std::string& s) const { return node_allocator_->allocate<string_literal_node_t>(s); } - inline expression_node_ptr operator()(std::string& s, range_t& rp) const + inline expression_node_ptr operator() (std::string& s, range_t& rp) const { return node_allocator_->allocate_rr<string_range_node_t>(s,rp); } - inline expression_node_ptr operator()(const std::string& s, range_t& rp) const + inline expression_node_ptr operator() (const std::string& s, range_t& rp) const { return node_allocator_->allocate_tt<const_string_range_node_t>(s,rp); } - inline expression_node_ptr operator()(expression_node_ptr branch, range_t& rp) const + inline expression_node_ptr operator() (expression_node_ptr branch, range_t& rp) const { if (is_generally_string_node(branch)) return node_allocator_->allocate_tt<generic_string_range_node_t>(branch,rp); @@ -25237,22 +25608,36 @@ namespace exprtk return true; } - inline expression_node_ptr operator()(const details::operator_type& operation, expression_node_ptr (&branch)[1]) + inline expression_node_ptr operator() (const details::operator_type& operation, expression_node_ptr (&branch)[1]) { if (0 == branch[0]) + { return error_node(); + } else if (details::is_null_node(branch[0])) + { return branch[0]; + } else if (details::is_break_node(branch[0])) + { return error_node(); + } else if (details::is_continue_node(branch[0])) + { return error_node(); + } else if (details::is_constant_node(branch[0])) + { return synthesize_expression<unary_node_t,1>(operation,branch); + } else if (unary_optimisable(operation) && details::is_variable_node(branch[0])) + { return synthesize_uv_expression(operation,branch); + } else if (unary_optimisable(operation) && details::is_ivector_node(branch[0])) + { return synthesize_uvec_expression(operation,branch); + } else return synthesize_unary_expression(operation,branch); } @@ -25297,24 +25682,24 @@ namespace exprtk { switch (operation) { - case details::e_add : return "+"; - case details::e_sub : return "-"; - case details::e_mul : return "*"; - case details::e_div : return "/"; - case details::e_mod : return "%"; - case details::e_pow : return "^"; - case details::e_lt : return "<"; - case details::e_lte : return "<="; - case details::e_gt : return ">"; - case details::e_gte : return ">="; - case details::e_eq : return "=="; - case details::e_ne : return "!="; - case details::e_and : return "and"; - case details::e_nand : return "nand"; - case details::e_or : return "or"; - case details::e_nor : return "nor"; - case details::e_xor : return "xor"; - case details::e_xnor : return "xnor"; + case details::e_add : return "+" ; + case details::e_sub : return "-" ; + case details::e_mul : return "*" ; + case details::e_div : return "/" ; + case details::e_mod : return "%" ; + case details::e_pow : return "^" ; + case details::e_lt : return "<" ; + case details::e_lte : return "<=" ; + case details::e_gt : return ">" ; + case details::e_gte : return ">=" ; + case details::e_eq : return "==" ; + case details::e_ne : return "!=" ; + case details::e_and : return "and" ; + case details::e_nand : return "nand" ; + case details::e_or : return "or" ; + case details::e_nor : return "nor" ; + case details::e_xor : return "xor" ; + case details::e_xnor : return "xnor" ; default : return "UNKNOWN"; } } @@ -25665,42 +26050,70 @@ namespace exprtk ); } - inline expression_node_ptr operator()(const details::operator_type& operation, expression_node_ptr (&branch)[2]) + inline expression_node_ptr operator() (const details::operator_type& operation, expression_node_ptr (&branch)[2]) { if ((0 == branch[0]) || (0 == branch[1])) + { return error_node(); + } else if (is_invalid_string_op(operation,branch)) + { return error_node(); + } else if (is_invalid_assignment_op(operation,branch)) + { return error_node(); + } else if (is_invalid_break_continue_op(branch)) + { return error_node(); + } else if (details::e_assign == operation) - return synthesize_assignment_expression(operation,branch); + { + return synthesize_assignment_expression(operation, branch); + } else if (details::e_swap == operation) + { return synthesize_swap_expression(branch); + } else if (is_assignment_operation(operation)) - return synthesize_assignment_operation_expression(operation,branch); - else if (is_vector_eqineq_logic_operation(operation,branch)) - return synthesize_veceqineqlogic_operation_expression(operation,branch); - else if (is_vector_arithmetic_operation(operation,branch)) - return synthesize_vecarithmetic_operation_expression(operation,branch); + { + return synthesize_assignment_operation_expression(operation, branch); + } + else if (is_vector_eqineq_logic_operation(operation, branch)) + { + return synthesize_veceqineqlogic_operation_expression(operation, branch); + } + else if (is_vector_arithmetic_operation(operation, branch)) + { + return synthesize_vecarithmetic_operation_expression(operation, branch); + } else if (is_shortcircuit_expression(operation)) - return synthesize_shortcircuit_expression(operation,branch); - else if (is_string_operation(operation,branch)) - return synthesize_string_expression(operation,branch); + { + return synthesize_shortcircuit_expression(operation, branch); + } + else if (is_string_operation(operation, branch)) + { + return synthesize_string_expression(operation, branch); + } else if (is_null_present(branch)) + { return synthesize_null_expression(operation, branch); + } #ifndef exprtk_disable_cardinal_pow_optimisation else if (is_constpow_operation(operation, branch)) + { return cardinal_pow_optimisation(branch); + } #endif expression_node_ptr result = error_node(); #ifndef exprtk_disable_enhanced_features - if (synthesize_expression(operation,branch,result)) + if (synthesize_expression(operation, branch, result)) + { return result; + } else #endif @@ -25714,36 +26127,54 @@ namespace exprtk */ result = error_node(); - if (cocob_optimisable(operation,branch)) - result = synthesize_cocob_expression::process(*this,operation,branch); - else if (coboc_optimisable(operation,branch) && (0 == result)) - result = synthesize_coboc_expression::process(*this,operation,branch); + if (cocob_optimisable(operation, branch)) + { + result = synthesize_cocob_expression::process((*this), operation, branch); + } + else if (coboc_optimisable(operation, branch) && (0 == result)) + { + result = synthesize_coboc_expression::process((*this), operation, branch); + } if (result) return result; } - if (uvouv_optimisable(operation,branch)) - return synthesize_uvouv_expression(operation,branch); - else if (vob_optimisable(operation,branch)) - return synthesize_vob_expression::process(*this,operation,branch); - else if (bov_optimisable(operation,branch)) - return synthesize_bov_expression::process(*this,operation,branch); - else if (cob_optimisable(operation,branch)) - return synthesize_cob_expression::process(*this,operation,branch); - else if (boc_optimisable(operation,branch)) - return synthesize_boc_expression::process(*this,operation,branch); + if (uvouv_optimisable(operation, branch)) + { + return synthesize_uvouv_expression(operation, branch); + } + else if (vob_optimisable(operation, branch)) + { + return synthesize_vob_expression::process((*this), operation, branch); + } + else if (bov_optimisable(operation, branch)) + { + return synthesize_bov_expression::process((*this), operation, branch); + } + else if (cob_optimisable(operation, branch)) + { + return synthesize_cob_expression::process((*this), operation, branch); + } + else if (boc_optimisable(operation, branch)) + { + return synthesize_boc_expression::process((*this), operation, branch); + } #ifndef exprtk_disable_enhanced_features - else if (cov_optimisable(operation,branch)) - return synthesize_cov_expression::process(*this,operation,branch); + else if (cov_optimisable(operation, branch)) + { + return synthesize_cov_expression::process((*this), operation, branch); + } #endif - else if (binext_optimisable(operation,branch)) - return synthesize_binary_ext_expression::process(*this,operation,branch); + else if (binext_optimisable(operation, branch)) + { + return synthesize_binary_ext_expression::process((*this), operation, branch); + } else - return synthesize_expression<binary_node_t,2>(operation,branch); + return synthesize_expression<binary_node_t,2>(operation, branch); } - inline expression_node_ptr operator()(const details::operator_type& operation, expression_node_ptr (&branch)[3]) + inline expression_node_ptr operator() (const details::operator_type& operation, expression_node_ptr (&branch)[3]) { if ( (0 == branch[0]) || @@ -25755,26 +26186,30 @@ namespace exprtk return error_node(); } - else if (is_invalid_string_op(operation,branch)) + else if (is_invalid_string_op(operation, branch)) + { return error_node(); - else if (is_string_operation(operation,branch)) - return synthesize_string_expression(operation,branch); + } + else if (is_string_operation(operation, branch)) + { + return synthesize_string_expression(operation, branch); + } else - return synthesize_expression<trinary_node_t,3>(operation,branch); + return synthesize_expression<trinary_node_t,3>(operation, branch); } - inline expression_node_ptr operator()(const details::operator_type& operation, expression_node_ptr (&branch)[4]) + inline expression_node_ptr operator() (const details::operator_type& operation, expression_node_ptr (&branch)[4]) { return synthesize_expression<quaternary_node_t,4>(operation,branch); } - inline expression_node_ptr operator()(const details::operator_type& operation, expression_node_ptr b0) + inline expression_node_ptr operator() (const details::operator_type& operation, expression_node_ptr b0) { expression_node_ptr branch[1] = { b0 }; return (*this)(operation,branch); } - inline expression_node_ptr operator()(const details::operator_type& operation, expression_node_ptr b0, expression_node_ptr b1) + inline expression_node_ptr operator() (const details::operator_type& operation, expression_node_ptr b0, expression_node_ptr b1) { if ((0 == b0) || (0 == b1)) return error_node(); @@ -26091,6 +26526,7 @@ namespace exprtk static inline T process(const arg_list_t& arg) { case_stmt(0) + return arg.back()->value(); } }; @@ -26100,6 +26536,7 @@ namespace exprtk static inline T process(const arg_list_t& arg) { case_stmt(0) case_stmt(1) + return arg.back()->value(); } }; @@ -26110,6 +26547,7 @@ namespace exprtk { case_stmt(0) case_stmt(1) case_stmt(2) + return arg.back()->value(); } }; @@ -26120,6 +26558,7 @@ namespace exprtk { case_stmt(0) case_stmt(1) case_stmt(2) case_stmt(3) + return arg.back()->value(); } }; @@ -26131,6 +26570,7 @@ namespace exprtk case_stmt(0) case_stmt(1) case_stmt(2) case_stmt(3) case_stmt(4) + return arg.back()->value(); } }; @@ -26142,6 +26582,7 @@ namespace exprtk case_stmt(0) case_stmt(1) case_stmt(2) case_stmt(3) case_stmt(4) case_stmt(5) + return arg.back()->value(); } }; @@ -26154,6 +26595,7 @@ namespace exprtk case_stmt(2) case_stmt(3) case_stmt(4) case_stmt(5) case_stmt(6) + return arg.back()->value(); } }; @@ -26336,7 +26778,7 @@ namespace exprtk default : return error_node(); } - T v = temp_node->value(); + const T v = temp_node->value(); details::free_node(*node_allocator_,temp_node); @@ -26439,7 +26881,8 @@ namespace exprtk default : return error_node(); } - T v = temp_node->value(); + const T v = temp_node->value(); + details::free_node(*node_allocator_,temp_node); return node_allocator_->allocate<literal_node_t>(v); @@ -26538,7 +26981,8 @@ namespace exprtk default : return error_node(); } - T v = temp_node->value(); + const T v = temp_node->value(); + details::free_node(*node_allocator_,temp_node); return node_allocator_->allocate<literal_node_t>(v); @@ -26712,7 +27156,7 @@ namespace exprtk is_constant_foldable(arg_list) ) { - Type v = result->value(); + const Type v = result->value(); details::free_node(*node_allocator_,result); result = node_allocator_->allocate<literal_node_t>(v); } @@ -26754,13 +27198,17 @@ namespace exprtk ) { genfunc_node_ptr->init_branches(); - Type v = result->value(); + + const Type v = result->value(); + details::free_node(*node_allocator_,result); + return node_allocator_->allocate<literal_node_t>(v); } else if (genfunc_node_ptr->init_branches()) { parser_->state_.activate_side_effect("generic_function_call()"); + return result; } else @@ -26805,7 +27253,7 @@ namespace exprtk { strfunc_node_ptr->init_branches(); - Type v = result->value(); + const Type v = result->value(); details::free_node(*node_allocator_,result); @@ -26819,7 +27267,7 @@ namespace exprtk } else { - details::free_node(*node_allocator_,result); + details::free_node (*node_allocator_,result ); details::free_all_nodes(*node_allocator_,arg_list); return error_node(); @@ -26851,7 +27299,7 @@ namespace exprtk } else { - details::free_node(*node_allocator_,result); + details::free_node (*node_allocator_,result ); details::free_all_nodes(*node_allocator_,arg_list); return error_node(); @@ -27057,13 +27505,13 @@ namespace exprtk { lodge_assignment(e_st_string,branch[0]); - return synthesize_expression<assignment_string_node_t,2>(operation,branch); + return synthesize_expression<assignment_string_node_t,2>(operation, branch); } else if (details::is_string_range_node(branch[0])) { lodge_assignment(e_st_string,branch[0]); - return synthesize_expression<assignment_string_range_node_t,2>(operation,branch); + return synthesize_expression<assignment_string_range_node_t,2>(operation, branch); } #endif else if (details::is_vector_node(branch[0])) @@ -27071,9 +27519,9 @@ namespace exprtk lodge_assignment(e_st_vector,branch[0]); if (details::is_ivector_node(branch[1])) - return synthesize_expression<assignment_vecvec_node_t,2>(operation,branch); + return synthesize_expression<assignment_vecvec_node_t,2>(operation, branch); else - return synthesize_expression<assignment_vec_node_t,2>(operation,branch); + return synthesize_expression<assignment_vec_node_t,2>(operation, branch); } else { @@ -27359,8 +27807,8 @@ namespace exprtk const bool v0_is_ivar = details::is_ivariable_node(branch[0]); const bool v1_is_ivar = details::is_ivariable_node(branch[1]); - const bool v0_is_ivec = details::is_ivector_node(branch[0]); - const bool v1_is_ivec = details::is_ivector_node(branch[1]); + const bool v0_is_ivec = details::is_ivector_node (branch[0]); + const bool v1_is_ivec = details::is_ivector_node (branch[1]); #ifndef exprtk_disable_string_capabilities const bool v0_is_str = details::is_generally_string_node(branch[0]); @@ -27454,9 +27902,13 @@ namespace exprtk return result; } else if (details::e_scand == operation) - return synthesize_expression<scand_node_t,2>(operation,branch); + { + return synthesize_expression<scand_node_t,2>(operation, branch); + } else if (details::e_scor == operation) - return synthesize_expression<scor_node_t,2>(operation,branch); + { + return synthesize_expression<scor_node_t,2>(operation, branch); + } else return error_node(); } @@ -27721,7 +28173,7 @@ namespace exprtk #define case_stmt(op0,op1) \ case op0 : return expr_gen.node_allocator_-> \ template allocate<typename details::binary_ext_node<Type,op1<Type> > > \ - (branch[0],branch[1]); \ + (branch[0], branch[1]); \ basic_opr_switch_statements extended_opr_switch_statements @@ -27880,7 +28332,7 @@ namespace exprtk #define case_stmt(op0,op1) \ case op0 : return expr_gen.node_allocator_-> \ template allocate_cr<typename details::bov_node<Type,op1<Type> > > \ - (branch[0],v); \ + (branch[0], v); \ basic_opr_switch_statements extended_opr_switch_statements @@ -28014,7 +28466,7 @@ namespace exprtk #define case_stmt(op0,op1) \ case op0 : return expr_gen.node_allocator_-> \ template allocate_tt<typename details::cob_node<Type,op1<Type> > > \ - (c, branch[1]); \ + (c, branch[1]); \ basic_opr_switch_statements extended_opr_switch_statements @@ -28078,7 +28530,7 @@ namespace exprtk else if (operation == details::e_div) { details::boc_base_node<Type>* bocnode = static_cast<details::boc_base_node<Type>*>(branch[0]); - details::operator_type boc_opr = bocnode->operation(); + details::operator_type boc_opr = bocnode->operation(); if ( (details::e_div == boc_opr) || @@ -28099,7 +28551,7 @@ namespace exprtk { // (v ^ c0) ^ c1 --> v ^(c0 * c1) details::boc_base_node<Type>* bocnode = static_cast<details::boc_base_node<Type>*>(branch[0]); - details::operator_type boc_opr = bocnode->operation(); + details::operator_type boc_opr = bocnode->operation(); if (details::e_pow == boc_opr) { @@ -28174,16 +28626,19 @@ namespace exprtk else if (std::equal_to<T>()(T(0),c) && (details::e_add == operation)) { free_node(*expr_gen.node_allocator_, branch[1]); + return branch[0]; } else if (std::equal_to<T>()(T(1),c) && (details::e_mul == operation)) { free_node(*expr_gen.node_allocator_, branch[1]); + return branch[0]; } else if (std::equal_to<T>()(T(1),c) && (details::e_div == operation)) { free_node(*expr_gen.node_allocator_, branch[1]); + return branch[0]; } @@ -28225,7 +28680,7 @@ namespace exprtk template allocate_tt<typename details::cob_node<Type,details::div_op<Type> > > (cobnode->c() / c, cobnode->move_branch(0)); - free_node(*expr_gen.node_allocator_,branch[0]); + free_node(*expr_gen.node_allocator_, branch[0]); } } @@ -28239,6 +28694,7 @@ namespace exprtk else if (details::is_cob_node(branch[1])) { details::cob_base_node<Type>* cobnode = static_cast<details::cob_base_node<Type>*>(branch[1]); + const Type c = static_cast<details::literal_node<Type>*>(branch[0])->value(); if (std::equal_to<T>()(T(0),c) && (details::e_mul == operation)) @@ -28258,11 +28714,13 @@ namespace exprtk else if (std::equal_to<T>()(T(0),c) && (details::e_add == operation)) { free_node(*expr_gen.node_allocator_, branch[0]); + return branch[1]; } else if (std::equal_to<T>()(T(1),c) && (details::e_mul == operation)) { free_node(*expr_gen.node_allocator_, branch[0]); + return branch[1]; } @@ -28416,6 +28874,7 @@ namespace exprtk else if (details::is_boc_node(branch[1])) { details::boc_base_node<Type>* bocnode = static_cast<details::boc_base_node<Type>*>(branch[1]); + const Type c = static_cast<details::literal_node<Type>*>(branch[0])->value(); if (details::e_add == bocnode->operation()) @@ -28508,11 +28967,11 @@ namespace exprtk const std::string node_id = branch_to_id(branch); - typename synthesize_map_t::iterator itr = synthesize_map_.find(node_id); + const typename synthesize_map_t::iterator itr = synthesize_map_.find(node_id); if (synthesize_map_.end() != itr) { - result = itr->second(*this, operation, branch); + result = itr->second((*this), operation, branch); return true; } @@ -28551,7 +29010,7 @@ namespace exprtk expression_node_ptr (&branch)[2]) { const Type c = static_cast<details::literal_node<Type>*> (branch[0])->value(); - const Type& v = static_cast<details::variable_node<Type>*>(branch[1])->ref(); + const Type& v = static_cast<details::variable_node<Type>*>(branch[1])->ref (); details::free_node(*(expr_gen.node_allocator_),branch[0]); @@ -28585,7 +29044,7 @@ namespace exprtk const details::operator_type& operation, expression_node_ptr (&branch)[2]) { - const Type& v = static_cast<details::variable_node<Type>*>(branch[0])->ref(); + const Type& v = static_cast<details::variable_node<Type>*>(branch[0])->ref (); const Type c = static_cast<details::literal_node<Type>*> (branch[1])->value(); details::free_node(*(expr_gen.node_allocator_), branch[1]); @@ -28634,7 +29093,7 @@ namespace exprtk { #define case_stmt(op) \ case details::e_sf##op : return details::T0oT1oT2_sf3ext<T,T0,T1,T2,details::sf##op##_op<Type> >:: \ - allocate(*(expr_gen.node_allocator_),t0,t1,t2); \ + allocate(*(expr_gen.node_allocator_), t0, t1, t2); \ case_stmt(00) case_stmt(01) case_stmt(02) case_stmt(03) case_stmt(04) case_stmt(05) case_stmt(06) case_stmt(07) @@ -29376,7 +29835,7 @@ namespace exprtk exprtk_debug(("(c0 + v) + c1 --> (cov) (c0 + c1) + v\n")); return expr_gen.node_allocator_-> - template allocate_cr<typename details::cov_node<Type,details::add_op<Type> > >(c0 + c1,v); + template allocate_cr<typename details::cov_node<Type,details::add_op<Type> > >(c0 + c1, v); } // (c0 + v) - c1 --> (cov) (c0 - c1) + v else if ((details::e_add == o0) && (details::e_sub == o1)) @@ -29384,7 +29843,7 @@ namespace exprtk exprtk_debug(("(c0 + v) - c1 --> (cov) (c0 - c1) + v\n")); return expr_gen.node_allocator_-> - template allocate_cr<typename details::cov_node<Type,details::add_op<Type> > >(c0 - c1,v); + template allocate_cr<typename details::cov_node<Type,details::add_op<Type> > >(c0 - c1, v); } // (c0 - v) + c1 --> (cov) (c0 + c1) - v else if ((details::e_sub == o0) && (details::e_add == o1)) @@ -29392,7 +29851,7 @@ namespace exprtk exprtk_debug(("(c0 - v) + c1 --> (cov) (c0 + c1) - v\n")); return expr_gen.node_allocator_-> - template allocate_cr<typename details::cov_node<Type,details::sub_op<Type> > >(c0 + c1,v); + template allocate_cr<typename details::cov_node<Type,details::sub_op<Type> > >(c0 + c1, v); } // (c0 - v) - c1 --> (cov) (c0 - c1) - v else if ((details::e_sub == o0) && (details::e_sub == o1)) @@ -29400,7 +29859,7 @@ namespace exprtk exprtk_debug(("(c0 - v) - c1 --> (cov) (c0 - c1) - v\n")); return expr_gen.node_allocator_-> - template allocate_cr<typename details::cov_node<Type,details::sub_op<Type> > >(c0 - c1,v); + template allocate_cr<typename details::cov_node<Type,details::sub_op<Type> > >(c0 - c1, v); } // (c0 * v) * c1 --> (cov) (c0 * c1) * v else if ((details::e_mul == o0) && (details::e_mul == o1)) @@ -29408,7 +29867,7 @@ namespace exprtk exprtk_debug(("(c0 * v) * c1 --> (cov) (c0 * c1) * v\n")); return expr_gen.node_allocator_-> - template allocate_cr<typename details::cov_node<Type,details::mul_op<Type> > >(c0 * c1,v); + template allocate_cr<typename details::cov_node<Type,details::mul_op<Type> > >(c0 * c1, v); } // (c0 * v) / c1 --> (cov) (c0 / c1) * v else if ((details::e_mul == o0) && (details::e_div == o1)) @@ -29416,7 +29875,7 @@ namespace exprtk exprtk_debug(("(c0 * v) / c1 --> (cov) (c0 / c1) * v\n")); return expr_gen.node_allocator_-> - template allocate_cr<typename details::cov_node<Type,details::mul_op<Type> > >(c0 / c1,v); + template allocate_cr<typename details::cov_node<Type,details::mul_op<Type> > >(c0 / c1, v); } // (c0 / v) * c1 --> (cov) (c0 * c1) / v else if ((details::e_div == o0) && (details::e_mul == o1)) @@ -29424,7 +29883,7 @@ namespace exprtk exprtk_debug(("(c0 / v) * c1 --> (cov) (c0 * c1) / v\n")); return expr_gen.node_allocator_-> - template allocate_cr<typename details::cov_node<Type,details::div_op<Type> > >(c0 * c1,v); + template allocate_cr<typename details::cov_node<Type,details::div_op<Type> > >(c0 * c1, v); } // (c0 / v) / c1 --> (cov) (c0 / c1) / v else if ((details::e_div == o0) && (details::e_div == o1)) @@ -29432,7 +29891,7 @@ namespace exprtk exprtk_debug(("(c0 / v) / c1 --> (cov) (c0 / c1) / v\n")); return expr_gen.node_allocator_-> - template allocate_cr<typename details::cov_node<Type,details::div_op<Type> > >(c0 / c1,v); + template allocate_cr<typename details::cov_node<Type,details::div_op<Type> > >(c0 / c1, v); } } @@ -29490,7 +29949,7 @@ namespace exprtk exprtk_debug(("(c0) + (v + c1) --> (cov) (c0 + c1) + v\n")); return expr_gen.node_allocator_-> - template allocate_cr<typename details::cov_node<Type,details::add_op<Type> > >(c0 + c1,v); + template allocate_cr<typename details::cov_node<Type,details::add_op<Type> > >(c0 + c1, v); } // (c0) + (v - c1) --> (cov) (c0 - c1) + v else if ((details::e_add == o0) && (details::e_sub == o1)) @@ -29498,7 +29957,7 @@ namespace exprtk exprtk_debug(("(c0) + (v - c1) --> (cov) (c0 - c1) + v\n")); return expr_gen.node_allocator_-> - template allocate_cr<typename details::cov_node<Type,details::add_op<Type> > >(c0 - c1,v); + template allocate_cr<typename details::cov_node<Type,details::add_op<Type> > >(c0 - c1, v); } // (c0) - (v + c1) --> (cov) (c0 - c1) - v else if ((details::e_sub == o0) && (details::e_add == o1)) @@ -29506,7 +29965,7 @@ namespace exprtk exprtk_debug(("(c0) - (v + c1) --> (cov) (c0 - c1) - v\n")); return expr_gen.node_allocator_-> - template allocate_cr<typename details::cov_node<Type,details::sub_op<Type> > >(c0 - c1,v); + template allocate_cr<typename details::cov_node<Type,details::sub_op<Type> > >(c0 - c1, v); } // (c0) - (v - c1) --> (cov) (c0 + c1) - v else if ((details::e_sub == o0) && (details::e_sub == o1)) @@ -29514,7 +29973,7 @@ namespace exprtk exprtk_debug(("(c0) - (v - c1) --> (cov) (c0 + c1) - v\n")); return expr_gen.node_allocator_-> - template allocate_cr<typename details::cov_node<Type,details::sub_op<Type> > >(c0 + c1,v); + template allocate_cr<typename details::cov_node<Type,details::sub_op<Type> > >(c0 + c1, v); } // (c0) * (v * c1) --> (voc) v * (c0 * c1) else if ((details::e_mul == o0) && (details::e_mul == o1)) @@ -29522,7 +29981,7 @@ namespace exprtk exprtk_debug(("(c0) * (v * c1) --> (voc) v * (c0 * c1)\n")); return expr_gen.node_allocator_-> - template allocate_cr<typename details::cov_node<Type,details::mul_op<Type> > >(c0 * c1,v); + template allocate_cr<typename details::cov_node<Type,details::mul_op<Type> > >(c0 * c1, v); } // (c0) * (v / c1) --> (cov) (c0 / c1) * v else if ((details::e_mul == o0) && (details::e_div == o1)) @@ -29530,7 +29989,7 @@ namespace exprtk exprtk_debug(("(c0) * (v / c1) --> (cov) (c0 / c1) * v\n")); return expr_gen.node_allocator_-> - template allocate_cr<typename details::cov_node<Type,details::mul_op<Type> > >(c0 / c1,v); + template allocate_cr<typename details::cov_node<Type,details::mul_op<Type> > >(c0 / c1, v); } // (c0) / (v * c1) --> (cov) (c0 / c1) / v else if ((details::e_div == o0) && (details::e_mul == o1)) @@ -29538,7 +29997,7 @@ namespace exprtk exprtk_debug(("(c0) / (v * c1) --> (cov) (c0 / c1) / v\n")); return expr_gen.node_allocator_-> - template allocate_cr<typename details::cov_node<Type,details::div_op<Type> > >(c0 / c1,v); + template allocate_cr<typename details::cov_node<Type,details::div_op<Type> > >(c0 / c1, v); } // (c0) / (v / c1) --> (cov) (c0 * c1) / v else if ((details::e_div == o0) && (details::e_div == o1)) @@ -29546,7 +30005,7 @@ namespace exprtk exprtk_debug(("(c0) / (v / c1) --> (cov) (c0 * c1) / v\n")); return expr_gen.node_allocator_-> - template allocate_cr<typename details::cov_node<Type,details::div_op<Type> > >(c0 * c1,v); + template allocate_cr<typename details::cov_node<Type,details::div_op<Type> > >(c0 * c1, v); } } @@ -29614,7 +30073,7 @@ namespace exprtk exprtk_debug(("(c0) + (c1 + v) --> (cov) (c0 + c1) + v\n")); return expr_gen.node_allocator_-> - template allocate_cr<typename details::cov_node<Type,details::add_op<Type> > >(c0 + c1,v); + template allocate_cr<typename details::cov_node<Type,details::add_op<Type> > >(c0 + c1, v); } // (c0) + (c1 - v) --> (cov) (c0 + c1) - v else if ((details::e_add == o0) && (details::e_sub == o1)) @@ -29622,7 +30081,7 @@ namespace exprtk exprtk_debug(("(c0) + (c1 - v) --> (cov) (c0 + c1) - v\n")); return expr_gen.node_allocator_-> - template allocate_cr<typename details::cov_node<Type,details::sub_op<Type> > >(c0 + c1,v); + template allocate_cr<typename details::cov_node<Type,details::sub_op<Type> > >(c0 + c1, v); } // (c0) - (c1 + v) --> (cov) (c0 - c1) - v else if ((details::e_sub == o0) && (details::e_add == o1)) @@ -29630,7 +30089,7 @@ namespace exprtk exprtk_debug(("(c0) - (c1 + v) --> (cov) (c0 - c1) - v\n")); return expr_gen.node_allocator_-> - template allocate_cr<typename details::cov_node<Type,details::sub_op<Type> > >(c0 - c1,v); + template allocate_cr<typename details::cov_node<Type,details::sub_op<Type> > >(c0 - c1, v); } // (c0) - (c1 - v) --> (cov) (c0 - c1) + v else if ((details::e_sub == o0) && (details::e_sub == o1)) @@ -29638,7 +30097,7 @@ namespace exprtk exprtk_debug(("(c0) - (c1 - v) --> (cov) (c0 - c1) + v\n")); return expr_gen.node_allocator_-> - template allocate_cr<typename details::cov_node<Type,details::add_op<Type> > >(c0 - c1,v); + template allocate_cr<typename details::cov_node<Type,details::add_op<Type> > >(c0 - c1, v); } // (c0) * (c1 * v) --> (cov) (c0 * c1) * v else if ((details::e_mul == o0) && (details::e_mul == o1)) @@ -29646,7 +30105,7 @@ namespace exprtk exprtk_debug(("(c0) * (c1 * v) --> (cov) (c0 * c1) * v\n")); return expr_gen.node_allocator_-> - template allocate_cr<typename details::cov_node<Type,details::mul_op<Type> > >(c0 * c1,v); + template allocate_cr<typename details::cov_node<Type,details::mul_op<Type> > >(c0 * c1, v); } // (c0) * (c1 / v) --> (cov) (c0 * c1) / v else if ((details::e_mul == o0) && (details::e_div == o1)) @@ -29654,7 +30113,7 @@ namespace exprtk exprtk_debug(("(c0) * (c1 / v) --> (cov) (c0 * c1) / v\n")); return expr_gen.node_allocator_-> - template allocate_cr<typename details::cov_node<Type,details::div_op<Type> > >(c0 * c1,v); + template allocate_cr<typename details::cov_node<Type,details::div_op<Type> > >(c0 * c1, v); } // (c0) / (c1 * v) --> (cov) (c0 / c1) / v else if ((details::e_div == o0) && (details::e_mul == o1)) @@ -29662,7 +30121,7 @@ namespace exprtk exprtk_debug(("(c0) / (c1 * v) --> (cov) (c0 / c1) / v\n")); return expr_gen.node_allocator_-> - template allocate_cr<typename details::cov_node<Type,details::div_op<Type> > >(c0 / c1,v); + template allocate_cr<typename details::cov_node<Type,details::div_op<Type> > >(c0 / c1, v); } // (c0) / (c1 / v) --> (cov) (c0 / c1) * v else if ((details::e_div == o0) && (details::e_div == o1)) @@ -29670,7 +30129,7 @@ namespace exprtk exprtk_debug(("(c0) / (c1 / v) --> (cov) (c0 / c1) * v\n")); return expr_gen.node_allocator_-> - template allocate_cr<typename details::cov_node<Type,details::mul_op<Type> > >(c0 / c1,v); + template allocate_cr<typename details::cov_node<Type,details::mul_op<Type> > >(c0 / c1, v); } } @@ -29727,7 +30186,7 @@ namespace exprtk exprtk_debug(("(v + c0) + c1 --> (voc) v + (c0 + c1)\n")); return expr_gen.node_allocator_-> - template allocate_rc<typename details::voc_node<Type,details::add_op<Type> > >(v,c0 + c1); + template allocate_rc<typename details::voc_node<Type,details::add_op<Type> > >(v, c0 + c1); } // (v + c0) - c1 --> (voc) v + (c0 - c1) else if ((details::e_add == o0) && (details::e_sub == o1)) @@ -29735,7 +30194,7 @@ namespace exprtk exprtk_debug(("(v + c0) - c1 --> (voc) v + (c0 - c1)\n")); return expr_gen.node_allocator_-> - template allocate_rc<typename details::voc_node<Type,details::add_op<Type> > >(v,c0 - c1); + template allocate_rc<typename details::voc_node<Type,details::add_op<Type> > >(v, c0 - c1); } // (v - c0) + c1 --> (voc) v - (c0 + c1) else if ((details::e_sub == o0) && (details::e_add == o1)) @@ -29743,7 +30202,7 @@ namespace exprtk exprtk_debug(("(v - c0) + c1 --> (voc) v - (c0 + c1)\n")); return expr_gen.node_allocator_-> - template allocate_rc<typename details::voc_node<Type,details::add_op<Type> > >(v,c1 - c0); + template allocate_rc<typename details::voc_node<Type,details::add_op<Type> > >(v, c1 - c0); } // (v - c0) - c1 --> (voc) v - (c0 + c1) else if ((details::e_sub == o0) && (details::e_sub == o1)) @@ -29751,7 +30210,7 @@ namespace exprtk exprtk_debug(("(v - c0) - c1 --> (voc) v - (c0 + c1)\n")); return expr_gen.node_allocator_-> - template allocate_rc<typename details::voc_node<Type,details::sub_op<Type> > >(v,c0 + c1); + template allocate_rc<typename details::voc_node<Type,details::sub_op<Type> > >(v, c0 + c1); } // (v * c0) * c1 --> (voc) v * (c0 * c1) else if ((details::e_mul == o0) && (details::e_mul == o1)) @@ -29759,7 +30218,7 @@ namespace exprtk exprtk_debug(("(v * c0) * c1 --> (voc) v * (c0 * c1)\n")); return expr_gen.node_allocator_-> - template allocate_rc<typename details::voc_node<Type,details::mul_op<Type> > >(v,c0 * c1); + template allocate_rc<typename details::voc_node<Type,details::mul_op<Type> > >(v, c0 * c1); } // (v * c0) / c1 --> (voc) v * (c0 / c1) else if ((details::e_mul == o0) && (details::e_div == o1)) @@ -29767,7 +30226,7 @@ namespace exprtk exprtk_debug(("(v * c0) / c1 --> (voc) v * (c0 / c1)\n")); return expr_gen.node_allocator_-> - template allocate_rc<typename details::voc_node<Type,details::mul_op<Type> > >(v,c0 / c1); + template allocate_rc<typename details::voc_node<Type,details::mul_op<Type> > >(v, c0 / c1); } // (v / c0) * c1 --> (voc) v * (c1 / c0) else if ((details::e_div == o0) && (details::e_mul == o1)) @@ -29775,7 +30234,7 @@ namespace exprtk exprtk_debug(("(v / c0) * c1 --> (voc) v * (c1 / c0)\n")); return expr_gen.node_allocator_-> - template allocate_rc<typename details::voc_node<Type,details::mul_op<Type> > >(v,c1 / c0); + template allocate_rc<typename details::voc_node<Type,details::mul_op<Type> > >(v, c1 / c0); } // (v / c0) / c1 --> (voc) v / (c0 * c1) else if ((details::e_div == o0) && (details::e_div == o1)) @@ -29783,7 +30242,7 @@ namespace exprtk exprtk_debug(("(v / c0) / c1 --> (voc) v / (c0 * c1)\n")); return expr_gen.node_allocator_-> - template allocate_rc<typename details::voc_node<Type,details::div_op<Type> > >(v,c0 * c1); + template allocate_rc<typename details::voc_node<Type,details::div_op<Type> > >(v, c0 * c1); } // (v ^ c0) ^ c1 --> (voc) v ^ (c0 * c1) else if ((details::e_pow == o0) && (details::e_pow == o1)) @@ -29791,7 +30250,7 @@ namespace exprtk exprtk_debug(("(v ^ c0) ^ c1 --> (voc) v ^ (c0 * c1)\n")); return expr_gen.node_allocator_-> - template allocate_rc<typename details::voc_node<Type,details::pow_op<Type> > >(v,c0 * c1); + template allocate_rc<typename details::voc_node<Type,details::pow_op<Type> > >(v, c0 * c1); } } @@ -33062,28 +33521,28 @@ namespace exprtk case details::e_add : result = (*this)(details::e_neg, node_allocator_-> allocate_rr<typename details:: - vov_node<Type,details::add_op<Type> > >(v0,v1)); + vov_node<Type,details::add_op<Type> > >(v0, v1)); exprtk_debug(("(-v0 + -v1) --> -(v0 + v1)\n")); break; // (-v0 - -v1) --> (v1 - v0) case details::e_sub : result = node_allocator_-> allocate_rr<typename details:: - vov_node<Type,details::sub_op<Type> > >(v1,v0); + vov_node<Type,details::sub_op<Type> > >(v1, v0); exprtk_debug(("(-v0 - -v1) --> (v1 - v0)\n")); break; // (-v0 * -v1) --> (v0 * v1) case details::e_mul : result = node_allocator_-> allocate_rr<typename details:: - vov_node<Type,details::mul_op<Type> > >(v0,v1); + vov_node<Type,details::mul_op<Type> > >(v0, v1); exprtk_debug(("(-v0 * -v1) --> (v0 * v1)\n")); break; // (-v0 / -v1) --> (v0 / v1) case details::e_div : result = node_allocator_-> allocate_rr<typename details:: - vov_node<Type,details::div_op<Type> > >(v0,v1); + vov_node<Type,details::div_op<Type> > >(v0, v1); exprtk_debug(("(-v0 / -v1) --> (v0 / v1)\n")); break; @@ -33094,7 +33553,7 @@ namespace exprtk if (0 == result) { result = node_allocator_-> - allocate_rrrrr<typename details::uvouv_node<Type> >(v0,v1,u0,u1,f); + allocate_rrrrr<typename details::uvouv_node<Type> >(v0, v1, u0, u1, f); } details::free_all_nodes(*node_allocator_,branch); @@ -33128,7 +33587,7 @@ namespace exprtk #define case_stmt(op0,op1) \ case op0 : return node_allocator_-> \ allocate_ttt<typename details::str_xrox_node<Type,T0,T1,range_t,op1<Type> >,T0,T1> \ - (s0,s1,rp0); \ + (s0, s1, rp0); \ string_opr_switch_statements #undef case_stmt @@ -33146,7 +33605,7 @@ namespace exprtk #define case_stmt(op0,op1) \ case op0 : return node_allocator_-> \ allocate_ttt<typename details::str_xoxr_node<Type,T0,T1,range_t,op1<Type> >,T0,T1> \ - (s0,s1,rp1); \ + (s0, s1, rp1); \ string_opr_switch_statements #undef case_stmt @@ -33164,7 +33623,7 @@ namespace exprtk #define case_stmt(op0,op1) \ case op0 : return node_allocator_-> \ allocate_tttt<typename details::str_xroxr_node<Type,T0,T1,range_t,op1<Type> >,T0,T1> \ - (s0,s1,rp0,rp1); \ + (s0, s1, rp0, rp1); \ string_opr_switch_statements #undef case_stmt @@ -33177,9 +33636,9 @@ namespace exprtk { switch (opr) { - #define case_stmt(op0,op1) \ - case op0 : return node_allocator_-> \ - allocate_tt<typename details::sos_node<Type,T0,T1,op1<Type> >,T0,T1>(s0,s1); \ + #define case_stmt(op0,op1) \ + case op0 : return node_allocator_-> \ + allocate_tt<typename details::sos_node<Type,T0,T1,op1<Type> >,T0,T1>(s0, s1); \ string_opr_switch_statements #undef case_stmt @@ -33192,7 +33651,7 @@ namespace exprtk std::string& s0 = static_cast<details::stringvar_node<Type>*>(branch[0])->ref(); std::string& s1 = static_cast<details::stringvar_node<Type>*>(branch[1])->ref(); - return synthesize_sos_expression_impl<std::string&,std::string&>(opr,s0,s1); + return synthesize_sos_expression_impl<std::string&,std::string&>(opr, s0, s1); } inline expression_node_ptr synthesize_sros_expression(const details::operator_type& opr, expression_node_ptr (&branch)[2]) @@ -33205,7 +33664,7 @@ namespace exprtk free_node(*node_allocator_,branch[0]); - return synthesize_str_xrox_expression_impl<std::string&,std::string&>(opr,s0,s1,rp0); + return synthesize_str_xrox_expression_impl<std::string&,std::string&>(opr, s0, s1, rp0); } inline expression_node_ptr synthesize_sosr_expression(const details::operator_type& opr, expression_node_ptr (&branch)[2]) @@ -33218,7 +33677,7 @@ namespace exprtk free_node(*node_allocator_,branch[1]); - return synthesize_str_xoxr_expression_impl<std::string&,std::string&>(opr,s0,s1,rp1); + return synthesize_str_xoxr_expression_impl<std::string&,std::string&>(opr, s0, s1, rp1); } inline expression_node_ptr synthesize_socsr_expression(const details::operator_type& opr, expression_node_ptr (&branch)[2]) @@ -33231,7 +33690,7 @@ namespace exprtk free_node(*node_allocator_,branch[1]); - return synthesize_str_xoxr_expression_impl<std::string&, const std::string>(opr,s0,s1,rp1); + return synthesize_str_xoxr_expression_impl<std::string&, const std::string>(opr, s0, s1, rp1); } inline expression_node_ptr synthesize_srosr_expression(const details::operator_type& opr, expression_node_ptr (&branch)[2]) @@ -33247,7 +33706,7 @@ namespace exprtk details::free_node(*node_allocator_,branch[0]); details::free_node(*node_allocator_,branch[1]); - return synthesize_str_xroxr_expression_impl<std::string&,std::string&>(opr,s0,s1,rp0,rp1); + return synthesize_str_xroxr_expression_impl<std::string&,std::string&>(opr, s0, s1, rp0, rp1); } inline expression_node_ptr synthesize_socs_expression(const details::operator_type& opr, expression_node_ptr (&branch)[2]) @@ -33257,7 +33716,7 @@ namespace exprtk details::free_node(*node_allocator_,branch[1]); - return synthesize_sos_expression_impl<std::string&, const std::string>(opr,s0,s1); + return synthesize_sos_expression_impl<std::string&, const std::string>(opr, s0, s1); } inline expression_node_ptr synthesize_csos_expression(const details::operator_type& opr, expression_node_ptr (&branch)[2]) @@ -33267,7 +33726,7 @@ namespace exprtk details::free_node(*node_allocator_,branch[0]); - return synthesize_sos_expression_impl<const std::string,std::string&>(opr,s0,s1); + return synthesize_sos_expression_impl<const std::string,std::string&>(opr, s0, s1); } inline expression_node_ptr synthesize_csosr_expression(const details::operator_type& opr, expression_node_ptr (&branch)[2]) @@ -33281,7 +33740,7 @@ namespace exprtk details::free_node(*node_allocator_,branch[0]); details::free_node(*node_allocator_,branch[1]); - return synthesize_str_xoxr_expression_impl<const std::string,std::string&>(opr,s0,s1,rp1); + return synthesize_str_xoxr_expression_impl<const std::string,std::string&>(opr, s0, s1, rp1); } inline expression_node_ptr synthesize_srocs_expression(const details::operator_type& opr, expression_node_ptr (&branch)[2]) @@ -33295,7 +33754,7 @@ namespace exprtk details::free_node(*node_allocator_,branch[0]); details::free_node(*node_allocator_,branch[1]); - return synthesize_str_xrox_expression_impl<std::string&, const std::string>(opr,s0,s1,rp0); + return synthesize_str_xrox_expression_impl<std::string&, const std::string>(opr, s0, s1, rp0); } inline expression_node_ptr synthesize_srocsr_expression(const details::operator_type& opr, expression_node_ptr (&branch)[2]) @@ -33311,7 +33770,7 @@ namespace exprtk details::free_node(*node_allocator_,branch[0]); details::free_node(*node_allocator_,branch[1]); - return synthesize_str_xroxr_expression_impl<std::string&, const std::string>(opr,s0,s1,rp0,rp1); + return synthesize_str_xroxr_expression_impl<std::string&, const std::string>(opr, s0, s1, rp0, rp1); } inline expression_node_ptr synthesize_csocs_expression(const details::operator_type& opr, expression_node_ptr (&branch)[2]) @@ -33324,16 +33783,19 @@ namespace exprtk if (details::e_add == opr) result = node_allocator_->allocate_c<details::string_literal_node<Type> >(s0 + s1); else if (details::e_in == opr) - result = node_allocator_->allocate_c<details::literal_node<Type> >(details::in_op<Type>::process(s0,s1)); + result = node_allocator_->allocate_c<details::literal_node<Type> >(details::in_op <Type>::process(s0,s1)); else if (details::e_like == opr) - result = node_allocator_->allocate_c<details::literal_node<Type> >(details::like_op<Type>::process(s0,s1)); + result = node_allocator_->allocate_c<details::literal_node<Type> >(details::like_op <Type>::process(s0,s1)); else if (details::e_ilike == opr) result = node_allocator_->allocate_c<details::literal_node<Type> >(details::ilike_op<Type>::process(s0,s1)); else { - expression_node_ptr temp = synthesize_sos_expression_impl<const std::string, const std::string>(opr,s0,s1); - Type v = temp->value(); + expression_node_ptr temp = synthesize_sos_expression_impl<const std::string, const std::string>(opr, s0, s1); + + const Type v = temp->value(); + details::free_node(*node_allocator_,temp); + result = node_allocator_->allocate<literal_node_t>(v); } @@ -33353,7 +33815,7 @@ namespace exprtk free_node(*node_allocator_,branch[0]); free_node(*node_allocator_,branch[1]); - return synthesize_str_xoxr_expression_impl<const std::string, const std::string>(opr,s0,s1,rp1); + return synthesize_str_xoxr_expression_impl<const std::string, const std::string>(opr, s0, s1, rp1); } inline expression_node_ptr synthesize_csros_expression(const details::operator_type& opr, expression_node_ptr (&branch)[2]) @@ -33366,7 +33828,7 @@ namespace exprtk free_node(*node_allocator_,branch[0]); - return synthesize_str_xrox_expression_impl<const std::string,std::string&>(opr,s0,s1,rp0); + return synthesize_str_xrox_expression_impl<const std::string,std::string&>(opr, s0, s1, rp0); } inline expression_node_ptr synthesize_csrosr_expression(const details::operator_type& opr, expression_node_ptr (&branch)[2]) @@ -33382,7 +33844,7 @@ namespace exprtk free_node(*node_allocator_,branch[0]); free_node(*node_allocator_,branch[1]); - return synthesize_str_xroxr_expression_impl<const std::string,std::string&>(opr,s0,s1,rp0,rp1); + return synthesize_str_xroxr_expression_impl<const std::string,std::string&>(opr, s0, s1, rp0, rp1); } inline expression_node_ptr synthesize_csrocs_expression(const details::operator_type& opr, expression_node_ptr (&branch)[2]) @@ -33395,7 +33857,7 @@ namespace exprtk details::free_all_nodes(*node_allocator_,branch); - return synthesize_str_xrox_expression_impl<const std::string,std::string>(opr,s0,s1,rp0); + return synthesize_str_xrox_expression_impl<const std::string,std::string>(opr, s0, s1, rp0); } inline expression_node_ptr synthesize_csrocsr_expression(const details::operator_type& opr, expression_node_ptr (&branch)[2]) @@ -33410,7 +33872,7 @@ namespace exprtk details::free_all_nodes(*node_allocator_,branch); - return synthesize_str_xroxr_expression_impl<const std::string, const std::string>(opr,s0,s1,rp0,rp1); + return synthesize_str_xroxr_expression_impl<const std::string, const std::string>(opr, s0, s1, rp0, rp1); } inline expression_node_ptr synthesize_strogen_expression(const details::operator_type& opr, expression_node_ptr (&branch)[2]) @@ -33420,7 +33882,7 @@ namespace exprtk #define case_stmt(op0,op1) \ case op0 : return node_allocator_-> \ allocate_ttt<typename details::str_sogens_node<Type,op1<Type> > > \ - (opr,branch[0],branch[1]); \ + (opr, branch[0], branch[1]); \ string_opr_switch_statements #undef case_stmt @@ -33537,7 +33999,8 @@ namespace exprtk const std::string s1 = static_cast<details::string_literal_node<Type>*>(branch[1])->str(); const std::string s2 = static_cast<details::string_literal_node<Type>*>(branch[2])->str(); - Type v = (((s0 <= s1) && (s1 <= s2)) ? Type(1) : Type(0)); + const Type v = (((s0 <= s1) && (s1 <= s2)) ? Type(1) : Type(0)); + details::free_all_nodes(*node_allocator_,branch); return node_allocator_->allocate_c<details::literal_node<Type> >(v); @@ -33735,7 +34198,11 @@ namespace exprtk (details::e_like == operation) || (details::e_ilike == operation) ) + { + free_all_nodes(*node_allocator_,branch); + return error_node(); + } else if (!details::all_nodes_valid<N>(branch)) { free_all_nodes(*node_allocator_,branch); @@ -33800,15 +34267,15 @@ namespace exprtk return expression_point; } - bool strength_reduction_enabled_; + bool strength_reduction_enabled_; details::node_allocator* node_allocator_; - synthesize_map_t synthesize_map_; - unary_op_map_t* unary_op_map_; - binary_op_map_t* binary_op_map_; - inv_binary_op_map_t* inv_binary_op_map_; - sf3_map_t* sf3_map_; - sf4_map_t* sf4_map_; - parser_t* parser_; + synthesize_map_t synthesize_map_; + unary_op_map_t* unary_op_map_; + binary_op_map_t* binary_op_map_; + inv_binary_op_map_t* inv_binary_op_map_; + sf3_map_t* sf3_map_; + sf4_map_t* sf4_map_; + parser_t* parser_; }; inline void set_error(const parser_error::type& error_type) @@ -33850,7 +34317,7 @@ namespace exprtk if (se.data) { - e.register_local_data(se.data,1,0); + e.register_local_data(se.data, 1, 0); } } else if (scope_element::e_vector == se.type) @@ -33862,7 +34329,7 @@ namespace exprtk if (se.data) { - e.register_local_data(se.data,se.size,1); + e.register_local_data(se.data, se.size, 1); } } #ifndef exprtk_disable_string_capabilities @@ -33875,7 +34342,7 @@ namespace exprtk if (se.data) { - e.register_local_data(se.data,se.size,2); + e.register_local_data(se.data, se.size, 2); } } #endif @@ -34752,79 +35219,79 @@ namespace exprtk #define poly_rtrn(NN) \ return (NN != N) ? std::numeric_limits<T>::quiet_NaN() : - inline virtual T operator()(const T& x, const T& c1, const T& c0) + inline virtual T operator() (const T& x, const T& c1, const T& c0) { poly_rtrn(1) poly_impl<T,1>::evaluate(x,c1,c0); } - inline virtual T operator()(const T& x, const T& c2, const T& c1, const T& c0) + inline virtual T operator() (const T& x, const T& c2, const T& c1, const T& c0) { poly_rtrn(2) poly_impl<T,2>::evaluate(x,c2,c1,c0); } - inline virtual T operator()(const T& x, const T& c3, const T& c2, const T& c1, const T& c0) + inline virtual T operator() (const T& x, const T& c3, const T& c2, const T& c1, const T& c0) { poly_rtrn(3) poly_impl<T,3>::evaluate(x,c3,c2,c1,c0); } - inline virtual T operator()(const T& x, const T& c4, const T& c3, const T& c2, const T& c1, const T& c0) + inline virtual T operator() (const T& x, const T& c4, const T& c3, const T& c2, const T& c1, const T& c0) { poly_rtrn(4) poly_impl<T,4>::evaluate(x,c4,c3,c2,c1,c0); } - inline virtual T operator()(const T& x, const T& c5, const T& c4, const T& c3, const T& c2, const T& c1, const T& c0) + inline virtual T operator() (const T& x, const T& c5, const T& c4, const T& c3, const T& c2, const T& c1, const T& c0) { poly_rtrn(5) poly_impl<T,5>::evaluate(x,c5,c4,c3,c2,c1,c0); } - inline virtual T operator()(const T& x, const T& c6, const T& c5, const T& c4, const T& c3, const T& c2, const T& c1, const T& c0) + inline virtual T operator() (const T& x, const T& c6, const T& c5, const T& c4, const T& c3, const T& c2, const T& c1, const T& c0) { poly_rtrn(6) poly_impl<T,6>::evaluate(x,c6,c5,c4,c3,c2,c1,c0); } - inline virtual T operator()(const T& x, const T& c7, const T& c6, const T& c5, const T& c4, const T& c3, const T& c2, const T& c1, const T& c0) + inline virtual T operator() (const T& x, const T& c7, const T& c6, const T& c5, const T& c4, const T& c3, const T& c2, const T& c1, const T& c0) { poly_rtrn(7) poly_impl<T,7>::evaluate(x,c7,c6,c5,c4,c3,c2,c1,c0); } - inline virtual T operator()(const T& x, const T& c8, const T& c7, const T& c6, const T& c5, const T& c4, const T& c3, const T& c2, const T& c1, const T& c0) + inline virtual T operator() (const T& x, const T& c8, const T& c7, const T& c6, const T& c5, const T& c4, const T& c3, const T& c2, const T& c1, const T& c0) { poly_rtrn(8) poly_impl<T,8>::evaluate(x,c8,c7,c6,c5,c4,c3,c2,c1,c0); } - inline virtual T operator()(const T& x, const T& c9, const T& c8, const T& c7, const T& c6, const T& c5, const T& c4, const T& c3, const T& c2, const T& c1, const T& c0) + inline virtual T operator() (const T& x, const T& c9, const T& c8, const T& c7, const T& c6, const T& c5, const T& c4, const T& c3, const T& c2, const T& c1, const T& c0) { poly_rtrn(9) poly_impl<T,9>::evaluate(x,c9,c8,c7,c6,c5,c4,c3,c2,c1,c0); } - inline virtual T operator()(const T& x, const T& c10, const T& c9, const T& c8, const T& c7, const T& c6, const T& c5, const T& c4, const T& c3, const T& c2, const T& c1, const T& c0) + inline virtual T operator() (const T& x, const T& c10, const T& c9, const T& c8, const T& c7, const T& c6, const T& c5, const T& c4, const T& c3, const T& c2, const T& c1, const T& c0) { poly_rtrn(10) poly_impl<T,10>::evaluate(x,c10,c9,c8,c7,c6,c5,c4,c3,c2,c1,c0); } - inline virtual T operator()(const T& x, const T& c11, const T& c10, const T& c9, const T& c8, const T& c7, const T& c6, const T& c5, const T& c4, const T& c3, const T& c2, const T& c1, const T& c0) + inline virtual T operator() (const T& x, const T& c11, const T& c10, const T& c9, const T& c8, const T& c7, const T& c6, const T& c5, const T& c4, const T& c3, const T& c2, const T& c1, const T& c0) { poly_rtrn(11) poly_impl<T,11>::evaluate(x,c11,c10,c9,c8,c7,c6,c5,c4,c3,c2,c1,c0); } - inline virtual T operator()(const T& x, const T& c12, const T& c11, const T& c10, const T& c9, const T& c8, const T& c7, const T& c6, const T& c5, const T& c4, const T& c3, const T& c2, const T& c1, const T& c0) + inline virtual T operator() (const T& x, const T& c12, const T& c11, const T& c10, const T& c9, const T& c8, const T& c7, const T& c6, const T& c5, const T& c4, const T& c3, const T& c2, const T& c1, const T& c0) { poly_rtrn(12) poly_impl<T,12>::evaluate(x,c12,c11,c10,c9,c8,c7,c6,c5,c4,c3,c2,c1,c0); } #undef poly_rtrn - inline virtual T operator()() + inline virtual T operator() () { return std::numeric_limits<T>::quiet_NaN(); } - inline virtual T operator()(const T&) + inline virtual T operator() (const T&) { return std::numeric_limits<T>::quiet_NaN(); } - inline virtual T operator()(const T&, const T&) + inline virtual T operator() (const T&, const T&) { return std::numeric_limits<T>::quiet_NaN(); } @@ -35155,7 +35622,7 @@ namespace exprtk func_0param() : base_func(0) {} - inline T operator()() + inline T operator() () { return this->value(base_func::expression); } @@ -35183,7 +35650,7 @@ namespace exprtk func_1param() : base_func(1) {} - inline T operator()(type v0) + inline T operator() (type v0) { scoped_bft<func_1param> sb(*this); base_func::update(v0); @@ -35199,10 +35666,10 @@ namespace exprtk func_2param() : base_func(2) {} - inline T operator()(type v0, type v1) + inline T operator() (type v0, type v1) { scoped_bft<func_2param> sb(*this); - base_func::update(v0,v1); + base_func::update(v0, v1); T result = this->value(base_func::expression); return result; @@ -35215,10 +35682,10 @@ namespace exprtk func_3param() : base_func(3) {} - inline T operator()(type v0, type v1, type v2) + inline T operator() (type v0, type v1, type v2) { scoped_bft<func_3param> sb(*this); - base_func::update(v0,v1,v2); + base_func::update(v0, v1, v2); T result = this->value(base_func::expression); return result; @@ -35231,10 +35698,10 @@ namespace exprtk func_4param() : base_func(4) {} - inline T operator()(type v0, type v1, type v2, type v3) + inline T operator() (type v0, type v1, type v2, type v3) { scoped_bft<func_4param> sb(*this); - base_func::update(v0,v1,v2,v3); + base_func::update(v0, v1, v2, v3); T result = this->value(base_func::expression); return result; @@ -35247,10 +35714,10 @@ namespace exprtk func_5param() : base_func(5) {} - inline T operator()(type v0, type v1, type v2, type v3, type v4) + inline T operator() (type v0, type v1, type v2, type v3, type v4) { scoped_bft<func_5param> sb(*this); - base_func::update(v0,v1,v2,v3,v4); + base_func::update(v0, v1, v2, v3, v4); T result = this->value(base_func::expression); return result; @@ -35263,10 +35730,10 @@ namespace exprtk func_6param() : base_func(6) {} - inline T operator()(type v0, type v1, type v2, type v3, type v4, type v5) + inline T operator() (type v0, type v1, type v2, type v3, type v4, type v5) { scoped_bft<func_6param> sb(*this); - base_func::update(v0,v1,v2,v3,v4,v5); + base_func::update(v0, v1, v2, v3, v4, v5); T result = this->value(base_func::expression); return result; @@ -35318,7 +35785,7 @@ namespace exprtk { const std::size_t n = var_list.size(); - typename std::map<std::string,expression_t>::iterator itr = expr_map_.find(name); + const typename std::map<std::string,expression_t>::iterator itr = expr_map_.find(name); if (expr_map_.end() != itr) { @@ -35463,7 +35930,7 @@ namespace exprtk { remove(name,input_var_list.size()); - return compile_expression(name,expression,input_var_list,true); + return compile_expression(name, expression, input_var_list, true); } // Make sure every return point has a scalar as its first parameter @@ -35558,14 +36025,14 @@ namespace exprtk if (arg_count > 6) return; - typename std::map<std::string,expression_t>::iterator em_itr = expr_map_.find(name); + const typename std::map<std::string,expression_t>::iterator em_itr = expr_map_.find(name); if (expr_map_.end() != em_itr) { expr_map_.erase(em_itr); } - typename funcparam_t::iterator fp_itr = fp_map_[arg_count].find(name); + const typename funcparam_t::iterator fp_itr = fp_map_[arg_count].find(name); if (fp_map_[arg_count].end() != fp_itr) { @@ -35975,7 +36442,7 @@ namespace exprtk exprtk::enable_zero_parameters(*this); } - inline T operator()(parameter_list_t parameters) + inline T operator() (parameter_list_t parameters) { details::print_impl<T>::process(scalar_format_,parameters); return T(0); @@ -35997,7 +36464,7 @@ namespace exprtk exprtk::enable_zero_parameters(*this); } - inline T operator()(parameter_list_t parameters) + inline T operator() (parameter_list_t parameters) { details::print_impl<T>::process(scalar_format_,parameters); printf("\n"); @@ -36261,6 +36728,7 @@ namespace exprtk #pragma warning(pop) #endif } + } // namespace exprtk::rtl::io::file::details template <typename T> @@ -36279,7 +36747,7 @@ namespace exprtk : exprtk::igeneric_function<T>("S|SS") { details::perform_check<T>(); } - inline T operator()(const std::size_t& ps_index, parameter_list_t parameters) + inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) { std::string file_name; std::string access; @@ -36302,7 +36770,7 @@ namespace exprtk { T t = T(0); - std::memcpy(reinterpret_cast<char*>(&t), + std::memcpy(reinterpret_cast<char*>(&t ), reinterpret_cast<char*>(&fd), sizeof(fd)); return t; @@ -36324,7 +36792,7 @@ namespace exprtk : exprtk::ifunction<T>(1) { details::perform_check<T>(); } - inline T operator()(const T& v) + inline T operator() (const T& v) { details::file_descriptor* fd = details::make_handle(v); @@ -36355,7 +36823,7 @@ namespace exprtk : igfun_t("TS|TST|TV|TVT") { details::perform_check<T>(); } - inline T operator()(const std::size_t& ps_index, parameter_list_t parameters) + inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) { details::file_descriptor* fd = details::make_handle(scalar_t(parameters[0])()); @@ -36364,26 +36832,26 @@ namespace exprtk switch (ps_index) { case 0 : { - string_t buffer(parameters[1]); + const string_t buffer(parameters[1]); amount = buffer.size(); return T(fd->write(buffer,amount) ? 1 : 0); } case 1 : { - string_t buffer(parameters[1]); + const string_t buffer(parameters[1]); amount = std::min(buffer.size(), static_cast<std::size_t>(scalar_t(parameters[2])())); return T(fd->write(buffer,amount) ? 1 : 0); } case 2 : { - vector_t vec(parameters[1]); + const vector_t vec(parameters[1]); amount = vec.size(); return T(fd->write(vec,amount) ? 1 : 0); } case 3 : { - vector_t vec(parameters[1]); + const vector_t vec(parameters[1]); amount = std::min(vec.size(), static_cast<std::size_t>(scalar_t(parameters[2])())); return T(fd->write(vec,amount) ? 1 : 0); @@ -36412,7 +36880,7 @@ namespace exprtk : igfun_t("TS|TST|TV|TVT") { details::perform_check<T>(); } - inline T operator()(const std::size_t& ps_index, parameter_list_t parameters) + inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) { details::file_descriptor* fd = details::make_handle(scalar_t(parameters[0])()); @@ -36468,8 +36936,8 @@ namespace exprtk : igfun_t("T",igfun_t::e_rtrn_string) { details::perform_check<T>(); } - inline T operator()(std::string& result, - parameter_list_t parameters) + inline T operator() (std::string& result, + parameter_list_t parameters) { details::file_descriptor* fd = details::make_handle(scalar_t(parameters[0])()); return T(fd->getline(result) ? 1 : 0); @@ -36485,7 +36953,7 @@ namespace exprtk : exprtk::ifunction<T>(1) { details::perform_check<T>(); } - inline T operator()(const T& v) + inline T operator() (const T& v) { details::file_descriptor* fd = details::make_handle(v); @@ -36618,9 +37086,9 @@ namespace exprtk */ {} - inline T operator()(const std::size_t& ps_index, parameter_list_t parameters) + inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) { - const vector_t& vec(parameters[0]); + const vector_t vec(parameters[0]); std::size_t r0 = 0; std::size_t r1 = vec.size() - 1; @@ -36664,9 +37132,9 @@ namespace exprtk */ {} - inline T operator()(const std::size_t& ps_index, parameter_list_t parameters) + inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) { - const vector_t& vec(parameters[0]); + const vector_t vec(parameters[0]); std::size_t r0 = 0; std::size_t r1 = vec.size() - 1; @@ -36710,9 +37178,9 @@ namespace exprtk */ {} - inline T operator()(const std::size_t& ps_index, parameter_list_t parameters) + inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) { - const vector_t& vec(parameters[0]); + const vector_t vec(parameters[0]); std::size_t r0 = 0; std::size_t r1 = vec.size() - 1; @@ -36756,9 +37224,9 @@ namespace exprtk */ {} - inline T operator()(const std::size_t& ps_index, parameter_list_t parameters) + inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) { - const vector_t& vec(parameters[0]); + const vector_t vec(parameters[0]); std::size_t r0 = 0; std::size_t r1 = vec.size() - 1; @@ -36802,9 +37270,9 @@ namespace exprtk */ {} - inline T operator()(const std::size_t& ps_index, parameter_list_t parameters) + inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) { - const vector_t& vec(parameters[0]); + const vector_t vec(parameters[0]); std::size_t r0 = 0; std::size_t r1 = vec.size() - 1; @@ -36848,10 +37316,10 @@ namespace exprtk */ {} - inline T operator()(const std::size_t& ps_index, parameter_list_t parameters) + inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) { - vector_t x(parameters[0]); - vector_t y(parameters[(0 == ps_index) ? 1 : 3]); + const vector_t x(parameters[0]); + vector_t y(parameters[(0 == ps_index) ? 1 : 3]); std::size_t xr0 = 0; std::size_t xr1 = x.size() - 1; @@ -36898,7 +37366,7 @@ namespace exprtk */ {} - inline T operator()(const std::size_t& ps_index, parameter_list_t parameters) + inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) { vector_t vec(parameters[0]); @@ -36946,7 +37414,7 @@ namespace exprtk */ {} - inline T operator()(const std::size_t& ps_index, parameter_list_t parameters) + inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) { vector_t vec(parameters[0]); @@ -36994,7 +37462,7 @@ namespace exprtk */ {} - inline T operator()(const std::size_t& ps_index, parameter_list_t parameters) + inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) { vector_t vec(parameters[0]); @@ -37049,7 +37517,7 @@ namespace exprtk */ {} - inline T operator()(const std::size_t& ps_index, parameter_list_t parameters) + inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) { vector_t vec(parameters[0]); @@ -37108,7 +37576,7 @@ namespace exprtk */ {} - inline T operator()(const std::size_t& ps_index, parameter_list_t parameters) + inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) { vector_t vec(parameters[0]); @@ -37163,7 +37631,7 @@ namespace exprtk */ {} - inline T operator()(const std::size_t& ps_index, parameter_list_t parameters) + inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) { vector_t vec(parameters[0]); @@ -37207,7 +37675,7 @@ namespace exprtk */ {} - inline T operator()(const std::size_t& ps_index, parameter_list_t parameters) + inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) { vector_t vec(parameters[0]); @@ -37256,9 +37724,9 @@ namespace exprtk */ {} - inline T operator()(const std::size_t& ps_index, parameter_list_t parameters) + inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) { - vector_t vec(parameters[0]); + const vector_t vec(parameters[0]); std::size_t r0 = 0; std::size_t r1 = vec.size() - 1; @@ -37271,7 +37739,7 @@ namespace exprtk for (std::size_t i = r0; i <= r1; ++i) { - details::kahan_sum(result,error,vec[i]); + details::kahan_sum(result, error, vec[i]); } return result; @@ -37301,10 +37769,10 @@ namespace exprtk */ {} - inline T operator()(const std::size_t& ps_index, parameter_list_t parameters) + inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) { - vector_t x(parameters[1]); - vector_t y(parameters[2]); + const vector_t x(parameters[1]); + vector_t y(parameters[2]); std::size_t r0 = 0; std::size_t r1 = std::min(x.size(),y.size()) - 1; @@ -37318,7 +37786,7 @@ namespace exprtk for (std::size_t i = r0; i <= r1; ++i) { - y[i] = a * x[i] + y[i]; + y[i] = (a * x[i]) + y[i]; } return T(1); @@ -37348,10 +37816,10 @@ namespace exprtk */ {} - inline T operator()(const std::size_t& ps_index, parameter_list_t parameters) + inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) { - vector_t x(parameters[1]); - vector_t y(parameters[3]); + const vector_t x(parameters[1]); + vector_t y(parameters[3]); std::size_t r0 = 0; std::size_t r1 = std::min(x.size(),y.size()) - 1; @@ -37396,11 +37864,11 @@ namespace exprtk */ {} - inline T operator()(const std::size_t& ps_index, parameter_list_t parameters) + inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) { - vector_t x(parameters[1]); - vector_t y(parameters[2]); - vector_t z(parameters[3]); + const vector_t x(parameters[1]); + const vector_t y(parameters[2]); + vector_t z(parameters[3]); std::size_t r0 = 0; std::size_t r1 = std::min(x.size(),y.size()) - 1; @@ -37416,7 +37884,7 @@ namespace exprtk for (std::size_t i = r0; i <= r1; ++i) { - z[i] = a * x[i] + y[i]; + z[i] = (a * x[i]) + y[i]; } return T(1); @@ -37446,11 +37914,11 @@ namespace exprtk */ {} - inline T operator()(const std::size_t& ps_index, parameter_list_t parameters) + inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) { - vector_t x(parameters[1]); - vector_t y(parameters[3]); - vector_t z(parameters[4]); + const vector_t x(parameters[1]); + const vector_t y(parameters[3]); + vector_t z(parameters[4]); std::size_t r0 = 0; std::size_t r1 = std::min(x.size(),y.size()) - 1; @@ -37497,10 +37965,10 @@ namespace exprtk */ {} - inline T operator()(const std::size_t& ps_index, parameter_list_t parameters) + inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) { - vector_t x(parameters[1]); - vector_t z(parameters[3]); + const vector_t x(parameters[1]); + vector_t z(parameters[3]); std::size_t r0 = 0; std::size_t r1 = x.size() - 1; @@ -37515,7 +37983,7 @@ namespace exprtk for (std::size_t i = r0; i <= r1; ++i) { - z[i] = a * x[i] + b; + z[i] = (a * x[i]) + b; } return T(1); @@ -37544,10 +38012,10 @@ namespace exprtk */ {} - inline T operator()(const std::size_t& ps_index, parameter_list_t parameters) + inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) { - vector_t x(parameters[0]); - vector_t y(parameters[1]); + const vector_t x(parameters[0]); + const vector_t y(parameters[1]); std::size_t r0 = 0; std::size_t r1 = std::min(x.size(),y.size()) - 1; @@ -37590,10 +38058,10 @@ namespace exprtk */ {} - inline T operator()(const std::size_t& ps_index, parameter_list_t parameters) + inline T operator() (const std::size_t& ps_index, parameter_list_t parameters) { - vector_t x(parameters[0]); - vector_t y(parameters[1]); + const vector_t x(parameters[0]); + const vector_t y(parameters[1]); std::size_t r0 = 0; std::size_t r1 = std::min(x.size(),y.size()) - 1; @@ -37608,7 +38076,7 @@ namespace exprtk for (std::size_t i = r0; i <= r1; ++i) { - details::kahan_sum(result,error,(x[i] * y[i])); + details::kahan_sum(result, error, (x[i] * y[i])); } return result; @@ -37704,6 +38172,22 @@ namespace exprtk } // namespace information + #ifdef exprtk_debug + #undef exprtk_debug + #endif + + #ifdef exprtk_error_location + #undef exprtk_error_location + #endif + + #ifdef exprtk_disable_fallthrough_begin + #undef exprtk_disable_fallthrough_begin + #endif + + #ifdef exprtk_disable_fallthrough_end + #undef exprtk_disable_fallthrough_end + #endif + } // namespace exprtk #endif -- GitLab