Function: dtrt-indent--skip-to-end-of-match
dtrt-indent--skip-to-end-of-match is a natively compiled function
defined in dtrt-indent.el.
Signature
(dtrt-indent--skip-to-end-of-match END-REGEX SKIP-REGEX SYNTAX-REGEX-PAIRS MULTI-LINE)
Documentation
Place point at the end of the current match.
END-REGEX is a regular expression matching the end. If
SKIP-REGEX matches though, END-REGEX is ignored.
SYNTAX-REGEX-PAIRS is a list of syntax entries as described for
dtrt-indent-language-syntax-table. MULTI-LINE, if false,
constrains the search to the current line.
Source Code
;; Defined in /nix/store/xl774j723v677bsfsybzln3vi6w0fpm3-emacs-packages-deps/share/emacs/site-lisp/elpa/dtrt-indent-20260709.2011/dtrt-indent.el
(defun dtrt-indent--skip-to-end-of-match (end-regex
skip-regex
syntax-regex-pairs
multi-line)
"Place point at the end of the current match.
END-REGEX is a regular expression matching the end. If
SKIP-REGEX matches though, END-REGEX is ignored.
SYNTAX-REGEX-PAIRS is a list of syntax entries as described for
`dtrt-indent-language-syntax-table'. MULTI-LINE, if false,
constrains the search to the current line."
(let* ((index-offset 1)
end-index
skip-index
(regexp
(mapconcat
(lambda (el) (concat "\\(" el "\\)"))
(append (when end-regex
(setq end-index index-offset)
(setq index-offset (1+ index-offset))
(list end-regex))
(when skip-regex
(setq skip-index index-offset)
(setq index-offset (1+ index-offset))
(list skip-regex))
(mapcar (lambda (x) (car x))
syntax-regex-pairs))
"\\|")))
(while
(and
(re-search-forward regexp
(unless multi-line
(save-excursion (end-of-line) (point))) t)
(let ((match-index 1)
(match-count (/ (length (match-data)) 2)))
(while (and (<= match-index match-count)
(null (match-beginning match-index)))
(setq match-index (1+ match-index)))
(cond
((eq match-index end-index) nil)
((eq match-index skip-index) t)
(t
(let ((matching-syntax-entry
(let ((match-count (- match-index index-offset))
(syntax-regex-iterator syntax-regex-pairs))
(while (> match-count
(nth 1 (car syntax-regex-iterator)))
(setq match-count
(- match-count
(nth 1 (car syntax-regex-iterator)) 1))
(setq syntax-regex-iterator
(cdr syntax-regex-iterator)))
(car syntax-regex-iterator))))
(dtrt-indent--skip-to-end-of-match
(if (> (nth 1 matching-syntax-entry) 0)
(dtrt-indent--replace-in-string
(nth 2 matching-syntax-entry)
"[\\][1]" (regexp-quote
(match-string-no-properties
(1+ match-index))))
(nth 2 matching-syntax-entry))
(nth 4 matching-syntax-entry)
(when (nth 3 matching-syntax-entry) syntax-regex-pairs)
t)
t))))))))