diff options
| author | Carl Lei | 2020-05-24 11:52:24 +0000 |
|---|---|---|
| committer | Alan Mackenzie | 2020-05-24 11:52:24 +0000 |
| commit | ced29038dfbab47428b974dff1408f331f36c8f1 (patch) | |
| tree | 46341f8320b84bb426610e596060f20e330d5c1f | |
| parent | e021c2dc2279e0fd3a5331f9ea661e4d39c2e840 (diff) | |
| download | emacs-ced29038dfbab47428b974dff1408f331f36c8f1.tar.gz emacs-ced29038dfbab47428b974dff1408f331f36c8f1.zip | |
Add three C++20 coroutine keywords, co_await, co_yield, and co_return
* lisp/progmodes/cc-langs.el (c-operators): Add co_await and co_yield to the
C++ value of "Exception" keywords.
(c-return-kwds): Create a C++ value containing co_return.
(c-simple-stmt-kwds): Add co_return to the C++ value.
Copyright-paperwork-exempt: yes.
| -rw-r--r-- | lisp/progmodes/cc-langs.el | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el index 17ffea59ff0..2369cb03428 100644 --- a/lisp/progmodes/cc-langs.el +++ b/lisp/progmodes/cc-langs.el | |||
| @@ -1174,7 +1174,7 @@ since CC Mode treats every identifier as an expression." | |||
| 1174 | 1174 | ||
| 1175 | ;; Exception. | 1175 | ;; Exception. |
| 1176 | ,@(when (c-major-mode-is 'c++-mode) | 1176 | ,@(when (c-major-mode-is 'c++-mode) |
| 1177 | '((prefix "throw"))) | 1177 | '((prefix "throw" "co_await" "co_yield"))) |
| 1178 | 1178 | ||
| 1179 | ;; Sequence. | 1179 | ;; Sequence. |
| 1180 | (left-assoc ",")) | 1180 | (left-assoc ",")) |
| @@ -2040,6 +2040,7 @@ the appropriate place for that." | |||
| 2040 | (c-lang-defconst c-return-kwds | 2040 | (c-lang-defconst c-return-kwds |
| 2041 | "Keywords which return a value to the calling function." | 2041 | "Keywords which return a value to the calling function." |
| 2042 | t '("return") | 2042 | t '("return") |
| 2043 | c++ '("return" "co_return") | ||
| 2043 | idl nil) | 2044 | idl nil) |
| 2044 | 2045 | ||
| 2045 | (c-lang-defconst c-return-key | 2046 | (c-lang-defconst c-return-key |
| @@ -2822,6 +2823,7 @@ Keywords here should also be in `c-block-stmt-1-kwds'." | |||
| 2822 | (c-lang-defconst c-simple-stmt-kwds | 2823 | (c-lang-defconst c-simple-stmt-kwds |
| 2823 | "Statement keywords followed by an expression or nothing." | 2824 | "Statement keywords followed by an expression or nothing." |
| 2824 | t '("break" "continue" "goto" "return") | 2825 | t '("break" "continue" "goto" "return") |
| 2826 | c++ '("break" "continue" "goto" "return" "co_return") | ||
| 2825 | objc '("break" "continue" "goto" "return" "@throw") | 2827 | objc '("break" "continue" "goto" "return" "@throw") |
| 2826 | ;; Note: `goto' is not valid in Java, but the keyword is still reserved. | 2828 | ;; Note: `goto' is not valid in Java, but the keyword is still reserved. |
| 2827 | java '("break" "continue" "goto" "return" "throw") | 2829 | java '("break" "continue" "goto" "return" "throw") |