MCPcopy Create free account
hub / github.com/boostorg/parser / extend_subsequence_impl

Function extend_subsequence_impl

include/boost/parser/detail/text/trie.hpp:808–845  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

806
807 template<bool StopAtMatch, typename KeyIter, typename Sentinel>
808 match_result extend_subsequence_impl(
809 match_result prev, KeyIter & first, Sentinel last) const
810 {
811 if (to_node_ptr(prev.node) == &header_) {
812 if (header_.empty())
813 return prev;
814 prev.node = header_.child(0);
815 }
816
817 if (first == last) {
818 prev.match = !!to_node_ptr(prev.node)->value();
819 prev.leaf = to_node_ptr(prev.node)->empty();
820 return prev;
821 }
822
823 node_t const * node = to_node_ptr(prev.node);
824 size_type size = prev.size;
825 node_t const * last_match_node = nullptr;
826 size_type last_match_size = 0;
827 while (first != last) {
828 auto const it = node->find(*first, comp_);
829 if (it == node->end())
830 break;
831 ++first;
832 ++size;
833 node = it->get();
834 if (StopAtMatch && !!node->value()) {
835 last_match_node = node;
836 last_match_size = size;
837 }
838 }
839 if (StopAtMatch && last_match_node) {
840 node = last_match_node;
841 size = last_match_size;
842 }
843
844 return match_result{node, size, !!node->value(), node->empty()};
845 }
846
847 template<typename KeyIter, typename Sentinel>
848 node_t * create_children(node_t * node, KeyIter first, Sentinel last)

Callers

nothing calls this directly

Calls 7

to_node_ptrFunction · 0.70
emptyMethod · 0.45
childMethod · 0.45
valueMethod · 0.45
findMethod · 0.45
endMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected