Function: expreg--string
expreg--string is a natively compiled function defined in expreg.el.
Signature
(expreg--string)
Documentation
Return regions marking the inside and outside of the string.
Source Code
;; Defined in /nix/store/29cdhkmkqv2bgp3p30khhf35kkbgx1ya-emacs-packages-deps/share/emacs/site-lisp/elpa/expreg-1.4.1/expreg.el
(defun expreg--string ()
"Return regions marking the inside and outside of the string."
(let ( outside-beg outside-end
inside-beg inside-end)
(condition-case nil
(progn
(if (expreg--inside-string-p)
;; Inside a string? Move to beginning.
(goto-char (expreg--start-of-comment-or-string))
;; Not inside a string, but at the end of a string and not at
;; the beginning of another one? Move to beginning.
(when (and (eq (char-syntax (or (char-before) ?x)) 34)
(not (eq (char-syntax (or (char-after) ?x)) 34)))
(backward-sexp)))
;; Not inside a string and at the beginning of one.
(when (and (not (expreg--inside-string-p))
(eq (char-syntax (or (char-after) ?x)) 34))
(setq outside-beg (point))
(forward-sexp)
(when (eq (char-syntax (or (char-before) ?x)) 34)
(setq outside-end (point))
(backward-char)
(setq inside-end (point))
(goto-char outside-beg)
(forward-char)
(setq inside-beg (point))
;; It’s ok if point is at outside string and we return a
;; region marking inside the string: expreg will filter the
;; inside one out.
(list `(string . ,(cons outside-beg outside-end))
`(string . ,(cons inside-beg inside-end))))))
(scan-error nil))))