CC Mode: allow bogusly "adjacent" double quote marks to pair up syntactically
commit585fb957399f21a93cbfabd182b76262466797e3
authorAlan Mackenzie <acm@muc.de>
Tue, 16 Jul 2019 20:01:12 +0000 (16 20:01 +0000)
committerAlan Mackenzie <acm@muc.de>
Tue, 16 Jul 2019 20:01:12 +0000 (16 20:01 +0000)
tree3b3656706b56b771b316e5fb159f231688e4713b
parentd2758820cd45733570c704431da3f3e91dbb8605
CC Mode: allow bogusly "adjacent" double quote marks to pair up syntactically

For this introduce the text property c-fl-syn-tab to "mirror" syntax-table.

* lisp/progmodes/cc-defs.el (c-is-escaped, c-will-be-escaped, c-put-syn-tab)
(c-clear-syn-tab, c-clear-syn-tab-properties, c-with-extended-string-fences):
new macros.
(c-point): Use c-is-escaped
(c-search-forward-char-property, c-search-backward-char-property)
(c-search-forward-char-property-with-value-on-char)
(c-search-forward-char-property-without-value-on-char): Fix regexp error
involving \n.

* lisp/progmodes/cc-engine.el (c-semi-pp-to-literal): User
c-with-extended-string-fences around a parse-partial-sexp.
(c-full-get-near-cache-entry): Fix an off-by-one error.
(c-full-pp-to-literal): Avoid writing duplicate entries into a cache.
(c-after-change-unmark-raw-strings): Use c-clear-syn-tab-properties.

* lisp/progmodes/cc-mode.el (c-leave-cc-mode-mode): Clear the c-fl-syn-tab
properties, too.
(c-basic-common-init): Mark c-fl-syn-tab as a non-sticky text property.
(c-depropertize-new-text): Also handle c-fl-syn-tab.
(c-multiline-string-check-final-quote, c-parse-quotes-after-change): Use
c-is-escaped.
(c-fl-syn-tab-region): New variable.
(c-clear-string-fences, c-restore-string-fences, c-remove-string-fences): New
functions.
(c-before-change-check-unbalanced-strings)
(c-after-change-mark-abnormal-strings, c-after-change-escape-NL-in-string):
Use the new functions and macros.
(c-before-change, c-after-change, c-font-lock-fontify-region): Restore the
syntax-table text properties from c-fl-syn-tab text properties for these
functions.
(c-electric-pair-inhibit-predicate): Test the c-fl-syn-tab property rather
than syntax-table.
lisp/progmodes/cc-defs.el
lisp/progmodes/cc-engine.el
lisp/progmodes/cc-mode.el