diff options
author | Alan Mackenzie <acm@muc.de> | 2019-03-30 13:19:47 +0000 |
---|---|---|
committer | Alan Mackenzie <acm@muc.de> | 2019-03-30 13:19:47 +0000 |
commit | b619777dd67e271d639c6fb1d031650af8fd79e6 (patch) | |
tree | 59d47a1b9a5ce06d4bcde293979ba670fc5fd9aa /lisp/progmodes/cc-langs.el | |
parent | dd7d83e1dbe5c308384f92689d6eb27c9cde1c20 (diff) | |
download | emacs-b619777dd67e271d639c6fb1d031650af8fd79e6.tar.gz emacs-b619777dd67e271d639c6fb1d031650af8fd79e6.tar.bz2 emacs-b619777dd67e271d639c6fb1d031650af8fd79e6.zip |
Allow a CC Mode derived mode to have strings delimited by single quotes.
Also fix the bug where the delimiters of '\033', etc. got the error face.
* lisp/progmodes/cc-langs.el (c-single-quotes-quote-strings): Enhance the docr
string.
(c-string-delims): Change doc string to doc comment.
* listp/progmodes/cc-mode.el (c-before-change-check-unbalanced-strings): In
searches and comparisons, take account of the string delimiters possibly
being '. Fix argument in call of c-before-change-check-unbalanced-strings.
(c-parse-quotes-before-change, c-parse-quotes-after-change): Bind
case-fold-search to nil. Analyze escape constructs inside character constants
more accurately, in particular accepting as valid more than one character
after /[0-7], /x, /u, and /U. Amend calculations to account for this extra
length.
Diffstat (limited to 'lisp/progmodes/cc-langs.el')
-rw-r--r-- | lisp/progmodes/cc-langs.el | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el index 22b7b602f1e..2dff5cf83c8 100644 --- a/lisp/progmodes/cc-langs.el +++ b/lisp/progmodes/cc-langs.el @@ -599,13 +599,21 @@ EOL terminated statements." (c-lang-defvar c-has-bitfields (c-lang-const c-has-bitfields)) (c-lang-defconst c-single-quotes-quote-strings - "Whether the language uses single quotes for multi-char strings." + "Whether the language uses single quotes for multi-char strings. + +Note that to set up a language to use this, additionally: +\(i) the syntax of \"'\" must be \"string quote\" (7); +\(ii) the language's value of `c-has-quoted-numbers' must be nil; +\(iii) the language's value of `c-get-state-before-change-functions' may not + contain `c-parse-quotes-before-change'; +\(iv) the language's value of `c-before-font-lock-functions' may not contain + `c-parse-quotes-after-change'." t nil) (c-lang-defvar c-single-quotes-quote-strings (c-lang-const c-single-quotes-quote-strings)) (c-lang-defconst c-string-delims - "A list of characters which can delimit arbitrary length strings" +;; A list of characters which can delimit arbitrary length strings. t (if (c-lang-const c-single-quotes-quote-strings) '(?\" ?\') '(?\"))) |