dymokomi/luced
Source of release 0.4.1
0.4.1 / grammars / cpp.tmLanguage.json
{
"name": "C++",
"scopeName": "source.cpp",
"fileTypes": ["cpp", "cc", "cxx", "c++", "cp", "hpp", "hh", "hxx", "h++", "ipp", "inl", "tcc", "tpp"],
"patterns": [
{ "include": "#comment" },
{ "include": "#preprocessor" },
{ "include": "#string" },
{ "include": "#char" },
{ "include": "#number" },
{ "include": "#keyword" },
{ "include": "#storage" },
{ "include": "#constant" },
{ "include": "#builtin-type" },
{ "include": "#type-name" },
{ "include": "#function-call" }
],
"repository": {
"comment": {
"patterns": [
{ "begin": "/\\*", "end": "\\*/", "name": "comment.block.cpp" },
{ "match": "//.*$", "name": "comment.line.double-slash.cpp" }
]
},
"preprocessor": {
"patterns": [
{
"match": "^\\s*(#\\s*include)\\s*(<[^>]*>|\"[^\"]*\")",
"captures": {
"1": { "name": "keyword.control.directive.include.cpp" },
"2": { "name": "string.quoted.other.include.cpp" }
}
},
{
"match": "^\\s*(#\\s*(?:define|undef|if|ifdef|ifndef|elif|else|endif|pragma|error|warning|line|import))\\b",
"captures": { "1": { "name": "keyword.control.directive.cpp" } }
},
{ "match": "^\\s*#.*$", "name": "keyword.control.directive.cpp" }
]
},
"string": {
"patterns": [
{ "begin": "([uU]|u8|L)?R\"\\(", "end": "\\)\"", "name": "string.quoted.other.raw.cpp" },
{
"begin": "([uU]|u8|L)?\"",
"end": "\"",
"name": "string.quoted.double.cpp",
"patterns": [{ "match": "\\\\.", "name": "constant.character.escape.cpp" }]
}
]
},
"char": { "match": "(?:[uUL])?'(\\\\.|[^'])'", "name": "string.quoted.single.cpp" },
"number": {
"match": "\\b(?:0[xX][0-9a-fA-F']+|0[bB][01']+|[0-9][0-9']*\\.?[0-9']*(?:[eE][+-]?[0-9]+)?)[fFlLuU]*\\b",
"name": "constant.numeric.cpp"
},
"keyword": {
"match": "\\b(if|else|for|while|do|switch|case|default|break|continue|return|goto|try|catch|throw|new|delete|sizeof|alignof|typeid|static_cast|dynamic_cast|reinterpret_cast|const_cast|co_await|co_yield|co_return|noexcept|and|or|not|xor|bitand|bitor|compl)\\b",
"name": "keyword.control.cpp"
},
"storage": {
"match": "\\b(class|struct|union|enum|namespace|template|typename|using|typedef|public|private|protected|virtual|override|final|explicit|friend|inline|static|extern|register|local|mutable|constexpr|consteval|constinit|const|volatile|auto|decltype|operator|this|concept|requires|export|module|signed|unsigned)\\b",
"name": "storage.type.cpp"
},
"constant": { "match": "\\b(true|false|nullptr|NULL)\\b", "name": "constant.language.cpp" },
"builtin-type": {
"match": "\\b(void|bool|char|char8_t|char16_t|char32_t|wchar_t|short|int|long|float|double|size_t|ptrdiff_t|intptr_t|uintptr_t|int8_t|int16_t|int32_t|int64_t|uint8_t|uint16_t|uint32_t|uint64_t)\\b",
"name": "storage.type.built-in.cpp"
},
"type-name": {
"patterns": [
{ "match": "\\b[A-Z][A-Za-z0-9_]*\\b", "name": "entity.name.type.cpp" },
{ "match": "\\b[a-z_][A-Za-z0-9_]*_t\\b", "name": "entity.name.type.cpp" }
]
},
"function-call": {
"match": "\\b([A-Za-z_][A-Za-z0-9_]*)\\s*(?=\\()",
"name": "entity.name.function.cpp"
}
}
}