diff options
| author | Alan Mackenzie | 2014-08-24 20:50:11 +0000 |
|---|---|---|
| committer | Alan Mackenzie | 2014-08-24 20:50:11 +0000 |
| commit | 4031fb7bac75dabf6c801721ef044a1d71fe6596 (patch) | |
| tree | 3ca6c1f8d68f9fc223f962449be71c820d5dff8b | |
| parent | 66bb9533fc77963c495de7f33ec6dc8e4d342a55 (diff) | |
| download | emacs-4031fb7bac75dabf6c801721ef044a1d71fe6596.tar.gz emacs-4031fb7bac75dabf6c801721ef044a1d71fe6596.zip | |
Handle C++11's "auto" and "decltype" constructions.
cc-engine.el (c-forward-type): Enhance to recognise and return 'decltype.
(c-forward-decl-or-cast-1): New let variables backup-kwd-sym,
prev-kwd-sym, new-style-auto. Enhance to handle the new "auto" keyword.
cc-fonts.el (c-font-lock-declarations): Handle the "decltype" keyword.
(c-font-lock-c++-new): Handle "decltype" constructions.
cc-langs.el (c-auto-ops, c-auto-ops-re): New c-lang-defconsts/defvars.
(c-haskell-op, c-haskell-op-re): New c-lang-defconsts/defvars.
(c-typeof-kwds, c-typeof-key): New c-lang-defconsts/defvars.
(c-typeless-decl-kwds): Append "auto" onto the C++ value.
(c-not-decl-init-keywords): Also exclude c-typeof-kwds from value.
| -rw-r--r-- | lisp/ChangeLog | 16 | ||||
| -rw-r--r-- | lisp/progmodes/cc-engine.el | 69 | ||||
| -rw-r--r-- | lisp/progmodes/cc-fonts.el | 12 | ||||
| -rw-r--r-- | lisp/progmodes/cc-langs.el | 36 |
4 files changed, 118 insertions, 15 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 5b1c0b1b386..0b347f5a63a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,21 @@ | |||
| 1 | 2014-08-24 Alan Mackenzie <acm@muc.de> | 1 | 2014-08-24 Alan Mackenzie <acm@muc.de> |
| 2 | 2 | ||
| 3 | Handle C++11's "auto" and "decltype" constructions. | ||
| 4 | * progmodes/cc-engine.el (c-forward-type): Enhance to recognise | ||
| 5 | and return 'decltype. | ||
| 6 | (c-forward-decl-or-cast-1): New let variables backup-kwd-sym, | ||
| 7 | prev-kwd-sym, new-style-auto. Enhance to handle the new "auto" | ||
| 8 | keyword. | ||
| 9 | * progmodes/cc-fonts.el (c-font-lock-declarations): Handle the | ||
| 10 | "decltype" keyword. | ||
| 11 | (c-font-lock-c++-new): Handle "decltype" constructions. | ||
| 12 | * progmodes/cc-langs.el (c-auto-ops, c-auto-ops-re): New | ||
| 13 | c-lang-defconsts/defvars. | ||
| 14 | (c-haskell-op, c-haskell-op-re): New c-lang-defconsts/defvars. | ||
| 15 | (c-typeof-kwds, c-typeof-key): New c-lang-defconsts/defvars. | ||
| 16 | (c-typeless-decl-kwds): Append "auto" onto the C++ value. | ||
| 17 | (c-not-decl-init-keywords): Also exclude c-typeof-kwds from value. | ||
| 18 | |||
| 3 | Make ">>" act as double template ender in C++ Mode. | 19 | Make ">>" act as double template ender in C++ Mode. |
| 4 | * progmodes/cc-langs.el (c->-op-cont-tokens): New lang-const split | 20 | * progmodes/cc-langs.el (c->-op-cont-tokens): New lang-const split |
| 5 | off from c->-op-cont-re. | 21 | off from c->-op-cont-re. |
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 8283bb38eae..9eb95f69c48 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el | |||
| @@ -6286,7 +6286,8 @@ comment at the start of cc-engine.el for more info." | |||
| 6286 | ;; `*-font-lock-extra-types'); | 6286 | ;; `*-font-lock-extra-types'); |
| 6287 | ;; o - 'prefix if it's a known prefix of a type; | 6287 | ;; o - 'prefix if it's a known prefix of a type; |
| 6288 | ;; o - 'found if it's a type that matches one in `c-found-types'; | 6288 | ;; o - 'found if it's a type that matches one in `c-found-types'; |
| 6289 | ;; o - 'maybe if it's an identifier that might be a type; or | 6289 | ;; o - 'maybe if it's an identfier that might be a type; |
| 6290 | ;; o - 'decltype if it's a decltype(variable) declaration; - or | ||
| 6290 | ;; o - nil if it can't be a type (the point isn't moved then). | 6291 | ;; o - nil if it can't be a type (the point isn't moved then). |
| 6291 | ;; | 6292 | ;; |
| 6292 | ;; The point is assumed to be at the beginning of a token. | 6293 | ;; The point is assumed to be at the beginning of a token. |
| @@ -6316,6 +6317,16 @@ comment at the start of cc-engine.el for more info." | |||
| 6316 | (setq res 'prefix))) | 6317 | (setq res 'prefix))) |
| 6317 | 6318 | ||
| 6318 | (cond | 6319 | (cond |
| 6320 | ((looking-at c-typeof-key) ; e.g. C++'s "decltype". | ||
| 6321 | (goto-char (match-end 1)) | ||
| 6322 | (c-forward-syntactic-ws) | ||
| 6323 | (setq res (and (eq (char-after) ?\() | ||
| 6324 | (c-safe (c-forward-sexp)) | ||
| 6325 | 'decltype)) | ||
| 6326 | (if res | ||
| 6327 | (c-forward-syntactic-ws) | ||
| 6328 | (goto-char start))) | ||
| 6329 | |||
| 6319 | ((looking-at c-type-prefix-key) ; e.g. "struct", "class", but NOT | 6330 | ((looking-at c-type-prefix-key) ; e.g. "struct", "class", but NOT |
| 6320 | ; "typedef". | 6331 | ; "typedef". |
| 6321 | (goto-char (match-end 1)) | 6332 | (goto-char (match-end 1)) |
| @@ -6442,7 +6453,7 @@ comment at the start of cc-engine.el for more info." | |||
| 6442 | ;; of these alter the classification of the found type, since | 6453 | ;; of these alter the classification of the found type, since |
| 6443 | ;; these operators typically are allowed in normal expressions | 6454 | ;; these operators typically are allowed in normal expressions |
| 6444 | ;; too. | 6455 | ;; too. |
| 6445 | (when c-opt-type-suffix-key | 6456 | (when c-opt-type-suffix-key ; e.g. "..." |
| 6446 | (while (looking-at c-opt-type-suffix-key) | 6457 | (while (looking-at c-opt-type-suffix-key) |
| 6447 | (goto-char (match-end 1)) | 6458 | (goto-char (match-end 1)) |
| 6448 | (c-forward-syntactic-ws))) | 6459 | (c-forward-syntactic-ws))) |
| @@ -6654,6 +6665,13 @@ comment at the start of cc-engine.el for more info." | |||
| 6654 | ;; Foo::Foo (int b) : Base (b) {} | 6665 | ;; Foo::Foo (int b) : Base (b) {} |
| 6655 | ;; car ^ ^ point | 6666 | ;; car ^ ^ point |
| 6656 | ;; | 6667 | ;; |
| 6668 | ;; auto foo = 5; | ||
| 6669 | ;; car ^ ^ point | ||
| 6670 | ;; auto cplusplus_11 (int a, char *b) -> decltype (bar): | ||
| 6671 | ;; car ^ ^ point | ||
| 6672 | ;; | ||
| 6673 | ;; | ||
| 6674 | ;; | ||
| 6657 | ;; The cdr of the return value is non-nil when a | 6675 | ;; The cdr of the return value is non-nil when a |
| 6658 | ;; `c-typedef-decl-kwds' specifier is found in the declaration. | 6676 | ;; `c-typedef-decl-kwds' specifier is found in the declaration. |
| 6659 | ;; Specifically it is a dotted pair (A . B) where B is t when a | 6677 | ;; Specifically it is a dotted pair (A . B) where B is t when a |
| @@ -6719,6 +6737,10 @@ comment at the start of cc-engine.el for more info." | |||
| 6719 | ;; If `backup-at-type' is nil then the other variables have | 6737 | ;; If `backup-at-type' is nil then the other variables have |
| 6720 | ;; undefined values. | 6738 | ;; undefined values. |
| 6721 | backup-at-type backup-type-start backup-id-start | 6739 | backup-at-type backup-type-start backup-id-start |
| 6740 | ;; This stores `kwd-sym' of the symbol before the current one. | ||
| 6741 | ;; This is needed to distinguish the C++11 version of "auto" from | ||
| 6742 | ;; the pre C++11 meaning. | ||
| 6743 | backup-kwd-sym | ||
| 6722 | ;; Set if we've found a specifier (apart from "typedef") that makes | 6744 | ;; Set if we've found a specifier (apart from "typedef") that makes |
| 6723 | ;; the defined identifier(s) types. | 6745 | ;; the defined identifier(s) types. |
| 6724 | at-type-decl | 6746 | at-type-decl |
| @@ -6727,6 +6749,10 @@ comment at the start of cc-engine.el for more info." | |||
| 6727 | ;; Set if we've found a specifier that can start a declaration | 6749 | ;; Set if we've found a specifier that can start a declaration |
| 6728 | ;; where there's no type. | 6750 | ;; where there's no type. |
| 6729 | maybe-typeless | 6751 | maybe-typeless |
| 6752 | ;; Save the value of kwd-sym between loops of the "Check for a | ||
| 6753 | ;; type" loop. Needed to distinguish a C++11 "auto" from a pre | ||
| 6754 | ;; C++11 one. | ||
| 6755 | prev-kwd-sym | ||
| 6730 | ;; If a specifier is found that also can be a type prefix, | 6756 | ;; If a specifier is found that also can be a type prefix, |
| 6731 | ;; these flags are set instead of those above. If we need to | 6757 | ;; these flags are set instead of those above. If we need to |
| 6732 | ;; back up an identifier, they are copied to the real flag | 6758 | ;; back up an identifier, they are copied to the real flag |
| @@ -6744,6 +6770,8 @@ comment at the start of cc-engine.el for more info." | |||
| 6744 | backup-if-not-cast | 6770 | backup-if-not-cast |
| 6745 | ;; For casts, the return position. | 6771 | ;; For casts, the return position. |
| 6746 | cast-end | 6772 | cast-end |
| 6773 | ;; Have we got a new-style C++11 "auto"? | ||
| 6774 | new-style-auto | ||
| 6747 | ;; Save `c-record-type-identifiers' and | 6775 | ;; Save `c-record-type-identifiers' and |
| 6748 | ;; `c-record-ref-identifiers' since ranges are recorded | 6776 | ;; `c-record-ref-identifiers' since ranges are recorded |
| 6749 | ;; speculatively and should be thrown away if it turns out | 6777 | ;; speculatively and should be thrown away if it turns out |
| @@ -6762,11 +6790,12 @@ comment at the start of cc-engine.el for more info." | |||
| 6762 | (let* ((start (point)) kwd-sym kwd-clause-end found-type) | 6790 | (let* ((start (point)) kwd-sym kwd-clause-end found-type) |
| 6763 | 6791 | ||
| 6764 | ;; Look for a specifier keyword clause. | 6792 | ;; Look for a specifier keyword clause. |
| 6765 | (when (or (looking-at c-prefix-spec-kwds-re) | 6793 | (when (or (looking-at c-prefix-spec-kwds-re) ;FIXME!!! includes auto |
| 6766 | (and (c-major-mode-is 'java-mode) | 6794 | (and (c-major-mode-is 'java-mode) |
| 6767 | (looking-at "@[A-Za-z0-9]+"))) | 6795 | (looking-at "@[A-Za-z0-9]+"))) |
| 6768 | (if (looking-at c-typedef-key) | 6796 | (save-match-data |
| 6769 | (setq at-typedef t)) | 6797 | (if (looking-at c-typedef-key) |
| 6798 | (setq at-typedef t))) | ||
| 6770 | (setq kwd-sym (c-keyword-sym (match-string 1))) | 6799 | (setq kwd-sym (c-keyword-sym (match-string 1))) |
| 6771 | (save-excursion | 6800 | (save-excursion |
| 6772 | (c-forward-keyword-clause 1) | 6801 | (c-forward-keyword-clause 1) |
| @@ -6774,6 +6803,12 @@ comment at the start of cc-engine.el for more info." | |||
| 6774 | 6803 | ||
| 6775 | (when (setq found-type (c-forward-type t)) ; brace-block-too | 6804 | (when (setq found-type (c-forward-type t)) ; brace-block-too |
| 6776 | ;; Found a known or possible type or a prefix of a known type. | 6805 | ;; Found a known or possible type or a prefix of a known type. |
| 6806 | (when (and (c-major-mode-is 'c++-mode) ; C++11 style "auto"? | ||
| 6807 | (eq prev-kwd-sym (c-keyword-sym "auto")) | ||
| 6808 | (looking-at "[=(]")) ; FIXME!!! proper regexp. | ||
| 6809 | (setq new-style-auto t) | ||
| 6810 | (setq found-type nil) | ||
| 6811 | (goto-char start)) ; position of foo in "auto foo" | ||
| 6777 | 6812 | ||
| 6778 | (when at-type | 6813 | (when at-type |
| 6779 | ;; Got two identifiers with nothing but whitespace | 6814 | ;; Got two identifiers with nothing but whitespace |
| @@ -6792,6 +6827,7 @@ comment at the start of cc-engine.el for more info." | |||
| 6792 | (setq backup-at-type at-type | 6827 | (setq backup-at-type at-type |
| 6793 | backup-type-start type-start | 6828 | backup-type-start type-start |
| 6794 | backup-id-start id-start | 6829 | backup-id-start id-start |
| 6830 | backup-kwd-sym kwd-sym | ||
| 6795 | at-type found-type | 6831 | at-type found-type |
| 6796 | type-start start | 6832 | type-start start |
| 6797 | id-start (point) | 6833 | id-start (point) |
| @@ -6847,6 +6883,7 @@ comment at the start of cc-engine.el for more info." | |||
| 6847 | ;; specifier keyword and we know we're in a | 6883 | ;; specifier keyword and we know we're in a |
| 6848 | ;; declaration. | 6884 | ;; declaration. |
| 6849 | (setq at-decl-or-cast t) | 6885 | (setq at-decl-or-cast t) |
| 6886 | (setq prev-kwd-sym kwd-sym) | ||
| 6850 | 6887 | ||
| 6851 | (goto-char kwd-clause-end)))) | 6888 | (goto-char kwd-clause-end)))) |
| 6852 | 6889 | ||
| @@ -7038,15 +7075,26 @@ comment at the start of cc-engine.el for more info." | |||
| 7038 | 7075 | ||
| 7039 | (c-forward-syntactic-ws)) | 7076 | (c-forward-syntactic-ws)) |
| 7040 | 7077 | ||
| 7041 | (when (and (or maybe-typeless backup-maybe-typeless) | 7078 | (when (or (and new-style-auto |
| 7042 | (not got-identifier) | 7079 | (looking-at c-auto-ops-re)) |
| 7043 | (not got-prefix) | 7080 | (and (or maybe-typeless backup-maybe-typeless) |
| 7044 | at-type) | 7081 | (not got-identifier) |
| 7082 | (not got-prefix) | ||
| 7083 | at-type)) | ||
| 7045 | ;; Have found no identifier but `c-typeless-decl-kwds' has | 7084 | ;; Have found no identifier but `c-typeless-decl-kwds' has |
| 7046 | ;; matched so we know we're inside a declaration. The | 7085 | ;; matched so we know we're inside a declaration. The |
| 7047 | ;; preceding type must be the identifier instead. | 7086 | ;; preceding type must be the identifier instead. |
| 7048 | (c-fdoc-shift-type-backward)) | 7087 | (c-fdoc-shift-type-backward)) |
| 7049 | 7088 | ||
| 7089 | ;; Prepare the "-> type;" for fontification later on. | ||
| 7090 | (when (and new-style-auto | ||
| 7091 | (looking-at c-haskell-op-re)) | ||
| 7092 | (save-excursion | ||
| 7093 | (goto-char (match-end 0)) | ||
| 7094 | (c-forward-syntactic-ws) | ||
| 7095 | (setq type-start (point)) | ||
| 7096 | (setq at-type (c-forward-type)))) | ||
| 7097 | |||
| 7050 | (setq | 7098 | (setq |
| 7051 | at-decl-or-cast | 7099 | at-decl-or-cast |
| 7052 | (catch 'at-decl-or-cast | 7100 | (catch 'at-decl-or-cast |
| @@ -7371,6 +7419,7 @@ comment at the start of cc-engine.el for more info." | |||
| 7371 | ;; is a declaration. Now we're being more defensive and prefer to | 7419 | ;; is a declaration. Now we're being more defensive and prefer to |
| 7372 | ;; highlight things like "foo (bar);" as a declaration only if we're | 7420 | ;; highlight things like "foo (bar);" as a declaration only if we're |
| 7373 | ;; inside an arglist that contains declarations. | 7421 | ;; inside an arglist that contains declarations. |
| 7422 | ;; CASE 19 | ||
| 7374 | (eq context 'decl)))) | 7423 | (eq context 'decl)))) |
| 7375 | 7424 | ||
| 7376 | ;; The point is now after the type decl expression. | 7425 | ;; The point is now after the type decl expression. |
| @@ -7460,6 +7509,8 @@ comment at the start of cc-engine.el for more info." | |||
| 7460 | ;; interactive refontification. | 7509 | ;; interactive refontification. |
| 7461 | (c-put-c-type-property (point) 'c-decl-arg-start)) | 7510 | (c-put-c-type-property (point) 'c-decl-arg-start)) |
| 7462 | 7511 | ||
| 7512 | ;; Record the type's coordinates in `c-record-type-identifiers' for | ||
| 7513 | ;; later fontification. | ||
| 7463 | (when (and c-record-type-identifiers at-type ;; (not (eq at-type t)) | 7514 | (when (and c-record-type-identifiers at-type ;; (not (eq at-type t)) |
| 7464 | ;; There seems no reason to exclude a token from | 7515 | ;; There seems no reason to exclude a token from |
| 7465 | ;; fontification just because it's "a known type that can't | 7516 | ;; fontification just because it's "a known type that can't |
diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el index ceb86b45fb1..c056091ca46 100644 --- a/lisp/progmodes/cc-fonts.el +++ b/lisp/progmodes/cc-fonts.el | |||
| @@ -1306,14 +1306,15 @@ casts and declarations are fontified. Used on level 2 and higher." | |||
| 1306 | (cond ((not (memq (char-before match-pos) '(?\( ?, ?\[ ?<))) | 1306 | (cond ((not (memq (char-before match-pos) '(?\( ?, ?\[ ?<))) |
| 1307 | (setq context nil | 1307 | (setq context nil |
| 1308 | c-restricted-<>-arglists nil)) | 1308 | c-restricted-<>-arglists nil)) |
| 1309 | ;; A control flow expression | 1309 | ;; A control flow expression or a decltype |
| 1310 | ((and (eq (char-before match-pos) ?\() | 1310 | ((and (eq (char-before match-pos) ?\() |
| 1311 | (save-excursion | 1311 | (save-excursion |
| 1312 | (goto-char match-pos) | 1312 | (goto-char match-pos) |
| 1313 | (backward-char) | 1313 | (backward-char) |
| 1314 | (c-backward-token-2) | 1314 | (c-backward-token-2) |
| 1315 | (or (looking-at c-block-stmt-2-key) | 1315 | (or (looking-at c-block-stmt-2-key) |
| 1316 | (looking-at c-block-stmt-1-2-key)))) | 1316 | (looking-at c-block-stmt-1-2-key) |
| 1317 | (looking-at c-typeof-key)))) | ||
| 1317 | (setq context nil | 1318 | (setq context nil |
| 1318 | c-restricted-<>-arglists t)) | 1319 | c-restricted-<>-arglists t)) |
| 1319 | ;; Near BOB. | 1320 | ;; Near BOB. |
| @@ -1513,7 +1514,7 @@ casts and declarations are fontified. Used on level 2 and higher." | |||
| 1513 | (goto-char (match-end 0)) | 1514 | (goto-char (match-end 0)) |
| 1514 | (c-forward-syntactic-ws)) | 1515 | (c-forward-syntactic-ws)) |
| 1515 | ;; At a real declaration? | 1516 | ;; At a real declaration? |
| 1516 | (if (memq (c-forward-type t) '(t known found)) | 1517 | (if (memq (c-forward-type t) '(t known found decltype)) |
| 1517 | (progn | 1518 | (progn |
| 1518 | (c-font-lock-declarators limit t is-typedef) | 1519 | (c-font-lock-declarators limit t is-typedef) |
| 1519 | nil) | 1520 | nil) |
| @@ -2130,7 +2131,7 @@ need for `c-font-lock-extra-types'.") | |||
| 2130 | ;; Got two parenthesized expressions, so we have to look | 2131 | ;; Got two parenthesized expressions, so we have to look |
| 2131 | ;; closer at them to decide which is the type. No need to | 2132 | ;; closer at them to decide which is the type. No need to |
| 2132 | ;; handle `c-record-ref-identifiers' since all references | 2133 | ;; handle `c-record-ref-identifiers' since all references |
| 2133 | ;; has already been handled by other fontification rules. | 2134 | ;; have already been handled by other fontification rules. |
| 2134 | (let (expr1-res expr2-res) | 2135 | (let (expr1-res expr2-res) |
| 2135 | 2136 | ||
| 2136 | (goto-char expr1-pos) | 2137 | (goto-char expr1-pos) |
| @@ -2165,6 +2166,9 @@ need for `c-font-lock-extra-types'.") | |||
| 2165 | ;; unusual than an initializer. | 2166 | ;; unusual than an initializer. |
| 2166 | (cond ((memq expr1-res '(t known prefix))) | 2167 | (cond ((memq expr1-res '(t known prefix))) |
| 2167 | ((memq expr2-res '(t known prefix))) | 2168 | ((memq expr2-res '(t known prefix))) |
| 2169 | ;; Presumably 'decltype's will be fontified elsewhere. | ||
| 2170 | ((eq expr1-res 'decltype)) | ||
| 2171 | ((eq expr2-res 'decltype)) | ||
| 2168 | ((eq expr1-res 'found) | 2172 | ((eq expr1-res 'found) |
| 2169 | (let ((c-promote-possible-types t)) | 2173 | (let ((c-promote-possible-types t)) |
| 2170 | (goto-char expr1-pos) | 2174 | (goto-char expr1-pos) |
diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el index 2bf660a32eb..73b75dc671a 100644 --- a/lisp/progmodes/cc-langs.el +++ b/lisp/progmodes/cc-langs.el | |||
| @@ -940,10 +940,13 @@ Note that operators like \".\" and \"->\" which in language references | |||
| 940 | often are described as postfix operators are considered binary here, | 940 | often are described as postfix operators are considered binary here, |
| 941 | since CC Mode treats every identifier as an expression." | 941 | since CC Mode treats every identifier as an expression." |
| 942 | 942 | ||
| 943 | ;; There's currently no code in CC Mode that exploit all the info | 943 | ;; There's currently no code in CC Mode that exploits all the info |
| 944 | ;; in this variable; precedence, associativity etc are present as a | 944 | ;; in this variable; precedence, associativity etc are present as a |
| 945 | ;; preparation for future work. | 945 | ;; preparation for future work. |
| 946 | 946 | ||
| 947 | ;; FIXME!!! C++11's "auto" operators "=" and "->" need to go in here | ||
| 948 | ;; somewhere. 2012-03-24. | ||
| 949 | |||
| 947 | t `(;; Preprocessor. | 950 | t `(;; Preprocessor. |
| 948 | ,@(when (c-lang-const c-opt-cpp-prefix) | 951 | ,@(when (c-lang-const c-opt-cpp-prefix) |
| 949 | `((prefix "#" | 952 | `((prefix "#" |
| @@ -1266,6 +1269,21 @@ operators." | |||
| 1266 | (c-lang-defvar c-stmt-delim-chars-with-comma | 1269 | (c-lang-defvar c-stmt-delim-chars-with-comma |
| 1267 | (c-lang-const c-stmt-delim-chars-with-comma)) | 1270 | (c-lang-const c-stmt-delim-chars-with-comma)) |
| 1268 | 1271 | ||
| 1272 | (c-lang-defconst c-auto-ops | ||
| 1273 | ;; Ops which signal C++11's new auto uses. | ||
| 1274 | t nil | ||
| 1275 | c++ '("=" "->")) | ||
| 1276 | (c-lang-defconst c-auto-ops-re | ||
| 1277 | t (c-make-keywords-re nil (c-lang-const c-auto-ops))) | ||
| 1278 | (c-lang-defvar c-auto-ops-re (c-lang-const c-auto-ops-re)) | ||
| 1279 | |||
| 1280 | (c-lang-defconst c-haskell-op | ||
| 1281 | ;; Op used in the new C++11 auto function definition, indicating type. | ||
| 1282 | t nil | ||
| 1283 | c++ '("->")) | ||
| 1284 | (c-lang-defconst c-haskell-op-re | ||
| 1285 | t (c-make-keywords-re nil (c-lang-const c-haskell-op))) | ||
| 1286 | (c-lang-defvar c-haskell-op-re (c-lang-const c-haskell-op-re)) | ||
| 1269 | 1287 | ||
| 1270 | ;;; Syntactic whitespace. | 1288 | ;;; Syntactic whitespace. |
| 1271 | 1289 | ||
| @@ -1673,6 +1691,18 @@ of a variable declaration." | |||
| 1673 | t (c-make-keywords-re t (c-lang-const c-typedef-kwds))) | 1691 | t (c-make-keywords-re t (c-lang-const c-typedef-kwds))) |
| 1674 | (c-lang-defvar c-typedef-key (c-lang-const c-typedef-key)) | 1692 | (c-lang-defvar c-typedef-key (c-lang-const c-typedef-key)) |
| 1675 | 1693 | ||
| 1694 | (c-lang-defconst c-typeof-kwds | ||
| 1695 | "Keywords followed by a parenthesized expression, which stands for | ||
| 1696 | the type of that expression." | ||
| 1697 | t nil | ||
| 1698 | c '("typeof") ; longstanding GNU C(++) extension. | ||
| 1699 | c++ '("decltype" "typeof")) | ||
| 1700 | |||
| 1701 | (c-lang-defconst c-typeof-key | ||
| 1702 | ;; Adorned regexp matching `c-typeof-kwds'. | ||
| 1703 | t (c-make-keywords-re t (c-lang-const c-typeof-kwds))) | ||
| 1704 | (c-lang-defvar c-typeof-key (c-lang-const c-typeof-key)) | ||
| 1705 | |||
| 1676 | (c-lang-defconst c-type-prefix-kwds | 1706 | (c-lang-defconst c-type-prefix-kwds |
| 1677 | "Keywords where the following name - if any - is a type name, and | 1707 | "Keywords where the following name - if any - is a type name, and |
| 1678 | where the keyword together with the symbol works as a type in | 1708 | where the keyword together with the symbol works as a type in |
| @@ -1856,6 +1886,7 @@ will be handled." | |||
| 1856 | ;; {...}"). | 1886 | ;; {...}"). |
| 1857 | t (append (c-lang-const c-class-decl-kwds) | 1887 | t (append (c-lang-const c-class-decl-kwds) |
| 1858 | (c-lang-const c-brace-list-decl-kwds)) | 1888 | (c-lang-const c-brace-list-decl-kwds)) |
| 1889 | c++ (append (c-lang-const c-typeless-decl-kwds) '("auto")) ; C++11. | ||
| 1859 | ;; Note: "manages" for CORBA CIDL clashes with its presence on | 1890 | ;; Note: "manages" for CORBA CIDL clashes with its presence on |
| 1860 | ;; `c-type-list-kwds' for IDL. | 1891 | ;; `c-type-list-kwds' for IDL. |
| 1861 | idl (append (c-lang-const c-typeless-decl-kwds) | 1892 | idl (append (c-lang-const c-typeless-decl-kwds) |
| @@ -2005,7 +2036,8 @@ one of `c-type-list-kwds', `c-ref-list-kwds', | |||
| 2005 | t (c-make-keywords-re t | 2036 | t (c-make-keywords-re t |
| 2006 | (set-difference (c-lang-const c-keywords) | 2037 | (set-difference (c-lang-const c-keywords) |
| 2007 | (append (c-lang-const c-type-start-kwds) | 2038 | (append (c-lang-const c-type-start-kwds) |
| 2008 | (c-lang-const c-prefix-spec-kwds)) | 2039 | (c-lang-const c-prefix-spec-kwds) |
| 2040 | (c-lang-const c-typeof-kwds)) | ||
| 2009 | :test 'string-equal))) | 2041 | :test 'string-equal))) |
| 2010 | (c-lang-defvar c-not-decl-init-keywords | 2042 | (c-lang-defvar c-not-decl-init-keywords |
| 2011 | (c-lang-const c-not-decl-init-keywords)) | 2043 | (c-lang-const c-not-decl-init-keywords)) |