Function: python--string-bytes-literal-matcher
python--string-bytes-literal-matcher is a byte-compiled function
defined in python.el.gz.
Signature
(python--string-bytes-literal-matcher REGEXP START-REGEXP)
Documentation
Match REGEXP within a string or bytes literal whose start matches START-REGEXP.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/python.el.gz
(defun python--string-bytes-literal-matcher (regexp start-regexp)
"Match REGEXP within a string or bytes literal whose start matches START-REGEXP."
(lambda (limit)
(cl-loop for result = (re-search-forward regexp limit t)
for result-valid = (and
result
(when-let* ((pos (nth 8 (syntax-ppss)))
(before-quote
(buffer-substring-no-properties
(max (- pos 4) (point-min))
(min (+ pos 1) (point-max)))))
(backward-char)
(string-match-p start-regexp before-quote)))
until (or (not result) result-valid)
finally return (and result-valid result))))