| 1 | { |
| 2 | "scopeName": "source.cpp", |
| 3 | "fileTypes": [ |
| 4 | "cc", |
| 5 | "cpp", |
| 6 | "cp", |
| 7 | "cxx", |
| 8 | "c++", |
| 9 | "cu", |
| 10 | "cuh", |
| 11 | "h", |
| 12 | "hh", |
| 13 | "hpp", |
| 14 | "hxx", |
| 15 | "h++", |
| 16 | "inl", |
| 17 | "ino", |
| 18 | "ipp", |
| 19 | "tcc", |
| 20 | "tpp" |
| 21 | ], |
| 22 | "firstLineMatch": "(?i)-\\*-[^*]*(Mode:\\s*)?C\\+\\+(\\s*;.*?)?\\s*-\\*-", |
| 23 | "name": "C++", |
| 24 | "patterns": [ |
| 25 | { |
| 26 | "include": "#special_block" |
| 27 | }, |
| 28 | { |
| 29 | "include": "#strings" |
| 30 | }, |
| 31 | { |
| 32 | "match": "\\b(friend|explicit|virtual|override|final|noexcept)\\b", |
| 33 | "name": "storage.modifier.cpp" |
| 34 | }, |
| 35 | { |
| 36 | "match": "\\b(private:|protected:|public:)", |
| 37 | "name": "storage.modifier.cpp" |
| 38 | }, |
| 39 | { |
| 40 | "match": "\\b(catch|operator|try|throw|using)\\b", |
| 41 | "name": "keyword.control.cpp" |
| 42 | }, |
| 43 | { |
| 44 | "match": "\\bdelete\\b(\\s*\\[\\])?|\\bnew\\b(?!])", |
| 45 | "name": "keyword.control.cpp" |
| 46 | }, |
| 47 | { |
| 48 | "match": "\\b(f|m)[A-Z]\\w*\\b", |
| 49 | "name": "variable.other.readwrite.member.cpp" |
| 50 | }, |
| 51 | { |
| 52 | "match": "\\bthis\\b", |
| 53 | "name": "variable.language.this.cpp" |
| 54 | }, |
| 55 | { |
| 56 | "match": "\\bnullptr\\b", |
| 57 | "name": "variable.language.cpp" |
| 58 | }, |
| 59 | { |
| 60 | "match": "\\btemplate\\b\\s*", |
| 61 | "name": "storage.type.template.cpp" |
| 62 | }, |
| 63 | { |
| 64 | "match": "\\b(const_cast|dynamic_cast|reinterpret_cast|static_cast)\\b\\s*", |
| 65 | "name": "keyword.operator.cast.cpp" |
| 66 | }, |
| 67 | { |
| 68 | "match": "\\b(and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq|alignof|alignas)\\b", |
| 69 | "name": "keyword.operator.cpp" |
| 70 | }, |
| 71 | { |
| 72 | "match": "\\b(class|decltype|wchar_t|char16_t|char32_t)\\b", |
| 73 | "name": "storage.type.cpp" |
| 74 | }, |
| 75 | { |
| 76 | "match": "\\b(constexpr|export|mutable|typename|thread_local)\\b", |
| 77 | "name": "storage.modifier.cpp" |
| 78 | }, |
| 79 | { |
| 80 | "begin": "(?x)\n(?:\n ^ | # beginning of line\n (?:(?<!else|new|=)) # or word + space before name\n)\n((?:[A-Za-z_][A-Za-z0-9_]*::)*+~[A-Za-z_][A-Za-z0-9_]*) # actual name\n\\s*(\\() # opening bracket", |
| 81 | "beginCaptures": { |
| 82 | "1": { |
| 83 | "name": "entity.name.function.cpp" |
| 84 | }, |
| 85 | "2": { |
| 86 | "name": "punctuation.definition.parameters.begin.c" |
| 87 | } |
| 88 | }, |
| 89 | "end": "\\)", |
| 90 | "endCaptures": { |
| 91 | "0": { |
| 92 | "name": "punctuation.definition.parameters.end.c" |
| 93 | } |
| 94 | }, |
| 95 | "name": "meta.function.destructor.cpp", |
| 96 | "patterns": [ |
| 97 | { |
| 98 | "include": "$base" |
| 99 | } |
| 100 | ] |
| 101 | }, |
| 102 | { |
| 103 | "begin": "(?x)\n(?:\n ^ | # beginning of line\n (?:(?<!else|new|=)) # or word + space before name\n)\n((?:[A-Za-z_][A-Za-z0-9_]*::)*+~[A-Za-z_][A-Za-z0-9_]*) # actual name\n\\s*(\\() # opening bracket", |
| 104 | "beginCaptures": { |
| 105 | "1": { |
| 106 | "name": "entity.name.function.cpp" |
| 107 | }, |
| 108 | "2": { |
| 109 | "name": "punctuation.definition.parameters.begin.c" |
| 110 | } |
| 111 | }, |
| 112 | "end": "\\)", |
| 113 | "endCaptures": { |
| 114 | "0": { |
| 115 | "name": "punctuation.definition.parameters.end.c" |
| 116 | } |
| 117 | }, |
| 118 | "name": "meta.function.destructor.prototype.cpp", |
| 119 | "patterns": [ |
| 120 | { |
| 121 | "include": "$base" |
| 122 | } |
| 123 | ] |
| 124 | }, |
| 125 | { |
| 126 | "include": "source.c" |
| 127 | } |
| 128 | ], |
| 129 | "repository": { |
| 130 | "angle_brackets": { |
| 131 | "begin": "<", |
| 132 | "end": ">", |
| 133 | "name": "meta.angle-brackets.cpp", |
| 134 | "patterns": [ |
| 135 | { |
| 136 | "include": "#angle_brackets" |
| 137 | }, |
| 138 | { |
| 139 | "include": "$base" |
| 140 | } |
| 141 | ] |
| 142 | }, |
| 143 | "block": { |
| 144 | "begin": "\\{", |
| 145 | "beginCaptures": { |
| 146 | "0": { |
| 147 | "name": "punctuation.section.block.begin.c" |
| 148 | } |
| 149 | }, |
| 150 | "end": "\\}", |
| 151 | "endCaptures": { |
| 152 | "0": { |
| 153 | "name": "punctuation.section.block.end.c" |
| 154 | } |
| 155 | }, |
| 156 | "name": "meta.block.cpp", |
| 157 | "patterns": [ |
| 158 | { |
| 159 | "captures": { |
| 160 | "1": { |
| 161 | "name": "support.function.any-method.c" |
| 162 | }, |
| 163 | "2": { |
| 164 | "name": "punctuation.definition.parameters.c" |
| 165 | } |
| 166 | }, |
| 167 | "match": "(?x)\n(\n (?!while|for|do|if|else|switch|catch|enumerate|return|r?iterate)\n (?:\\b[A-Za-z_][A-Za-z0-9_]*+\\b|::)*+ # actual name\n)\n\\s*(\\() # opening bracket", |
| 168 | "name": "meta.function-call.c" |
| 169 | }, |
| 170 | { |
| 171 | "include": "$base" |
| 172 | } |
| 173 | ] |
| 174 | }, |
| 175 | "constructor": { |
| 176 | "patterns": [ |
| 177 | { |
| 178 | "begin": "(?x)\n(?:^\\s*) # beginning of line\n((?!while|for|do|if|else|switch|catch|enumerate|r?iterate)[A-Za-z_][A-Za-z0-9_:]*) # actual name\n\\s*(\\() # opening bracket", |
| 179 | "beginCaptures": { |
| 180 | "1": { |
| 181 | "name": "entity.name.function.cpp" |
| 182 | }, |
| 183 | "2": { |
| 184 | "name": "punctuation.definition.parameters.begin.c" |
| 185 | } |
| 186 | }, |
| 187 | "end": "\\)", |
| 188 | "endCaptures": { |
| 189 | "0": { |
| 190 | "name": "punctuation.definition.parameters.end.c" |
| 191 | } |
| 192 | }, |
| 193 | "name": "meta.function.constructor.cpp", |
| 194 | "patterns": [ |
| 195 | { |
| 196 | "include": "$base" |
| 197 | } |
| 198 | ] |
| 199 | }, |
| 200 | { |
| 201 | "begin": "(?x)\n(:)\n(\n (?=\n \\s*[A-Za-z_][A-Za-z0-9_:]* # actual name\n \\s* (\\() # opening bracket\n )\n)", |
| 202 | "beginCaptures": { |
| 203 | "1": { |
| 204 | "name": "punctuation.definition.parameters.c" |
| 205 | } |
| 206 | }, |
| 207 | "end": "(?=\\{)", |
| 208 | "name": "meta.function.constructor.initializer-list.cpp", |
| 209 | "patterns": [ |
| 210 | { |
| 211 | "include": "$base" |
| 212 | } |
| 213 | ] |
| 214 | } |
| 215 | ] |
| 216 | }, |
| 217 | "special_block": { |
| 218 | "patterns": [ |
| 219 | { |
| 220 | "begin": "\\b(using)\\b\\s*(namespace)\\b\\s*((?:[_A-Za-z][_A-Za-z0-9]*\\b(::)?)*)", |
| 221 | "beginCaptures": { |
| 222 | "1": { |
| 223 | "name": "keyword.control.cpp" |
| 224 | }, |
| 225 | "2": { |
| 226 | "name": "storage.type.cpp" |
| 227 | }, |
| 228 | "3": { |
| 229 | "name": "entity.name.type.cpp" |
| 230 | } |
| 231 | }, |
| 232 | "end": "(;)", |
| 233 | "name": "meta.using-namespace-declaration.cpp" |
| 234 | }, |
| 235 | { |
| 236 | "begin": "\\b(namespace)\\b\\s*([_A-Za-z][_A-Za-z0-9]*\\b)?+", |
| 237 | "beginCaptures": { |
| 238 | "1": { |
| 239 | "name": "storage.type.cpp" |
| 240 | }, |
| 241 | "2": { |
| 242 | "name": "entity.name.type.cpp" |
| 243 | } |
| 244 | }, |
| 245 | "captures": { |
| 246 | "1": { |
| 247 | "name": "keyword.control.namespace.$2" |
| 248 | } |
| 249 | }, |
| 250 | "end": "(?<=\\})|(?=(;|,|\\(|\\)|>|\\[|\\]|=))", |
| 251 | "name": "meta.namespace-block.cpp", |
| 252 | "patterns": [ |
| 253 | { |
| 254 | "begin": "\\{", |
| 255 | "beginCaptures": { |
| 256 | "0": { |
| 257 | "name": "punctuation.definition.scope.cpp" |
| 258 | } |
| 259 | }, |
| 260 | "end": "\\}", |
| 261 | "endCaptures": { |
| 262 | "0": { |
| 263 | "name": "punctuation.definition.scope.cpp" |
| 264 | } |
| 265 | }, |
| 266 | "patterns": [ |
| 267 | { |
| 268 | "include": "#special_block" |
| 269 | }, |
| 270 | { |
| 271 | "include": "#constructor" |
| 272 | }, |
| 273 | { |
| 274 | "include": "$base" |
| 275 | } |
| 276 | ] |
| 277 | }, |
| 278 | { |
| 279 | "include": "$base" |
| 280 | } |
| 281 | ] |
| 282 | }, |
| 283 | { |
| 284 | "begin": "\\b(class|struct)\\b\\s*([_A-Za-z][_A-Za-z0-9]*\\b)?+(\\s*:\\s*(public|protected|private)\\s*([_A-Za-z][_A-Za-z0-9]*\\b)((\\s*,\\s*(public|protected|private)\\s*[_A-Za-z][_A-Za-z0-9]*\\b)*))?", |
| 285 | "beginCaptures": { |
| 286 | "1": { |
| 287 | "name": "storage.type.cpp" |
| 288 | }, |
| 289 | "2": { |
| 290 | "name": "entity.name.type.cpp" |
| 291 | }, |
| 292 | "4": { |
| 293 | "name": "storage.type.modifier.cpp" |
| 294 | }, |
| 295 | "5": { |
| 296 | "name": "entity.name.type.inherited.cpp" |
| 297 | }, |
| 298 | "6": { |
| 299 | "patterns": [ |
| 300 | { |
| 301 | "match": "(public|protected|private)", |
| 302 | "name": "storage.type.modifier.cpp" |
| 303 | }, |
| 304 | { |
| 305 | "match": "[_A-Za-z][_A-Za-z0-9]*", |
| 306 | "name": "entity.name.type.inherited.cpp" |
| 307 | } |
| 308 | ] |
| 309 | } |
| 310 | }, |
| 311 | "end": "(?<=\\})|(?=(;|\\(|\\)|>|\\[|\\]|=))", |
| 312 | "name": "meta.class-struct-block.cpp", |
| 313 | "patterns": [ |
| 314 | { |
| 315 | "include": "#angle_brackets" |
| 316 | }, |
| 317 | { |
| 318 | "begin": "\\{", |
| 319 | "beginCaptures": { |
| 320 | "0": { |
| 321 | "name": "punctuation.section.block.begin.cpp" |
| 322 | } |
| 323 | }, |
| 324 | "end": "(\\})(\\s*\\n)?", |
| 325 | "endCaptures": { |
| 326 | "1": { |
| 327 | "name": "punctuation.section.block.end.cpp" |
| 328 | }, |
| 329 | "2": { |
| 330 | "name": "invalid.illegal.you-forgot-semicolon.cpp" |
| 331 | } |
| 332 | }, |
| 333 | "patterns": [ |
| 334 | { |
| 335 | "include": "#special_block" |
| 336 | }, |
| 337 | { |
| 338 | "include": "#constructor" |
| 339 | }, |
| 340 | { |
| 341 | "include": "$base" |
| 342 | } |
| 343 | ] |
| 344 | }, |
| 345 | { |
| 346 | "include": "$base" |
| 347 | } |
| 348 | ] |
| 349 | }, |
| 350 | { |
| 351 | "begin": "\\b(extern)(?=\\s*\")", |
| 352 | "beginCaptures": { |
| 353 | "1": { |
| 354 | "name": "storage.modifier.cpp" |
| 355 | } |
| 356 | }, |
| 357 | "end": "(?<=\\})|(?=\\w)|(?=\\s*#\\s*endif\\b)", |
| 358 | "name": "meta.extern-block.cpp", |
| 359 | "patterns": [ |
| 360 | { |
| 361 | "begin": "\\{", |
| 362 | "beginCaptures": { |
| 363 | "0": { |
| 364 | "name": "punctuation.section.block.begin.c" |
| 365 | } |
| 366 | }, |
| 367 | "end": "\\}|(?=\\s*#\\s*endif\\b)", |
| 368 | "endCaptures": { |
| 369 | "0": { |
| 370 | "name": "punctuation.section.block.end.c" |
| 371 | } |
| 372 | }, |
| 373 | "patterns": [ |
| 374 | { |
| 375 | "include": "#special_block" |
| 376 | }, |
| 377 | { |
| 378 | "include": "$base" |
| 379 | } |
| 380 | ] |
| 381 | }, |
| 382 | { |
| 383 | "include": "$base" |
| 384 | } |
| 385 | ] |
| 386 | } |
| 387 | ] |
| 388 | }, |
| 389 | "strings": { |
| 390 | "patterns": [ |
| 391 | { |
| 392 | "begin": "(u|u8|U|L)?\"", |
| 393 | "beginCaptures": { |
| 394 | "0": { |
| 395 | "name": "punctuation.definition.string.begin.cpp" |
| 396 | }, |
| 397 | "1": { |
| 398 | "name": "meta.encoding.cpp" |
| 399 | } |
| 400 | }, |
| 401 | "end": "\"", |
| 402 | "endCaptures": { |
| 403 | "0": { |
| 404 | "name": "punctuation.definition.string.end.cpp" |
| 405 | } |
| 406 | }, |
| 407 | "name": "string.quoted.double.cpp", |
| 408 | "patterns": [ |
| 409 | { |
| 410 | "match": "\\\\u\\h{4}|\\\\U\\h{8}", |
| 411 | "name": "constant.character.escape.cpp" |
| 412 | }, |
| 413 | { |
| 414 | "match": "\\\\['\"?\\\\abfnrtv]", |
| 415 | "name": "constant.character.escape.cpp" |
| 416 | }, |
| 417 | { |
| 418 | "match": "\\\\[0-7]{1,3}", |
| 419 | "name": "constant.character.escape.cpp" |
| 420 | }, |
| 421 | { |
| 422 | "match": "\\\\x\\h+", |
| 423 | "name": "constant.character.escape.cpp" |
| 424 | } |
| 425 | ] |
| 426 | }, |
| 427 | { |
| 428 | "begin": "(u|u8|U|L)?R\"(?:([^ ()\\\\\\t]{0,16})|([^ ()\\\\\\t]*))\\(", |
| 429 | "beginCaptures": { |
| 430 | "0": { |
| 431 | "name": "punctuation.definition.string.begin.cpp" |
| 432 | }, |
| 433 | "1": { |
| 434 | "name": "meta.encoding.cpp" |
| 435 | }, |
| 436 | "3": { |
| 437 | "name": "invalid.illegal.delimiter-too-long.cpp" |
| 438 | } |
| 439 | }, |
| 440 | "end": "\\)\\2(\\3)\"", |
| 441 | "endCaptures": { |
| 442 | "0": { |
| 443 | "name": "punctuation.definition.string.end.cpp" |
| 444 | }, |
| 445 | "1": { |
| 446 | "name": "invalid.illegal.delimiter-too-long.cpp" |
| 447 | } |
| 448 | }, |
| 449 | "name": "string.quoted.double.raw.cpp" |
| 450 | } |
| 451 | ] |
| 452 | } |
| 453 | }, |
| 454 | "version": "https://github.com/atom/language-c/commit/80db38512efabb3030d600a8d8f8b6d91abbc96b" |
| 455 | } |