Call this destructive function once, because it transitions this object into an undefined state.
| 613 | |
| 614 | /// Call this destructive function once, because it transitions this object into an undefined state. |
| 615 | Result match(bool isEndAContextTextBoundary = true) |
| 616 | { |
| 617 | bool characterMatchOccurred = false; |
| 618 | auto lastPrefixCharacterMatchIt = m_prefixFirst; |
| 619 | auto lastTextCharacterMatchIt = m_textFirst; |
| 620 | for (;; ++m_textFirst, ++m_prefixFirst) { |
| 621 | skipWhitespace(m_prefixFirst, m_prefixLast); |
| 622 | if (m_prefixFirst == m_prefixLast) { |
| 623 | setResult(HasMatched::Yes); |
| 624 | break; |
| 625 | } |
| 626 | |
| 627 | skipWhitespace(m_textFirst, m_textLast); |
| 628 | if (m_textFirst == m_textLast) { |
| 629 | skipFuzzyAndWhitespace(m_prefixFirst, m_prefixLast, m_fuzzyMatcher, /*isInserted=*/false); |
| 630 | if (m_prefixFirst == m_prefixLast) { |
| 631 | setResult(HasMatched::Yes); |
| 632 | } else { |
| 633 | setUnmatchedPrefixCharacterResult(); |
| 634 | } |
| 635 | break; |
| 636 | } |
| 637 | |
| 638 | if (*m_prefixFirst != *m_textFirst && !skipToMatchingPositions()) { |
| 639 | break; |
| 640 | } |
| 641 | |
| 642 | if (*m_prefixFirst == *m_textFirst) { |
| 643 | if (!characterMatchOccurred) { |
| 644 | characterMatchOccurred = true; |
| 645 | m_fuzzyMatcher.firstNonWhitespaceCharacterMatch(); |
| 646 | } |
| 647 | lastPrefixCharacterMatchIt = m_prefixFirst; |
| 648 | lastTextCharacterMatchIt = m_textFirst; |
| 649 | } |
| 650 | } |
| 651 | |
| 652 | if (isEndAContextTextBoundary && m_result.hasMatched) { |
| 653 | m_result.hasMatched = m_fuzzyMatcher.lastNonWhitespaceCharacterMatch(&*lastPrefixCharacterMatchIt, |
| 654 | &*lastTextCharacterMatchIt); |
| 655 | } |
| 656 | |
| 657 | return m_result; |
| 658 | } |
| 659 | |
| 660 | private: |
| 661 | /** |
no test coverage detected