aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/progmodes/cc-engine.el45
-rw-r--r--lisp/progmodes/cc-fonts.el20
-rw-r--r--lisp/progmodes/cc-langs.el12
3 files changed, 68 insertions, 9 deletions
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index 0ac96219a19..223b1e917fe 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -8356,6 +8356,23 @@ multi-line strings (but not C++, for example)."
8356 (goto-char here)))) 8356 (goto-char here))))
8357 t) 8357 t)
8358 8358
8359(defun c-forward-over-colon-type-list ()
8360 ;; If we're at a sequence of characters which can extend from, e.g.,
8361 ;; a class name up to a colon introducing an inheritance list,
8362 ;; move forward over them, including the colon, and return non-nil.
8363 ;; Otherwise return nil, leaving point unmoved.
8364 (let ((here (point)) pos)
8365 (while (and (re-search-forward c-sub-colon-type-list-re nil t)
8366 (not (eq (char-after) ?:))
8367 (c-major-mode-is 'c++-mode)
8368 (setq pos (c-looking-at-c++-attribute)))
8369 (goto-char pos))
8370 (if (eq (char-after) ?:)
8371 (progn (forward-char)
8372 t)
8373 (goto-char here)
8374 nil)))
8375
8359(defun c-forward-keyword-clause (match) 8376(defun c-forward-keyword-clause (match)
8360 ;; Submatch MATCH in the current match data is assumed to surround a 8377 ;; Submatch MATCH in the current match data is assumed to surround a
8361 ;; token. If it's a keyword, move over it and any immediately 8378 ;; token. If it's a keyword, move over it and any immediately
@@ -8463,12 +8480,11 @@ multi-line strings (but not C++, for example)."
8463 (and c-record-type-identifiers 8480 (and c-record-type-identifiers
8464 (progn 8481 (progn
8465 ;; If a keyword matched both one of the types above and 8482 ;; If a keyword matched both one of the types above and
8466 ;; this one, we match `c-colon-type-list-re' after the 8483 ;; this one, we move forward to the colon following the
8467 ;; clause matched above. 8484 ;; clause matched above.
8468 (goto-char safe-pos) 8485 (goto-char safe-pos)
8469 (looking-at c-colon-type-list-re)) 8486 (c-forward-over-colon-type-list))
8470 (progn 8487 (progn
8471 (goto-char (match-end 0))
8472 (c-forward-syntactic-ws) 8488 (c-forward-syntactic-ws)
8473 (c-forward-keyword-prefixed-id type)) 8489 (c-forward-keyword-prefixed-id type))
8474 ;; There's a type after the `c-colon-type-list-re' match 8490 ;; There's a type after the `c-colon-type-list-re' match
@@ -8921,8 +8937,16 @@ multi-line strings (but not C++, for example)."
8921 ;; Got some other operator. 8937 ;; Got some other operator.
8922 (setq c-last-identifier-range 8938 (setq c-last-identifier-range
8923 (cons (point) (match-end 0))) 8939 (cons (point) (match-end 0)))
8940 (if (and (eq (char-after) ?\")
8941 (eq (char-after (1+ (point))) ?\"))
8942 ;; operator"" has an (?)optional tag after it.
8943 (progn
8944 (goto-char (match-end 0))
8945 (c-forward-syntactic-ws lim+)
8946 (when (c-on-identifier)
8947 (c-forward-token-2 1 nil lim+)))
8924 (goto-char (match-end 0)) 8948 (goto-char (match-end 0))
8925 (c-forward-syntactic-ws lim+) 8949 (c-forward-syntactic-ws lim+))
8926 (setq pos (point) 8950 (setq pos (point)
8927 res 'operator))) 8951 res 'operator)))
8928 8952
@@ -9676,7 +9700,7 @@ point unchanged and return nil."
9676 ;; (e.g. "," or ";" or "}"). 9700 ;; (e.g. "," or ";" or "}").
9677 (let ((here (point)) 9701 (let ((here (point))
9678 id-start id-end brackets-after-id paren-depth decorated 9702 id-start id-end brackets-after-id paren-depth decorated
9679 got-init arglist) 9703 got-init arglist double-double-quote)
9680 (or limit (setq limit (point-max))) 9704 (or limit (setq limit (point-max)))
9681 (if (and 9705 (if (and
9682 (< (point) limit) 9706 (< (point) limit)
@@ -9705,6 +9729,10 @@ point unchanged and return nil."
9705 (setq id-start (point)) 9729 (setq id-start (point))
9706 (if (looking-at c-overloadable-operators-regexp) 9730 (if (looking-at c-overloadable-operators-regexp)
9707 (progn 9731 (progn
9732 (when (and (c-major-mode-is 'c++-mode)
9733 (eq (char-after) ?\")
9734 (eq (char-after (1+ (point))) ?\"))
9735 (setq double-double-quote t))
9708 (goto-char (match-end 0)) 9736 (goto-char (match-end 0))
9709 (c-forward-syntactic-ws limit) 9737 (c-forward-syntactic-ws limit)
9710 (setq got-identifier t) 9738 (setq got-identifier t)
@@ -9756,6 +9784,13 @@ point unchanged and return nil."
9756 t) 9784 t)
9757 (t nil))) 9785 (t nil)))
9758 9786
9787 (progn
9788 (c-forward-syntactic-ws limit)
9789 (when (and double-double-quote ; C++'s operator"" _tag
9790 (c-on-identifier))
9791 (c-forward-token-2 1 nil limit))
9792 t)
9793
9759 ;; Skip out of the parens surrounding the identifier. If closing 9794 ;; Skip out of the parens surrounding the identifier. If closing
9760 ;; parens are missing, this form returns nil. 9795 ;; parens are missing, this form returns nil.
9761 (or (= paren-depth 0) 9796 (or (= paren-depth 0)
diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el
index 2e71285cb36..b4ff32b9070 100644
--- a/lisp/progmodes/cc-fonts.el
+++ b/lisp/progmodes/cc-fonts.el
@@ -1141,12 +1141,28 @@ casts and declarations are fontified. Used on level 2 and higher."
1141 (while (and (< (point) id-end) 1141 (while (and (< (point) id-end)
1142 (re-search-forward c-opt-identifier-prefix-key id-end t)) 1142 (re-search-forward c-opt-identifier-prefix-key id-end t))
1143 (c-forward-syntactic-ws limit)))) 1143 (c-forward-syntactic-ws limit))))
1144 (when (not (get-text-property (point) 'face)) 1144 ;; Only apply the face when the text doesn't have one yet.
1145 ;; Exception: The "" in C++'s operator"" will already wrongly have
1146 ;; string face.
1147 (when (memq (get-text-property (point) 'face)
1148 '(nil font-lock-string-face))
1145 (c-put-font-lock-face (point) id-end 1149 (c-put-font-lock-face (point) id-end
1146 (cond 1150 (cond
1147 ((not (memq types '(nil t))) types) 1151 ((not (memq types '(nil t))) types)
1148 (is-function 'font-lock-function-name-face) 1152 (is-function 'font-lock-function-name-face)
1149 (t 'font-lock-variable-name-face)))))) 1153 (t 'font-lock-variable-name-face))))
1154 ;; Fontify any _tag in C++'s operator"" _tag.
1155 (when (and
1156 (c-major-mode-is 'c++-mode)
1157 (equal (buffer-substring-no-properties id-start id-end)
1158 "\"\""))
1159 (goto-char id-end)
1160 (c-forward-syntactic-ws limit)
1161 (when (c-on-identifier)
1162 (c-put-font-lock-face
1163 (point)
1164 (progn (c-forward-over-token) (point))
1165 font-lock-function-name-face)))))
1150 (and template-class 1166 (and template-class
1151 (eq init-char ?=) ; C++ "<class X = Y>"? 1167 (eq init-char ?=) ; C++ "<class X = Y>"?
1152 (progn 1168 (progn
diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el
index cd23483a58f..650c8720ee4 100644
--- a/lisp/progmodes/cc-langs.el
+++ b/lisp/progmodes/cc-langs.el
@@ -1449,8 +1449,7 @@ form\". See also `c-op-identifier-prefix'."
1449 "??'=" "xor_eq" "&=" "and_eq" "|=" "??!=" "or_eq" 1449 "??'=" "xor_eq" "&=" "and_eq" "|=" "??!=" "or_eq"
1450 "<<" ">>" ">>=" "<<=" "==" "!=" "not_eq" "<=>" "<=" ">=" 1450 "<<" ">>" ">>=" "<<=" "==" "!=" "not_eq" "<=>" "<=" ">="
1451 "&&" "and" "||" "??!??!" "or" "++" "--" "," "->*" "->" 1451 "&&" "and" "||" "??!??!" "or" "++" "--" "," "->*" "->"
1452 "()" "[]" "<::>" "??(??)") 1452 "()" "[]" "\"\"" "<::>" "??(??)")
1453 ;; These work like identifiers in Pike.
1454 pike '("`+" "`-" "`&" "`|" "`^" "`<<" "`>>" "`*" "`/" "`%" "`~" 1453 pike '("`+" "`-" "`&" "`|" "`^" "`<<" "`>>" "`*" "`/" "`%" "`~"
1455 "`==" "`<" "`>" "`!" "`[]" "`[]=" "`->" "`->=" "`()" "``+" 1454 "`==" "`<" "`>" "`!" "`[]" "`[]=" "`->" "`->=" "`()" "``+"
1456 "``-" "``&" "``|" "``^" "``<<" "``>>" "``*" "``/" "``%" 1455 "``-" "``&" "``|" "``^" "``<<" "``>>" "``*" "``/" "``%"
@@ -2936,6 +2935,15 @@ regexp if `c-colon-type-list-kwds' isn't nil."
2936 "[^][{}();,/#=:]*:"))) 2935 "[^][{}();,/#=:]*:")))
2937(c-lang-defvar c-colon-type-list-re (c-lang-const c-colon-type-list-re)) 2936(c-lang-defvar c-colon-type-list-re (c-lang-const c-colon-type-list-re))
2938 2937
2938(c-lang-defconst c-sub-colon-type-list-re
2939 "Regexp matching buffer content that may come between a keyword in
2940`c-colon-type-list-kwds' and a putative colon, or nil if there are no
2941such keywords. Exception: it does not match any C++ attributes."
2942 t (if (c-lang-const c-colon-type-list-re)
2943 (substring (c-lang-const c-colon-type-list-re) 0 -1)))
2944(c-lang-defvar c-sub-colon-type-list-re
2945 (c-lang-const c-sub-colon-type-list-re))
2946
2939(c-lang-defconst c-paren-nontype-kwds 2947(c-lang-defconst c-paren-nontype-kwds
2940 "Keywords that may be followed by a parenthesis expression that doesn't 2948 "Keywords that may be followed by a parenthesis expression that doesn't
2941contain type identifiers." 2949contain type identifiers."