unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] support a few of the new features of C++11 in syntax highlighting
@ 2014-01-25 12:51 Paul Pogonyshev
  2014-01-25 19:58 ` Glenn Morris
  2014-05-11  6:48 ` Václav Zeman
  0 siblings, 2 replies; 45+ messages in thread
From: Paul Pogonyshev @ 2014-01-25 12:51 UTC (permalink / raw)
  To: emacs-devel


[-- Attachment #1.1: Type: text/plain, Size: 690 bytes --]

This patch adds support for a few of new C++11 features. I added only the
ones easy to implement (basically, just adding keywords to lists), since
I'm not familiar with the way cc-mode works. Hope this patch is not
controversial. I submitted required legal papers years ago, you can find a
few my patches in ChangeLog.

Paul


2014-01-25  Paul Pogonyshev  <pogonyshev@gmail.com>

    * progmodes/cc-langs.el: Support some of the new keywords in
    C++11.
    (c-operators): Handle `alignof' and `decltype'.
    (c-primitive-type-kwds): Add `char16_t' and `char32_t' primitive
    types.
    (c-type-modifier-kwds): Add `constexpr' and `thread_local'.
    (c-constant-kwds): Add `nullptr'.

[-- Attachment #1.2: Type: text/html, Size: 877 bytes --]

[-- Attachment #2: c++11.diff --]
[-- Type: text/plain, Size: 1987 bytes --]

diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el
index 29dff4a..cadbe2f 100644
--- a/lisp/progmodes/cc-langs.el
+++ b/lisp/progmodes/cc-langs.el
@@ -973,7 +973,7 @@ since CC Mode treats every identifier as an expression."
 
       ;; Unary.
       (prefix "++" "--" "+" "-" "!" "~"
-	      ,@(when (c-major-mode-is 'c++-mode) '("not" "compl"))
+	      ,@(when (c-major-mode-is 'c++-mode) '("not" "compl" "alignof" "decltype"))
 	      ,@(when (c-major-mode-is '(c-mode c++-mode))
 		  '("*" "&" "sizeof" "??-"))
 	      ,@(when (c-major-mode-is 'objc-mode)
@@ -1606,7 +1606,7 @@ the appropriate place for that."
 	'("_Bool" "_Complex" "_Imaginary") ; Conditionally defined in C99.
 	(c-lang-const c-primitive-type-kwds))
   c++  (append
-	'("bool" "wchar_t")
+	'("bool" "wchar_t" "char16_t" "char32_t")
 	(c-lang-const c-primitive-type-kwds))
   ;; Objective-C extends C, but probably not the new stuff in C99.
   objc (append
@@ -1676,7 +1676,7 @@ but they don't build a type of themselves.  Unlike the keywords on
 not the type face."
   t    nil
   c    '("const" "restrict" "volatile")
-  c++  '("const" "volatile" "throw")
+  c++  '("const" "constexpr" "volatile" "throw" "thread_local")
   objc '("const" "volatile"))
 
 (c-lang-defconst c-opt-type-modifier-key
@@ -2308,8 +2308,12 @@ This construct is \"<keyword> <expression> :\"."
 (c-lang-defconst c-constant-kwds
   "Keywords for constants."
   t       nil
-  (c c++) '("NULL" ;; Not a keyword, but practically works as one.
+  c       '("NULL" ;; Not a keyword, but practically works as one.
 	    "false" "true")		; Defined in C99.
+  c++     '("NULL" ;; Not a keyword, but practically works as one. Kept for
+                   ;; older code that doesn't use C++11's nullptr.
+	    "false" "true"
+            "nullptr")
   objc    '("nil" "Nil" "YES" "NO" "NS_DURING" "NS_HANDLER" "NS_ENDHANDLER")
   idl     '("TRUE" "FALSE")
   java    '("true" "false" "null") ; technically "literals", not keywords

[-- Attachment #3: changelog-entry --]
[-- Type: application/octet-stream, Size: 342 bytes --]

2014-01-25  Paul Pogonyshev  <pogonyshev@gmail.com>

	* progmodes/cc-langs.el: Support some of the new keywords in
	C++11.
	(c-operators): Handle `alignof' and `decltype'.
	(c-primitive-type-kwds): Add `char16_t' and `char32_t' primitive
	types.
	(c-type-modifier-kwds): Add `constexpr' and `thread_local'.
	(c-constant-kwds): Add `nullptr'.

^ permalink raw reply related	[flat|nested] 45+ messages in thread

end of thread, other threads:[~2014-11-18 18:33 UTC | newest]

Thread overview: 45+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-25 12:51 [PATCH] support a few of the new features of C++11 in syntax highlighting Paul Pogonyshev
2014-01-25 19:58 ` Glenn Morris
2014-01-25 21:56   ` Stefan Monnier
2014-01-25 22:34     ` Daniel Colascione
2014-01-26  0:27       ` Glenn Morris
2014-01-26 12:29         ` Daniel Colascione
2014-01-26 15:21       ` Alan Mackenzie
2014-05-11  6:48 ` Václav Zeman
2014-05-11 16:00   ` Óscar Fuentes
2014-05-11 18:21     ` Glenn Morris
2014-05-11 20:19       ` Óscar Fuentes
2014-05-11 22:09         ` Alan Mackenzie
2014-05-11 22:38           ` Óscar Fuentes
2014-05-14 20:13             ` Alan Mackenzie
2014-05-14 21:20               ` Óscar Fuentes
2014-05-15  1:52               ` Stefan Monnier
2014-05-16 16:07                 ` Alan Mackenzie
2014-05-16 17:59                   ` Eli Zaretskii
2014-05-17  8:31                     ` Alan Mackenzie
2014-05-17  9:24                       ` Eli Zaretskii
2014-05-17 12:39                         ` Michael Albinus
2014-05-17 14:14                           ` Stefan Monnier
2014-05-17 14:24                             ` Michael Albinus
2014-05-17 15:10                               ` Stefan Monnier
2014-05-17 13:27                         ` Óscar Fuentes
2014-05-17 14:06                           ` Eli Zaretskii
2014-05-16 23:42                   ` Stefan Monnier
2014-05-17  4:17                     ` Richard Stallman
2014-05-17  9:03                       ` Alan Mackenzie
2014-05-17 15:45                         ` Richard Stallman
2014-05-19 15:46                         ` Barry Warsaw
2014-05-17  8:42                     ` Alan Mackenzie
2014-05-17 14:09                       ` Stefan Monnier
2014-11-16 17:36           ` Rüdiger Sonderfeld
2014-11-16 18:07             ` Óscar Fuentes
2014-11-18  2:41               ` Rüdiger Sonderfeld
2014-11-18  3:30                 ` Óscar Fuentes
2014-11-18 12:48                   ` Daniel Colascione
2014-11-18 14:47                     ` Óscar Fuentes
2014-11-18 16:36                       ` Rüdiger Sonderfeld
2014-11-18 17:13                         ` Daniel Colascione
2014-11-18 18:01                           ` Óscar Fuentes
2014-11-18 18:11                             ` Daniel Colascione
2014-11-18 18:33                               ` Óscar Fuentes
2014-11-18 12:49                 ` Daniel Colascione

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).