Commit b733a910 authored by Alan Mackenzie's avatar Alan Mackenzie

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.
parent d577d160
......@@ -7387,7 +7387,12 @@ comment at the start of cc-engine.el for more info."
(setq pos (point)
res subres))))
((looking-at c-identifier-start)
((and (looking-at c-identifier-start)
(or (not (looking-at
c-ambiguous-overloadable-or-identifier-prefix-re))
(save-excursion
(and (eq (c-forward-token-2) 0)
(not (eq (char-after) ?\())))))
;; Got a cast operator.
(when (c-forward-type)
(setq pos (point)
......
......@@ -1185,6 +1185,24 @@ This regexp is assumed to not match any non-operator identifier."
(make-obsolete-variable 'c-opt-op-identitier-prefix 'c-opt-op-identifier-prefix
"CC Mode 5.31.4, 2006-04-14")
(c-lang-defconst c-ambiguous-overloadable-or-identifier-prefices
;; A list of strings which can be either overloadable operators or
;; identifier prefixes.
t (c--intersection
(c-filter-ops (c-lang-const c-identifier-ops)
'(prefix)
t)
(c-lang-const c-overloadable-operators)
:test 'string-equal))
(c-lang-defconst c-ambiguous-overloadable-or-identifier-prefix-re
;; A regexp matching strings which can be either overloadable operators
;; or identifier prefixes.
t (c-make-keywords-re
t (c-lang-const c-ambiguous-overloadable-or-identifier-prefices)))
(c-lang-defvar c-ambiguous-overloadable-or-identifier-prefix-re
(c-lang-const c-ambiguous-overloadable-or-identifier-prefix-re))
(c-lang-defconst c-other-op-syntax-tokens
"List of the tokens made up of characters in the punctuation or
parenthesis syntax classes that have uses other than as expression
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment