-
Notifications
You must be signed in to change notification settings - Fork 201
Open
Description
Not sure how to go about this with parsing rules, or for all cases.
See: http://www.rexegg.com/regex-optimizations.html#staralt
// (greedy) repeat of alternation (?:a|b...)* -> a*(?:b...+a*)*
template <typename R, typename Iterator, typename EndIterator, typename A, typename... Content, typename... Tail>
constexpr CTRE_FORCE_INLINE R evaluate(const Iterator begin, Iterator current, const EndIterator end, R captures, ctll::list<repeat<0, 0, sequence<select<A,Content...>>>, Tail...>) noexcept {
return evaluate(begin, current, end, captures, ctll::list<star<A>, star<plus<select<Content...>>, star<A>>, Tail...>());
}
// (greedy) repeat of alternation (?:a|b...)* -> a*(?:b...+a*)*
template <typename R, typename Iterator, typename EndIterator, typename A, typename... Content, typename... Tail>
constexpr CTRE_FORCE_INLINE R evaluate(const Iterator begin, Iterator current, const EndIterator end, R captures, ctll::list<repeat<0, 0, select<A, Content...>>, Tail...>) noexcept {
return evaluate(begin, current, end, captures, ctll::list<star<A>, star<plus<select<Content...>>, star<A>>, Tail...>());
}
Pretty sure with some other overloads capture groups would also work. (a|b...)* -> (a)(?:(b...)+(a))*
Metadata
Metadata
Assignees
Labels
No labels