summaryrefslogtreecommitdiff
path: root/lisp/progmodes/cc-langs.el
diff options
context:
space:
mode:
authorAlan Mackenzie <acm@muc.de>2016-12-29 15:34:36 +0000
committerAlan Mackenzie <acm@muc.de>2016-12-29 15:34:36 +0000
commit11b81a54d538e8deca3cd64521cf85409efb617b (patch)
tree566d97547ea1057db231857c9f4a1cebbb34f032 /lisp/progmodes/cc-langs.el
parent0d19e69184cd3068279677fb04aa9fb2da6895e4 (diff)
downloademacs-11b81a54d538e8deca3cd64521cf85409efb617b.tar.gz
emacs-11b81a54d538e8deca3cd64521cf85409efb617b.tar.bz2
emacs-11b81a54d538e8deca3cd64521cf85409efb617b.zip
Partially correct fontification of "(b*3)", and the like, in C++ Mode
This problem is caused by the fundamental ambiguity in C++ between argument declarations and initialisation clauses. * lisp/progmodes/cc-fonts.el (c-font-lock-declarations): If we have an open paren preceded by an arithmetic operator, we give this the context nil, not 'arglist. * lisp/progmodes/cc-langs.el (c-arithmetic-operators, c-arithmetic-op-regexp): New lang consts and vars.
Diffstat (limited to 'lisp/progmodes/cc-langs.el')
-rw-r--r--lisp/progmodes/cc-langs.el16
1 files changed, 16 insertions, 0 deletions
diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el
index 3c328489ec1..83b8db3657e 100644
--- a/lisp/progmodes/cc-langs.el
+++ b/lisp/progmodes/cc-langs.el
@@ -1248,6 +1248,22 @@ operators."
(c-lang-defvar c-assignment-op-regexp
(c-lang-const c-assignment-op-regexp))
+(c-lang-defconst c-arithmetic-operators
+ "List of all arithmetic operators, including \"+=\", etc."
+ ;; Note: in the following, there are too many operators for AWK and IDL.
+ t (append (c-lang-const c-assignment-operators)
+ '("+" "-" "*" "/" "%"
+ "<<" ">>"
+ "<" ">" "<=" ">="
+ "==" "!="
+ "&" "^" "|"
+ "&&" "||")))
+
+(c-lang-defconst c-arithmetic-op-regexp
+ t (c-make-keywords-re nil
+ (c-lang-const c-arithmetic-operators)))
+(c-lang-defvar c-arithmetic-op-regexp (c-lang-const c-arithmetic-op-regexp))
+
(c-lang-defconst c-:$-multichar-token-regexp
;; Regexp matching all tokens ending in ":" which are longer than one char.
;; Currently (2016-01-07) only used in C++ Mode.