From d6ef477d45075775f7cea6c1ba1d351cb4132c9d Mon Sep 17 00:00:00 2001 From: Valery Mironov <32071355+MBkkt@users.noreply.github.com> Date: Sat, 16 Sep 2023 13:18:17 +0200 Subject: [PATCH] Remove next_next --- .../text/include/boost/text/word_break.hpp | 38 +++++-------------- 1 file changed, 9 insertions(+), 29 deletions(-) diff --git a/external/text/include/boost/text/word_break.hpp b/external/text/include/boost/text/word_break.hpp index e3422956a..f53f00732 100644 --- a/external/text/include/boost/text/word_break.hpp +++ b/external/text/include/boost/text/word_break.hpp @@ -206,7 +206,6 @@ namespace boost { namespace text { word_break_state() {} CPIter it; CPIter it_next; - CPIter it_next_next; bool it_points_to_prev = false; @@ -221,13 +220,11 @@ namespace boost { namespace text { state.caps[0] = state.caps[1]; state.caps[1] = state.caps[2]; state.caps[2] = state.caps[3]; - state.caps[3] = state.caps[4]; - state.caps[4] = cp_and_word_prop{}; + state.caps[3] = cp_and_word_prop{}; state.it = state.it_next; - state.it_next = state.it_next_next; - if (state.it_next_next != last) { - ++state.it_next_next; + if (state.it_next != last) { + ++state.it_next; } return state; @@ -308,14 +305,9 @@ constexpr std::array, 20> word_breaks = {{ } state.caps[ph::curr] = cp_and_word_prop(*state.it, word_prop); state.caps[ph::next] = cp_and_word_prop(); - state.caps[ph::next_next] = cp_and_word_prop(); - state.it_next_next = state.it_next = std::next(state.it); + state.it_next = std::next(state.it); if (state.it_next != last) { state.caps[ph::next] = cp_and_word_prop(*state.it_next, word_prop); - ++state.it_next_next; - if (state.it_next_next != last) { - state.caps[ph::next_next] = cp_and_word_prop(*state.it_next_next, word_prop); - } } } } @@ -712,6 +704,8 @@ constexpr std::array, 20> word_breaks = {{ WordPropFunc const & word_prop = WordPropFunc{}, WordBreakFunc const & word_break = WordBreakFunc{}) noexcept { + static_assert(std::is_same_v, + "Otherwise you need to revert changes for this function about next_next"); using detail::ph; using detail::cp_and_word_prop; @@ -726,11 +720,7 @@ constexpr std::array, 20> word_breaks = {{ state.caps[ph::prev] = cp_and_word_prop(*first, word_prop); state.caps[ph::curr] = cp_and_word_prop(*state.it, word_prop); - state.it_next_next = state.it_next = std::next(state.it); - if (state.it_next != last) { - state.caps[ph::next] = cp_and_word_prop(*state.it_next, word_prop); - ++state.it_next_next; - } + state.it_next = std::next(state.it); state.emoji_state = state.caps[ph::prev].prop == word_property::Regional_Indicator @@ -738,18 +728,8 @@ constexpr std::array, 20> word_breaks = {{ : detail::word_break_emoji_state_t::none; for (; state.it != last; state = detail::next(state, last)) { - if (state.it_next_next != last) { - state.caps[ph::next_next] = cp_and_word_prop(*state.it_next_next, word_prop); - } - - // Check word_break before anything else. - if (word_break( - state.caps[ph::prev_prev].cp, - state.caps[ph::prev].cp, - state.caps[ph::curr].cp, - state.caps[ph::next].cp, - state.caps[ph::next_next].cp)) { - return state.it; + if (state.it_next != last) { + state.caps[ph::next] = cp_and_word_prop(*state.it_next, word_prop); } // WB3