From bdba7c0303b3fac76721ad9980b347ce596a1923 Mon Sep 17 00:00:00 2001 From: Liu Hao Date: Thu, 15 Jun 2017 16:50:58 +0800 Subject: [PATCH 1/6] Added highlighting of C++11 keywords and special identifiers. --- syntax/c.nanorc | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/syntax/c.nanorc b/syntax/c.nanorc index 1b782844..d1e1979e 100644 --- a/syntax/c.nanorc +++ b/syntax/c.nanorc @@ -9,25 +9,29 @@ color brightred "\<[A-Z_][0-9A-Z_]+\>" # Labels. color brightmagenta "^[[:space:]]*[A-Z_a-z]+:[[:space:]]*$" -color green "\<(float|double|bool|char|int|short|long|sizeof|enum|void|auto|static|const|struct|union|typedef|extern|(un)?signed|inline)\>" -color green "\<((s?size)|((u_?)?int(8|16|32|64|ptr)))_t\>" -color green "\<(class|namespace|template|public|protected|private|typename|this|friend|virtual|override|using|mutable|volatile|register|explicit)\>" +color green "\<(float|double|bool|true|false|char|int|short|long|sizeof|align(as|of)|decltype|typeid|enum|void|auto|static|const|struct|union|typedef|extern|(un)?signed|inline|constexpr|thread_local|restrict|_Complex|_Bool|_Imaginary|_Atomic|_Thread_local|_Noreturn|_Align(as|of))\>" +color green "\<((s?size)|ptrdiff|((u_?)?int(8|16|32|64|ptr|max))|wchar|char(16|32))_t\>" +color green "\<(class|namespace|template|public|protected|private|typename|this|nullptr|friend|virtual|override|final|noexcept|using|mutable|volatile|register|explicit|export)\>" color brightyellow "\<(for|if|while|do|else|case|default|switch)\>" -color brightyellow "\<(try|throw|catch|operator|new|delete)\>" +color brightyellow "\<(try|throw|catch|operator|new|delete|(static|dynamic|const|reinterpret)_cast|static_assert|_Static_assert)\>" color magenta "\<(goto|continue|break|return)\>" -color brightcyan "^[[:space:]]*#[[:space:]]*(define|include(_next)?|(un|ifn?)def|endif|el(if|se)|if|warning|error|pragma)" color brightmagenta "'([^'\]|(\\["'abfnrtv\\]))'" "'\\(([0-3]?[0-7]{1,2}))'" "'\\x[0-9A-Fa-f]{1,2}'" +color brightgreen "\<(_Pragma|__has_include|_Generic)\>" # GCC builtins. color cyan "__attribute__[[:space:]]*\(\([^)]*\)\)" "__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__" # Strings. In general you will want your strings and comments to come last, # because highlighting rules are applied in the order they are read in. -color brightyellow ""([^"]|\\")*"" "<[^[:blank:]=]*>" +color brightyellow ""([^"]|\\")*"" # Multiline strings. This regex is VERY resource intensive, # and sometimes colours things that shouldn't be coloured. ###color brightyellow start=""(\\.|[^"])*\\[[:space:]]*$" end="^(\\.|[^"])*"" +# Preprocessor directives. +color brightcyan "^[[:space:]]*#[[:space:]]*((define|include(_next)?|(un|ifn?)def|endif|el(if|se)|if|warning|error|pragma)([[:space:]]+(.*[^\\])?)?)?$" +color brightcyan start="^[[:space:]]*#[[:space:]]*(define|include(_next)?|(un|ifn?)def|endif|el(if|se)|if|warning|error|pragma)([[:space:]]+.*)?\\$" end="^(.*[^\\])?$" + # Comments. color brightblue "//.*" color brightblue start="/\*" end="\*/" -- 2.15.0