Tough_Crowd/data/usr/share/diffuse/syntax/c++.syntax

81 lines
3.9 KiB
YAML

# C++ syntax file for Diffuse
# Copyright (C) 2008-2013 Derrick Moser <derrick_moser@yahoo.com>
syntax C++ normal text
syntax_files C++ '\.(h|c|C|cc|cxx|c\+\+|cpp)$'
# colours
colour c++_comment 0.2 0.4 0.64
colour c++_fixme 1.0 0.5 0.0
colour c++_keyword 0.77 0.63 0.0
colour c++_type 0.3 0.6 0.02
colour c++_cpp 0.8 0.0 0.0
colour c++_cppkeyword 0.46 0.31 0.48
colour c++_literal 1.0 0.2 0.8
colour c++_string 0.8 0.0 0.0
colour c++_escapedchar 0.46 0.31 0.48
colour c++_punctuation 0.5 0.5 0.5
# preprocessor
syntax_pattern normal cpp c++_cppkeyword '^[ \t]*#[ \t]*(define|elif|else|endif|error|if|ifdef|ifndef|include|line|pragma|undef|warning)\b'
syntax_pattern cpp normal c++_cppkeyword '(\r\n|\r|\n)$'
# whitespace
syntax_pattern normal normal text '[ \t\r\n]+'
# C++ style comments
syntax_pattern normal cpp_comment c++_comment '//'
syntax_pattern cpp cpp_comment c++_comment '//'
syntax_pattern cpp_comment normal c++_comment '(\r\n|\r|\n)$'
syntax_pattern cpp_comment cpp_comment c++_comment '\\(\r\n|\r|\n)$'
syntax_pattern cpp_comment cpp_comment c++_fixme '\b(TODO|FIXME|XXX)\b'
syntax_pattern cpp_comment cpp_comment c++_comment '.[^\\TFX\r\n]*'
# C style comments
syntax_pattern normal comment c++_comment '/\*'
syntax_pattern comment normal c++_comment '\*/'
syntax_pattern comment comment c++_fixme '\b(TODO|FIXME|XXX)\b'
syntax_pattern comment comment c++_comment '.[^\*TFX]*'
syntax_pattern cpp comment_cpp c++_comment '/\*'
syntax_pattern comment_cpp cpp c++_comment '\*/'
syntax_pattern comment_cpp comment_cpp c++_fixme '\b(TODO|FIXME|XXX)\b'
syntax_pattern comment_cpp comment_cpp c++_comment '.[^\*TFX]*'
# preprocessor args
syntax_pattern cpp cpp c++_cpp '\\(\r\n|\r|\n)$'
syntax_pattern cpp cpp c++_cpp '.[^\\/\r\n]*'
# char
syntax_pattern normal char c++_string "[uUL]?'"
syntax_pattern char normal c++_string "['\\n]"
syntax_pattern char char c++_escapedchar '(\\([0-7]{1,3}|x[0-9a-fA-F]{1,2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8}|.|\n))+'
syntax_pattern char char c++_string ".[^\\\\\\n']*"
# string
syntax_pattern normal string c++_string '(u|u8|U|L)?"'
syntax_pattern string normal c++_string '["\n]'
syntax_pattern string string c++_escapedchar '(\\([0-7]{1,3}|x[0-9a-fA-F]{1,2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8}|.|\n))+'
syntax_pattern string string c++_string '.[^\\\n"]*'
# raw string
syntax_pattern normal raw_string c++_string '(u|u8|U|L)?R"[^\(]*\('
syntax_pattern raw_string normal c++_string '\)[^\)]*"'
syntax_pattern raw_string raw_string c++_string '.[^\)]*'
# literals
syntax_pattern normal normal c++_literal '((([0-9]+\.[0-9]*|\.[0-9]+)([ep][\+\-]?[0-9]+)?|[0-9]+[ep][\+\-]?[0-9]+)[fl]?|(0|[1-9][0-9]*)f|(0x[0-9a-f]+|0[0-7]*|[1-9][0-9]*)(ul?|lu?)?)' ignorecase
syntax_pattern normal normal c++_literal '\b(true|false|M_E|M_LOG2E|M_LOG10E|M_LN2|M_LN10|M_PI|M_PI_2|M_PI_4|M_1_PI|M_2_PI|M_2_SQRTPI|M_SQRT2|M_SQRT1_2|NULL|nullptr)\b'
# typing keywords
syntax_pattern normal normal c++_type '\b(_Alignas|_Atomic|_Bool|_Complex|_Imaginary|_Noreturn|_Thread_local|alignas|auto|bool|char|char16_t|char32_t|class|const|constexpr|double|enum|explicit|export|extern|final|float|inline|int|long|mutable|namespace|noreturn|override|register|restrict|short|signed|static|struct|template|thread_local|typedef|typename|union|unsigned|virtual|void|volatile|wchar_t)\b'
# keywords
syntax_pattern normal normal c++_keyword '\b(_Alignof|_Generic|_Static_assert|alignof|and|and_eq|asm|bitand|bitor|break|case|catch|compl|const_cast|continue|decltype|default|delete|do|dynamic_cast|else|for|friend|goto|if|new|noexcept|not|not_eq|operator|or|or_eq|private|protected|public|reinterpret_cast|return|sizeof|static_assert|static_cast|switch|this|throw|try|typeid|using|while|xor|xor_eq)\b'
# punctuation
syntax_pattern normal normal c++_punctuation '[!~%\|\&\^\(\)\<\>\*\-\+=\{\}\[\]:;,\?]+'
syntax_pattern normal normal c++_punctuation '[/\.]'
# parsing optimisation
syntax_pattern normal normal text '[a-z_][a-z_0-9]*' ignorecase