aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Mackenzie2017-09-03 09:40:31 +0000
committerAlan Mackenzie2017-09-03 09:40:31 +0000
commitb733a910091c426de0d831f1ce0cda4ae736ab69 (patch)
treec021e94aac769722266283b16186f41635701f7a
parentd577d1609c6c9d11b6af30a33e02bb21ffa821fd (diff)
downloademacs-b733a910091c426de0d831f1ce0cda4ae736ab69.tar.gz
emacs-b733a910091c426de0d831f1ce0cda4ae736ab69.zip
Fix fontification of "operator~" in C++ Mode.
* lisp/progmodes/cc-langs.el (c-ambiguous-overloadable-or-identifier-prefices) (c-ambiguous-overloadable-or-identifier-prefix-re): New c-lang-defconsts/vars. * lisp/progmodes/cc-engine.el (c-forward-name): Do not try to parse "~" (and two other symbols) as a cast without good evidence. Prefer an overloaded operator in ambiguous cases.
-rw-r--r--lisp/progmodes/cc-engine.el7
-rw-r--r--lisp/progmodes/cc-langs.el18
2 files changed, 24 insertions, 1 deletions
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index bf95dc1e3ce..5ac4a769337 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -7387,7 +7387,12 @@ comment at the start of cc-engine.el for more info."
7387 (setq pos (point) 7387 (setq pos (point)
7388 res subres)))) 7388 res subres))))
7389 7389
7390 ((looking-at c-identifier-start) 7390 ((and (looking-at c-identifier-start)
7391 (or (not (looking-at
7392 c-ambiguous-overloadable-or-identifier-prefix-re))
7393 (save-excursion
7394 (and (eq (c-forward-token-2) 0)
7395 (not (eq (char-after) ?\())))))
7391 ;; Got a cast operator. 7396 ;; Got a cast operator.
7392 (when (c-forward-type) 7397 (when (c-forward-type)
7393 (setq pos (point) 7398 (setq pos (point)
diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el
index 93e8df16c16..d4eae06f290 100644
--- a/lisp/progmodes/cc-langs.el
+++ b/lisp/progmodes/cc-langs.el
@@ -1185,6 +1185,24 @@ This regexp is assumed to not match any non-operator identifier."
1185(make-obsolete-variable 'c-opt-op-identitier-prefix 'c-opt-op-identifier-prefix 1185(make-obsolete-variable 'c-opt-op-identitier-prefix 'c-opt-op-identifier-prefix
1186 "CC Mode 5.31.4, 2006-04-14") 1186 "CC Mode 5.31.4, 2006-04-14")
1187 1187
1188(c-lang-defconst c-ambiguous-overloadable-or-identifier-prefices
1189 ;; A list of strings which can be either overloadable operators or
1190 ;; identifier prefixes.
1191 t (c--intersection
1192 (c-filter-ops (c-lang-const c-identifier-ops)
1193 '(prefix)
1194 t)
1195 (c-lang-const c-overloadable-operators)
1196 :test 'string-equal))
1197
1198(c-lang-defconst c-ambiguous-overloadable-or-identifier-prefix-re
1199 ;; A regexp matching strings which can be either overloadable operators
1200 ;; or identifier prefixes.
1201 t (c-make-keywords-re
1202 t (c-lang-const c-ambiguous-overloadable-or-identifier-prefices)))
1203(c-lang-defvar c-ambiguous-overloadable-or-identifier-prefix-re
1204 (c-lang-const c-ambiguous-overloadable-or-identifier-prefix-re))
1205
1188(c-lang-defconst c-other-op-syntax-tokens 1206(c-lang-defconst c-other-op-syntax-tokens
1189 "List of the tokens made up of characters in the punctuation or 1207 "List of the tokens made up of characters in the punctuation or
1190parenthesis syntax classes that have uses other than as expression 1208parenthesis syntax classes that have uses other than as expression