Function: c-propertize-ml-string-opener
c-propertize-ml-string-opener is a byte-compiled function defined in
cc-engine.el.gz.
Signature
(c-propertize-ml-string-opener DELIM BOUND)
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/cc-engine.el.gz
(defun c-propertize-ml-string-opener (delim bound)
;; DELIM defines the opening delimiter of a multi-line string in the
;; way returned by `c-ml-string-opener-around-point'. Apply any
;; pertinent `syntax-table' text properties to this opening delimiter and in
;; the case of a terminated ml string, also to the innards of the string and
;; the terminating delimiter.
;;
;; BOUND is the end of the macro we're inside (i.e. the position of the
;; closing newline), if any, otherwise nil.
;;
;; Point is undefined at the function start. For a terminated ml string,
;; point is left after the terminating delimiter and t is returned. For an
;; unterminated string, point is left at the end of the macro, if any, or
;; after the unmatched opening delimiter, and nil is returned.
(c-propertize-ml-string-id delim)
(goto-char (cadr delim))
(if (re-search-forward
(funcall c-make-ml-string-closer-re-function
(buffer-substring-no-properties
(car delim) (cadr delim)))
bound t)
(let ((end-delim
(cons (match-beginning 1)
(cons (match-end 1) (match-beginning 2)))))
(c-propertize-ml-string-id end-delim)
(goto-char (cadr delim))
(while (progn (skip-syntax-forward c-ml-string-non-punc-skip-chars
(car end-delim))
(< (point) (car end-delim)))
(c-put-char-property (point) 'syntax-table '(1)) ; punctuation
(c-truncate-lit-pos-cache (point))
(forward-char))
(goto-char (cadr end-delim))
t)
(c-put-char-property (cddr delim) 'syntax-table '(1))
(c-put-string-fence (1- (cadr delim)))
(c-truncate-lit-pos-cache (1- (cddr delim)))
(when bound
;; In a CPP construct, we try to apply a generic-string
;; `syntax-table' text property to the last possible character in
;; the string, so that only characters within the macro get
;; "stringed out".
(goto-char bound)
(if (save-restriction
(narrow-to-region (cadr delim) (point-max))
(re-search-backward
(eval-when-compile
;; This regular expression matches either an escape pair
;; (which isn't an escaped NL) (submatch 5) or a
;; non-escaped character (which isn't itself a backslash)
;; (submatch 10). The long preambles to these
;; (respectively submatches 2-4 and 6-9) ensure that we
;; have the correct parity for sequences of backslashes,
;; etc..
(concat "\\(" ; 1
"\\(\\`[^\\]?\\|[^\\][^\\]\\)\\(\\\\\\(.\\|\n\\)\\)*" ; 2-4
"\\(\\\\.\\)" ; 5
"\\|"
"\\(\\`\\|[^\\]\\|\\(\\`[^\\]?\\|[^\\][^\\]\\)\\(\\\\\\(.\\|\n\\)\\)+\\)" ; 6-9
"\\([^\\]\\)" ; 10
"\\)"
"\\(\\\\\n\\)*\\=")) ; 11
(cadr delim) t))
(if (match-beginning 10)
(progn
(c-put-string-fence (match-beginning 10))
(c-truncate-lit-pos-cache (match-beginning 10)))
(c-put-char-property (match-beginning 5) 'syntax-table '(1))
(c-put-string-fence (1+ (match-beginning 5)))
(c-truncate-lit-pos-cache (match-beginning 5))))
(goto-char bound))
nil))