@@ -67,23 +67,27 @@ struct search_method {
67
67
68
68
auto it = begin;
69
69
if constexpr (is_string (front_re{}.front ) && size (front_re{}.list )) {
70
- it = search_for_string (it, end, front_re{}.front ).position ;
71
- for (; end != it;) {
72
- if (auto out = evaluate (orig_begin, it, end, Modifier{}, return_type<result_iterator, RE>{}, ctll::list<start_mark, sequence<decltype (front_re{}.front ), decltype (make_into_sequence (front_re{}.list ))>, end_mark, accept>())) {
73
- return out;
70
+ auto it2 = search_for_string (it, end, front_re{}.front );
71
+ return_type<result_iterator, RE> result{};
72
+ for (; end != it2.position ;) {
73
+ result.set_start_mark (it2.position );
74
+ if (result = evaluate (orig_begin, it2.end_position , end, Modifier{}, result, ctll::list<start_mark, decltype (make_into_sequence (front_re{}.list )), end_mark, accept>())) {
75
+ return result;
74
76
}
75
- it = search_for_string (++it, end, front_re{}.front ).position ;
77
+ result.unmatch ();
78
+ std::advance (it2.position , 1 );
79
+ it2 = search_for_string (it2.position , end, front_re{}.front );
76
80
}
77
- return evaluate (orig_begin, it, end, Modifier{}, return_type<result_iterator, RE>{}, ctll::list<start_mark, sequence<decltype (front_re{}.front ), decltype (make_into_sequence (front_re{}.list ))>, end_mark, accept>());
81
+ result.set_start_mark (it2.position );
82
+ return result = evaluate (orig_begin, it2.end_position , end, Modifier{}, result, ctll::list<start_mark, decltype (make_into_sequence (front_re{}.list )), end_mark, accept>());
78
83
} else if (is_string (front_re{}.front )) {
79
- it = search_for_string (it, end, front_re{}.front ).position ;
80
- for (; end != it;) {
81
- if (auto out = evaluate (orig_begin, it, end, Modifier{}, return_type<result_iterator, RE>{}, ctll::list<start_mark, decltype (front_re{}.front ), end_mark, accept>())) {
82
- return out;
83
- }
84
- it = search_for_string (++it, end, front_re{}.front ).position ;
85
- }
86
- return evaluate (orig_begin, it, end, Modifier{}, return_type<result_iterator, RE>{}, ctll::list<start_mark, decltype (front_re{}.front ), end_mark, accept>());
84
+ auto it2 = search_for_string (it, end, front_re{}.front );
85
+ return_type<result_iterator, RE> result{};
86
+ result.set_start_mark (it2.position );
87
+ result.set_end_mark (it2.end_position );
88
+ if (it2.match )
89
+ result.matched ();
90
+ return result;
87
91
} else {
88
92
for (; end != it && !fixed; ++it) {
89
93
if (auto out = evaluate (orig_begin, it, end, Modifier{}, return_type<result_iterator, RE>{}, ctll::list<start_mark, RE, end_mark, accept>())) {
0 commit comments