diff --git a/include/boost/regex/v4/perl_matcher.hpp b/include/boost/regex/v4/perl_matcher.hpp index fcbd9882..703bc110 100644 --- a/include/boost/regex/v4/perl_matcher.hpp +++ b/include/boost/regex/v4/perl_matcher.hpp @@ -248,6 +248,25 @@ public: struct saved_state; +enum saved_state_type +{ + saved_type_end = 0, + saved_type_paren = 1, + saved_type_recurse = 2, + saved_type_assertion = 3, + saved_state_alt = 4, + saved_state_repeater_count = 5, + saved_state_extra_block = 6, + saved_state_greedy_single_repeat = 7, + saved_state_rep_slow_dot = 8, + saved_state_rep_fast_dot = 9, + saved_state_rep_char = 10, + saved_state_rep_short_set = 11, + saved_state_rep_long_set = 12, + saved_state_non_greedy_long_repeat = 13, + saved_state_count = 14 +}; + template class perl_matcher { @@ -358,9 +377,9 @@ private: repeater_count rep_obj; // table of functions to match states: - static const matcher_proc_type s_match_vtable[]; + static const matcher_proc_type s_match_vtable[re_detail::syntax_element_count]; // table of functions to search for matching attempt start: - static const matcher_proc_type s_find_vtable[]; + static const matcher_proc_type s_find_vtable[regbase::restart_count]; #ifdef BOOST_REGEX_NON_RECURSIVE @@ -405,7 +424,7 @@ private: // how many memory blocks have we used up?: unsigned used_block_count; // table of pointers to unwind proceedures: - static const unwind_proc_type s_unwind_table[]; + static const unwind_proc_type s_unwind_table[re_detail::saved_state_count]; #endif // these operations aren't allowed, so are declared private: diff --git a/include/boost/regex/v4/perl_matcher_common.hpp b/include/boost/regex/v4/perl_matcher_common.hpp index 6024a133..6a746a33 100644 --- a/include/boost/regex/v4/perl_matcher_common.hpp +++ b/include/boost/regex/v4/perl_matcher_common.hpp @@ -768,7 +768,7 @@ bool perl_matcher::find_restart_lit template typename perl_matcher::matcher_proc_type const -perl_matcher::s_match_vtable[] = +perl_matcher::s_match_vtable[re_detail::syntax_element_count] = { (&perl_matcher::match_startmark), &perl_matcher::match_endmark, @@ -811,7 +811,7 @@ perl_matcher::s_match_vtable[] = template typename perl_matcher::matcher_proc_type const -perl_matcher::s_find_vtable[] = +perl_matcher::s_find_vtable[regbase::restart_count] = { &perl_matcher::find_restart_any, &perl_matcher::find_restart_word, diff --git a/include/boost/regex/v4/perl_matcher_non_recursive.hpp b/include/boost/regex/v4/perl_matcher_non_recursive.hpp index da4ef191..f53d02cf 100644 --- a/include/boost/regex/v4/perl_matcher_non_recursive.hpp +++ b/include/boost/regex/v4/perl_matcher_non_recursive.hpp @@ -40,24 +40,6 @@ inline void inplace_destroy(T* p) p->~T(); } -enum saved_state_type -{ - saved_type_end = 0, - saved_type_paren = 1, - saved_type_recurse = 2, - saved_type_assertion = 3, - saved_state_alt = 4, - saved_state_repeater_count = 5, - saved_state_extra_block = 6, - saved_state_greedy_single_repeat = 7, - saved_state_rep_slow_dot = 8, - saved_state_rep_fast_dot = 9, - saved_state_rep_char = 10, - saved_state_rep_short_set = 11, - saved_state_rep_long_set = 12, - saved_state_non_greedy_long_repeat = 13 -}; - struct saved_state { unsigned int id; @@ -1202,7 +1184,7 @@ bool perl_matcher::unwind_non_greed template typename perl_matcher::unwind_proc_type const -perl_matcher::s_unwind_table[] = +perl_matcher::s_unwind_table[re_detail::saved_state_count] = { &perl_matcher::unwind_end, &perl_matcher::unwind_paren, diff --git a/include/boost/regex/v4/regbase.hpp b/include/boost/regex/v4/regbase.hpp index 2e3294b0..8a9f4952 100644 --- a/include/boost/regex/v4/regbase.hpp +++ b/include/boost/regex/v4/regbase.hpp @@ -81,7 +81,8 @@ public: restart_buf = 3, restart_continue = 4, restart_lit = 5, - restart_fixed_lit = 6 + restart_fixed_lit = 6, + restart_count = 7 }; flag_type BOOST_REGEX_CALL flags()const diff --git a/include/boost/regex/v4/regex_split.hpp b/include/boost/regex/v4/regex_split.hpp index 3c4d5d3f..a21c6034 100644 --- a/include/boost/regex/v4/regex_split.hpp +++ b/include/boost/regex/v4/regex_split.hpp @@ -36,7 +36,7 @@ namespace re_detail{ template const reg_expression& get_default_expression(charT) { - static const charT expression_text[] = { '\\', 's', '+', '\00', }; + static const charT expression_text[4] = { '\\', 's', '+', '\00', }; static const reg_expression e(expression_text); return e; } diff --git a/include/boost/regex/v4/states.hpp b/include/boost/regex/v4/states.hpp index ec1d276f..eaec0b56 100644 --- a/include/boost/regex/v4/states.hpp +++ b/include/boost/regex/v4/states.hpp @@ -109,7 +109,8 @@ enum syntax_element_type syntax_element_dot_rep = syntax_element_restart_continue + 1, syntax_element_char_rep = syntax_element_dot_rep + 1, syntax_element_short_set_rep = syntax_element_char_rep + 1, - syntax_element_long_set_rep = syntax_element_short_set_rep + 1 + syntax_element_long_set_rep = syntax_element_short_set_rep + 1, + syntax_element_count = syntax_element_long_set_rep +1 }; #ifdef BOOST_REGEX_DEBUG