@@ -31,4 +31,38 @@ template <auto V, typename... Look, typename... Ts, size_t Counter> static const
3131 return pcre_context{ctll::list<lookahead_negative<Look...>, Ts...>(), pcre_parameters<Counter>()};
3232}
3333
34+ // LOOKBEHIND
35+
36+ // lookbehind positive start
37+ template <auto V, typename ... Ts, size_t Counter> static constexpr auto apply (pcre::start_lookbehind_positive, ctll::term<V>, pcre_context<ctll::list<Ts...>, pcre_parameters<Counter>>) {
38+ return pcre_context{ctll::list<look_start<lookbehind_positive<>>, Ts...>(), pcre_parameters<Counter>()};
39+ }
40+
41+ // lookbehind positive end
42+ template <auto V, typename Look, typename ... Ts, size_t Counter> static constexpr auto apply (pcre::look_finish, ctll::term<V>, pcre_context<ctll::list<Look, look_start<lookbehind_positive<>>, Ts...>, pcre_parameters<Counter>>) {
43+ return pcre_context{ctll::list<lookbehind_positive<decltype (ctre::rotate_for_lookbehind::rotate (Look{}))>, Ts...>(), pcre_parameters<Counter>()};
44+ }
45+
46+ // lookbehind positive end (sequence)
47+ template <auto V, typename ... Look, typename ... Ts, size_t Counter> static constexpr auto apply (pcre::look_finish, ctll::term<V>, pcre_context<ctll::list<ctre::sequence<Look...>, look_start<lookbehind_positive<>>, Ts...>, pcre_parameters<Counter>>) {
48+ using my_lookbehind = decltype (ctre::convert_to_basic_list<lookbehind_positive>(ctll::rotate (ctll::list<decltype (ctre::rotate_for_lookbehind::rotate (Look{}))...>{})));
49+ return pcre_context{ctll::list<my_lookbehind, Ts...>(), pcre_parameters<Counter>()};
50+ }
51+
52+ // lookbehind negative start
53+ template <auto V, typename ... Ts, size_t Counter> static constexpr auto apply (pcre::start_lookbehind_negative, ctll::term<V>, pcre_context<ctll::list<Ts...>, pcre_parameters<Counter>>) {
54+ return pcre_context{ctll::list<look_start<lookbehind_negative<>>, Ts...>(), pcre_parameters<Counter>()};
55+ }
56+
57+ // lookbehind negative end
58+ template <auto V, typename Look, typename ... Ts, size_t Counter> static constexpr auto apply (pcre::look_finish, ctll::term<V>, pcre_context<ctll::list<Look, look_start<lookbehind_negative<>>, Ts...>, pcre_parameters<Counter>>) {
59+ return pcre_context{ctll::list<lookbehind_negative<decltype (ctre::rotate_for_lookbehind::rotate (Look{}))>, Ts...>(), pcre_parameters<Counter>()};
60+ }
61+
62+ // lookbehind negative end (sequence)
63+ template <auto V, typename ... Look, typename ... Ts, size_t Counter> static constexpr auto apply (pcre::look_finish, ctll::term<V>, pcre_context<ctll::list<ctre::sequence<Look...>, look_start<lookbehind_negative<>>, Ts...>, pcre_parameters<Counter>>) {
64+ using my_lookbehind = decltype (ctre::convert_to_basic_list<lookbehind_negative>(ctll::rotate (ctll::list<decltype (ctre::rotate_for_lookbehind::rotate (Look{}))...>{})));
65+ return pcre_context{ctll::list<my_lookbehind, Ts...>(), pcre_parameters<Counter>()};
66+ }
67+
3468#endif
0 commit comments