Function: c-ml-string-make-closer-re

c-ml-string-make-closer-re is a byte-compiled function defined in cc-engine.el.gz.

Signature

(c-ml-string-make-closer-re OPENER)

Documentation

Return c-ml-string-any-closer-re.

This is a suitable language specific value of c-make-ml-string-closer-re-function for most languages with multi-line strings (but not C++, for example).

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/cc-engine.el.gz
;; Handling of CC Mode multi-line strings.
;;
;; By a "multi-line string" is meant a string opened by a "decorated"
;; double-quote mark, and which can continue over several lines without the
;; need to escape the newlines, terminating at a closer, a possibly
;; "decorated" double-quote mark.  The string can usually contain double
;; quotes without them being quoted, whether or not backslashes quote the
;; following character being a matter of configuration.
;;
;; CC Mode handles multi-line strings by the use of `syntax-table' text
;; properties as follows:
;;
;; (i) On a validly terminated ml string, syntax-table text-properties are
;;   applied as needed to the opener, so that the " character in the opener
;;   (or (usually) the first of them if there are several) retains its normal
;;   syntax, and any other characters with obtrusive syntax are given
;;   "punctuation" '(1) properties.  Similarly, the " character in the closer
;;   retains its normal syntax, and characters with obtrusive syntax are
;;   "punctuated out" as before.
;;
;;   The font locking routine `c-font-lock-ml-strings' (in cc-fonts.el)
;;   recognizes validly terminated ml strings and fontifies (typically) the
;;   innermost character of each delimiter in font-lock-string-face and the
;;   rest of those delimiters in the default face.  The contents, of course,
;;   are in font-lock-string-face.
;;
;; (ii) A valid, but unterminated, ml string's opening delimiter gets the
;;   "punctuation" value (`(1)') of the `syntax-table' text property on its ",
;;   and the last char of the opener gets the "string fence" value '(15).
;;   (The latter takes precedence over the former.)  When such a delimiter is
;;   found, no attempt is made in any way to "correct" any text properties
;;   after the delimiter.
;;
;;   `c-font-lock-ml-strings' puts c-font-lock-warning-face on the entire
;;   unmatched opening delimiter, and allows the tail of the buffer to get
;;   font-lock-string-face, caused by the unmatched "string fence"
;;   `syntax-table' text property value.
;;
;; (iii) Inside a macro, a valid ml string is handled as in (i).  An unmatched
;;   opening delimiter is handled slightly differently.  In addition to the
;;   "punctuation" and "string fence" properties on the delimiter, another
;;   "string fence" `syntax-table' property is applied to the last possible
;;   character of the macro before the terminating linefeed (if there is such
;;   a character after the delimiter).  This "last possible" character is
;;   never a backslash escaping the end of line.  If the character preceding
;;   this "last possible" character is itself a backslash, this preceding
;;   character gets a "punctuation" `syntax-table' value.  If the last
;;   character of the closing delimiter is already at the end of the macro, it
;;   gets the "punctuation" value, and no "string fence"s are used.
;;
;;   The effect on the fontification of either of these tactics is that the
;;   rest of the macro (if any) after the "(" gets font-lock-string-face, but
;;   the rest of the file is fontified normally.

(defun c-ml-string-make-closer-re (_opener)
  "Return `c-ml-string-any-closer-re'.

This is a suitable language specific value of
`c-make-ml-string-closer-re-function' for most languages with
multi-line strings (but not C++, for example)."
  c-ml-string-any-closer-re)