| 1 | { |
| 2 | "scopeName": "source.c", |
| 3 | "fileTypes": [ |
| 4 | "c", |
| 5 | "h.in" |
| 6 | ], |
| 7 | "firstLineMatch": "(?i)-\\*-[^*]*(Mode:\\s*)?C(\\s*;.*?)?\\s*-\\*-", |
| 8 | "name": "C", |
| 9 | "patterns": [ |
| 10 | { |
| 11 | "include": "#preprocessor-rule-enabled" |
| 12 | }, |
| 13 | { |
| 14 | "include": "#preprocessor-rule-disabled" |
| 15 | }, |
| 16 | { |
| 17 | "include": "#preprocessor-rule-other" |
| 18 | }, |
| 19 | { |
| 20 | "include": "#comments" |
| 21 | }, |
| 22 | { |
| 23 | "match": "\\b(break|case|continue|default|do|else|for|goto|if|_Pragma|return|switch|while)\\b", |
| 24 | "name": "keyword.control.c" |
| 25 | }, |
| 26 | { |
| 27 | "match": "\\b(asm|__asm__|auto|bool|_Bool|char|_Complex|double|enum|float|_Imaginary|int|long|short|signed|struct|typedef|union|unsigned|void)\\b", |
| 28 | "name": "storage.type.c" |
| 29 | }, |
| 30 | { |
| 31 | "match": "\\b(const|extern|register|restrict|static|volatile|inline)\\b", |
| 32 | "name": "storage.modifier.c" |
| 33 | }, |
| 34 | { |
| 35 | "match": "\\bk[A-Z]\\w*\\b", |
| 36 | "name": "constant.other.variable.mac-classic.c" |
| 37 | }, |
| 38 | { |
| 39 | "match": "\\bg[A-Z]\\w*\\b", |
| 40 | "name": "variable.other.readwrite.global.mac-classic.c" |
| 41 | }, |
| 42 | { |
| 43 | "match": "\\bs[A-Z]\\w*\\b", |
| 44 | "name": "variable.other.readwrite.static.mac-classic.c" |
| 45 | }, |
| 46 | { |
| 47 | "match": "\\b(NULL|true|false|TRUE|FALSE)\\b", |
| 48 | "name": "constant.language.c" |
| 49 | }, |
| 50 | { |
| 51 | "include": "#operators" |
| 52 | }, |
| 53 | { |
| 54 | "include": "#numbers" |
| 55 | }, |
| 56 | { |
| 57 | "include": "#strings" |
| 58 | }, |
| 59 | { |
| 60 | "begin": "(?x)\n^\\s* ((\\#)\\s*define) \\s+ # define\n((?<id>[a-zA-Z_$][\\w$]*)) # macro name\n(?:\n (\\()\n (\n \\s* \\g<id> \\s* # first argument\n ((,) \\s* \\g<id> \\s*)* # additional arguments\n (?:\\.\\.\\.)? # varargs ellipsis?\n )\n (\\))\n)?", |
| 61 | "beginCaptures": { |
| 62 | "1": { |
| 63 | "name": "keyword.control.directive.define.c" |
| 64 | }, |
| 65 | "2": { |
| 66 | "name": "punctuation.definition.directive.c" |
| 67 | }, |
| 68 | "3": { |
| 69 | "name": "entity.name.function.preprocessor.c" |
| 70 | }, |
| 71 | "5": { |
| 72 | "name": "punctuation.definition.parameters.begin.c" |
| 73 | }, |
| 74 | "6": { |
| 75 | "name": "variable.parameter.preprocessor.c" |
| 76 | }, |
| 77 | "8": { |
| 78 | "name": "punctuation.separator.parameters.c" |
| 79 | }, |
| 80 | "9": { |
| 81 | "name": "punctuation.definition.parameters.end.c" |
| 82 | } |
| 83 | }, |
| 84 | "end": "(?=(?://|/\\*))|(?<!\\\\)(?=\\n)", |
| 85 | "name": "meta.preprocessor.macro.c", |
| 86 | "patterns": [ |
| 87 | { |
| 88 | "include": "$base" |
| 89 | } |
| 90 | ] |
| 91 | }, |
| 92 | { |
| 93 | "begin": "^\\s*((#)\\s*(error|warning))\\b", |
| 94 | "captures": { |
| 95 | "1": { |
| 96 | "name": "keyword.control.directive.diagnostic.$3.c" |
| 97 | }, |
| 98 | "2": { |
| 99 | "name": "punctuation.definition.directive.c" |
| 100 | } |
| 101 | }, |
| 102 | "end": "(?<!\\\\)(?=\\n)", |
| 103 | "name": "meta.preprocessor.diagnostic.c", |
| 104 | "patterns": [ |
| 105 | { |
| 106 | "include": "#line_continuation_character" |
| 107 | } |
| 108 | ] |
| 109 | }, |
| 110 | { |
| 111 | "begin": "^\\s*((#)\\s*(include|import))\\b\\s*", |
| 112 | "beginCaptures": { |
| 113 | "1": { |
| 114 | "name": "keyword.control.directive.$3.c" |
| 115 | }, |
| 116 | "2": { |
| 117 | "name": "punctuation.definition.directive.c" |
| 118 | } |
| 119 | }, |
| 120 | "end": "(?=(?://|/\\*))|(?<!\\\\)(?=\\n)", |
| 121 | "name": "meta.preprocessor.include.c", |
| 122 | "patterns": [ |
| 123 | { |
| 124 | "include": "#line_continuation_character" |
| 125 | }, |
| 126 | { |
| 127 | "begin": "\"", |
| 128 | "beginCaptures": { |
| 129 | "0": { |
| 130 | "name": "punctuation.definition.string.begin.c" |
| 131 | } |
| 132 | }, |
| 133 | "end": "\"", |
| 134 | "endCaptures": { |
| 135 | "0": { |
| 136 | "name": "punctuation.definition.string.end.c" |
| 137 | } |
| 138 | }, |
| 139 | "name": "string.quoted.double.include.c" |
| 140 | }, |
| 141 | { |
| 142 | "begin": "<", |
| 143 | "beginCaptures": { |
| 144 | "0": { |
| 145 | "name": "punctuation.definition.string.begin.c" |
| 146 | } |
| 147 | }, |
| 148 | "end": ">", |
| 149 | "endCaptures": { |
| 150 | "0": { |
| 151 | "name": "punctuation.definition.string.end.c" |
| 152 | } |
| 153 | }, |
| 154 | "name": "string.quoted.other.lt-gt.include.c" |
| 155 | } |
| 156 | ] |
| 157 | }, |
| 158 | { |
| 159 | "include": "#pragma-mark" |
| 160 | }, |
| 161 | { |
| 162 | "begin": "^\\s*((#)\\s*line)\\b", |
| 163 | "beginCaptures": { |
| 164 | "1": { |
| 165 | "name": "keyword.control.directive.line.c" |
| 166 | }, |
| 167 | "2": { |
| 168 | "name": "punctuation.definition.directive.c" |
| 169 | } |
| 170 | }, |
| 171 | "end": "(?=(?://|/\\*))|(?<!\\\\)(?=\\n)", |
| 172 | "name": "meta.preprocessor.c", |
| 173 | "patterns": [ |
| 174 | { |
| 175 | "include": "#strings" |
| 176 | }, |
| 177 | { |
| 178 | "include": "#numbers" |
| 179 | }, |
| 180 | { |
| 181 | "include": "#line_continuation_character" |
| 182 | } |
| 183 | ] |
| 184 | }, |
| 185 | { |
| 186 | "begin": "^\\s*(?:((#)\\s*(?:elif|else|if|ifdef|ifndef))|((#)\\s*(pragma|undef)))\\b", |
| 187 | "beginCaptures": { |
| 188 | "1": { |
| 189 | "name": "keyword.control.directive.conditional.c" |
| 190 | }, |
| 191 | "2": { |
| 192 | "name": "punctuation.definition.directive.c" |
| 193 | }, |
| 194 | "3": { |
| 195 | "name": "keyword.control.directive.$5.c" |
| 196 | }, |
| 197 | "4": { |
| 198 | "name": "punctuation.definition.directive.c" |
| 199 | } |
| 200 | }, |
| 201 | "end": "(?=(?://|/\\*))|(?<!\\\\)(?=\\n)", |
| 202 | "name": "meta.preprocessor.c", |
| 203 | "patterns": [ |
| 204 | { |
| 205 | "include": "#line_continuation_character" |
| 206 | } |
| 207 | ] |
| 208 | }, |
| 209 | { |
| 210 | "match": "\\b(u_char|u_short|u_int|u_long|ushort|uint|u_quad_t|quad_t|qaddr_t|caddr_t|daddr_t|dev_t|fixpt_t|blkcnt_t|blksize_t|gid_t|in_addr_t|in_port_t|ino_t|key_t|mode_t|nlink_t|id_t|pid_t|off_t|segsz_t|swblk_t|uid_t|id_t|clock_t|size_t|ssize_t|time_t|useconds_t|suseconds_t)\\b", |
| 211 | "name": "support.type.sys-types.c" |
| 212 | }, |
| 213 | { |
| 214 | "match": "\\b(pthread_attr_t|pthread_cond_t|pthread_condattr_t|pthread_mutex_t|pthread_mutexattr_t|pthread_once_t|pthread_rwlock_t|pthread_rwlockattr_t|pthread_t|pthread_key_t)\\b", |
| 215 | "name": "support.type.pthread.c" |
| 216 | }, |
| 217 | { |
| 218 | "match": "(?x) \\b\n(int8_t|int16_t|int32_t|int64_t|uint8_t|uint16_t|uint32_t|uint64_t|int_least8_t\n|int_least16_t|int_least32_t|int_least64_t|uint_least8_t|uint_least16_t|uint_least32_t\n|uint_least64_t|int_fast8_t|int_fast16_t|int_fast32_t|int_fast64_t|uint_fast8_t\n|uint_fast16_t|uint_fast32_t|uint_fast64_t|intptr_t|uintptr_t|intmax_t|intmax_t\n|uintmax_t|uintmax_t)\n\\b", |
| 219 | "name": "support.type.stdint.c" |
| 220 | }, |
| 221 | { |
| 222 | "match": "\\b(noErr|kNilOptions|kInvalidID|kVariableLengthArray)\\b", |
| 223 | "name": "support.constant.mac-classic.c" |
| 224 | }, |
| 225 | { |
| 226 | "match": "(?x) \\b\n(AbsoluteTime|Boolean|Byte|ByteCount|ByteOffset|BytePtr|CompTimeValue|ConstLogicalAddress|ConstStrFileNameParam\n|ConstStringPtr|Duration|Fixed|FixedPtr|Float32|Float32Point|Float64|Float80|Float96|FourCharCode|Fract|FractPtr\n|Handle|ItemCount|LogicalAddress|OptionBits|OSErr|OSStatus|OSType|OSTypePtr|PhysicalAddress|ProcessSerialNumber\n|ProcessSerialNumberPtr|ProcHandle|Ptr|ResType|ResTypePtr|ShortFixed|ShortFixedPtr|SignedByte|SInt16|SInt32|SInt64\n|SInt8|Size|StrFileName|StringHandle|StringPtr|TimeBase|TimeRecord|TimeScale|TimeValue|TimeValue64|UInt16|UInt32\n|UInt64|UInt8|UniChar|UniCharCount|UniCharCountPtr|UniCharPtr|UnicodeScalarValue|UniversalProcHandle|UniversalProcPtr\n|UnsignedFixed|UnsignedFixedPtr|UnsignedWide|UTF16Char|UTF32Char|UTF8Char)\n\\b", |
| 227 | "name": "support.type.mac-classic.c" |
| 228 | }, |
| 229 | { |
| 230 | "match": "\\b([A-Za-z0-9_]+_t)\\b", |
| 231 | "name": "support.type.posix-reserved.c" |
| 232 | }, |
| 233 | { |
| 234 | "include": "#block" |
| 235 | }, |
| 236 | { |
| 237 | "begin": "(?x)\n(?:\n ^ |\n (?:\n (?=\\s)(?<!else|new|return)(?<=\\w) # word + space before name\n |\n (?=\\s*[A-Za-z_])(?<!&&)(?<=[*&>]) # type modifier before name\n )\n)\n(\\s*)(?!(while|for|do|if|else|switch|catch|enumerate|return|sizeof|[cr]?iterate)\\s*\\()\n(\n (?:[A-Za-z_][A-Za-z0-9_]*+|::)++ # actual name\n |\n (?:(?<=operator)(?:[-*&<>=+!]+|\\(\\)|\\[\\]))\n)\n\\s*(?=\\()", |
| 238 | "beginCaptures": { |
| 239 | "1": { |
| 240 | "name": "punctuation.whitespace.function.leading.c" |
| 241 | }, |
| 242 | "3": { |
| 243 | "name": "entity.name.function.c" |
| 244 | }, |
| 245 | "4": { |
| 246 | "name": "punctuation.definition.parameters.c" |
| 247 | } |
| 248 | }, |
| 249 | "end": "(?<=\\})|(?=#)|(;)", |
| 250 | "name": "meta.function.c", |
| 251 | "patterns": [ |
| 252 | { |
| 253 | "include": "#comments" |
| 254 | }, |
| 255 | { |
| 256 | "include": "#parens" |
| 257 | }, |
| 258 | { |
| 259 | "match": "\\b(const)\\b", |
| 260 | "name": "storage.modifier.c" |
| 261 | }, |
| 262 | { |
| 263 | "include": "#block" |
| 264 | } |
| 265 | ] |
| 266 | }, |
| 267 | { |
| 268 | "include": "#line_continuation_character" |
| 269 | } |
| 270 | ], |
| 271 | "repository": { |
| 272 | "access": { |
| 273 | "captures": { |
| 274 | "2": { |
| 275 | "name": "punctuation.separator.dot-access.c" |
| 276 | }, |
| 277 | "3": { |
| 278 | "name": "punctuation.separator.pointer-access.c" |
| 279 | }, |
| 280 | "4": { |
| 281 | "name": "variable.other.member.c" |
| 282 | } |
| 283 | }, |
| 284 | "match": "((\\.)|(->))([a-zA-Z_][a-zA-Z_0-9]*)\\b(?!\\s*\\()" |
| 285 | }, |
| 286 | "block": { |
| 287 | "patterns": [ |
| 288 | { |
| 289 | "begin": "\\{", |
| 290 | "beginCaptures": { |
| 291 | "0": { |
| 292 | "name": "punctuation.section.block.begin.c" |
| 293 | } |
| 294 | }, |
| 295 | "end": "\\}|(?=\\s*#\\s*endif\\b)", |
| 296 | "endCaptures": { |
| 297 | "0": { |
| 298 | "name": "punctuation.section.block.end.c" |
| 299 | } |
| 300 | }, |
| 301 | "name": "meta.block.c", |
| 302 | "patterns": [ |
| 303 | { |
| 304 | "include": "#block_innards" |
| 305 | } |
| 306 | ] |
| 307 | } |
| 308 | ] |
| 309 | }, |
| 310 | "block_innards": { |
| 311 | "patterns": [ |
| 312 | { |
| 313 | "include": "#preprocessor-rule-enabled-block" |
| 314 | }, |
| 315 | { |
| 316 | "include": "#preprocessor-rule-disabled-block" |
| 317 | }, |
| 318 | { |
| 319 | "include": "#preprocessor-rule-other-block" |
| 320 | }, |
| 321 | { |
| 322 | "include": "#sizeof" |
| 323 | }, |
| 324 | { |
| 325 | "include": "#access" |
| 326 | }, |
| 327 | { |
| 328 | "include": "#libc" |
| 329 | }, |
| 330 | { |
| 331 | "include": "#c_function_call" |
| 332 | }, |
| 333 | { |
| 334 | "captures": { |
| 335 | "1": { |
| 336 | "name": "variable.other.c" |
| 337 | }, |
| 338 | "2": { |
| 339 | "name": "punctuation.definition.parameters.c" |
| 340 | } |
| 341 | }, |
| 342 | "match": "(?x)\n(?:\n (?:\n (?=\\s)(?<!else|new|return)\n (?<=\\w) \\s+ # or word + space before name\n )\n)\n(\n (?:[A-Za-z_][A-Za-z0-9_]*+ | :: )++ # actual name\n |\n (?:(?<=operator) (?:[-*&<>=+!]+ | \\(\\) | \\[\\]))\n)\n\\s*(\\() # opening bracket", |
| 343 | "name": "meta.initialization.c" |
| 344 | }, |
| 345 | { |
| 346 | "include": "#block" |
| 347 | }, |
| 348 | { |
| 349 | "include": "$base" |
| 350 | } |
| 351 | ] |
| 352 | }, |
| 353 | "c_function_call": { |
| 354 | "captures": { |
| 355 | "1": { |
| 356 | "name": "punctuation.whitespace.function-call.leading.c" |
| 357 | }, |
| 358 | "2": { |
| 359 | "name": "support.function.any-method.c" |
| 360 | }, |
| 361 | "4": { |
| 362 | "name": "punctuation.definition.parameters.c" |
| 363 | } |
| 364 | }, |
| 365 | "match": "(?x)\n(?:\n (?=\\s)\n (?:(?<=else|new|return) | (?<!\\w)) (\\s+)\n)?\n\n# Actual name\n(\n \\b\n (?!\n (while|for|do|if|else|switch|catch|enumerate|return|sizeof|r?iterate)\n \\s* \\(\n )\n (?:(?!NS)[A-Za-z_][A-Za-z0-9_]*+\\b | ::)++\n)\n\\s*(\\() # Opening bracket", |
| 366 | "name": "meta.function-call.c" |
| 367 | }, |
| 368 | "comments": { |
| 369 | "patterns": [ |
| 370 | { |
| 371 | "captures": { |
| 372 | "1": { |
| 373 | "name": "meta.toc-list.banner.block.c" |
| 374 | } |
| 375 | }, |
| 376 | "match": "^/\\* =(\\s*.*?)\\s*= \\*/$\\n?", |
| 377 | "name": "comment.block.c" |
| 378 | }, |
| 379 | { |
| 380 | "begin": "/\\*", |
| 381 | "beginCaptures": { |
| 382 | "0": { |
| 383 | "name": "punctuation.definition.comment.begin.c" |
| 384 | } |
| 385 | }, |
| 386 | "end": "\\*/", |
| 387 | "endCaptures": { |
| 388 | "0": { |
| 389 | "name": "punctuation.definition.comment.end.c" |
| 390 | } |
| 391 | }, |
| 392 | "name": "comment.block.c" |
| 393 | }, |
| 394 | { |
| 395 | "match": "\\*/.*\\n", |
| 396 | "name": "invalid.illegal.stray-comment-end.c" |
| 397 | }, |
| 398 | { |
| 399 | "captures": { |
| 400 | "1": { |
| 401 | "name": "meta.toc-list.banner.line.c" |
| 402 | } |
| 403 | }, |
| 404 | "match": "^// =(\\s*.*?)\\s*=\\s*$\\n?", |
| 405 | "name": "comment.line.banner.cpp" |
| 406 | }, |
| 407 | { |
| 408 | "begin": "(^[ \\t]+)?(?=//)", |
| 409 | "beginCaptures": { |
| 410 | "1": { |
| 411 | "name": "punctuation.whitespace.comment.leading.cpp" |
| 412 | } |
| 413 | }, |
| 414 | "end": "(?!\\G)", |
| 415 | "patterns": [ |
| 416 | { |
| 417 | "begin": "//", |
| 418 | "beginCaptures": { |
| 419 | "0": { |
| 420 | "name": "punctuation.definition.comment.cpp" |
| 421 | } |
| 422 | }, |
| 423 | "end": "\\n", |
| 424 | "name": "comment.line.double-slash.cpp", |
| 425 | "patterns": [ |
| 426 | { |
| 427 | "include": "#line_continuation_character" |
| 428 | } |
| 429 | ] |
| 430 | } |
| 431 | ] |
| 432 | } |
| 433 | ] |
| 434 | }, |
| 435 | "disabled": { |
| 436 | "begin": "^\\s*#\\s*if(n?def)?\\b.*$", |
| 437 | "end": "^\\s*#\\s*endif\\b", |
| 438 | "patterns": [ |
| 439 | { |
| 440 | "include": "#disabled" |
| 441 | }, |
| 442 | { |
| 443 | "include": "#pragma-mark" |
| 444 | } |
| 445 | ] |
| 446 | }, |
| 447 | "libc": { |
| 448 | "captures": { |
| 449 | "1": { |
| 450 | "name": "punctuation.whitespace.support.function.leading.c" |
| 451 | }, |
| 452 | "2": { |
| 453 | "name": "support.function.C99.c" |
| 454 | } |
| 455 | }, |
| 456 | "match": "(?x) (\\s*) \\b\n(_Exit|(?:nearbyint|nextafter|nexttoward|netoward|nan)[fl]?|a(?:cos|sin)h?[fl]?|abort|abs|asctime|assert\n|atan(?:[h2]?[fl]?)?|atexit|ato[ifl]|atoll|bsearch|btowc|cabs[fl]?|cacos|cacos[fl]|cacosh[fl]?\n|calloc|carg[fl]?|casinh?[fl]?|catanh?[fl]?|cbrt[fl]?|ccosh?[fl]?|ceil[fl]?|cexp[fl]?|cimag[fl]?\n|clearerr|clock|clog[fl]?|conj[fl]?|copysign[fl]?|cosh?[fl]?|cpow[fl]?|cproj[fl]?|creal[fl]?\n|csinh?[fl]?|csqrt[fl]?|ctanh?[fl]?|ctime|difftime|div|erfc?[fl]?|exit|fabs[fl]?\n|exp(?:2[fl]?|[fl]|m1[fl]?)?|fclose|fdim[fl]?|fe[gs]et(?:env|exceptflag|round)|feclearexcept\n|feholdexcept|feof|feraiseexcept|ferror|fetestexcept|feupdateenv|fflush|fgetpos|fgetw?[sc]\n|floor[fl]?|fmax?[fl]?|fmin[fl]?|fmod[fl]?|fopen|fpclassify|fprintf|fputw?[sc]|fread|free|freopen\n|frexp[fl]?|fscanf|fseek|fsetpos|ftell|fwide|fwprintf|fwrite|fwscanf|genv|get[sc]|getchar|gmtime\n|gwc|gwchar|hypot[fl]?|ilogb[fl]?|imaxabs|imaxdiv|isalnum|isalpha|isblank|iscntrl|isdigit|isfinite\n|isgraph|isgreater|isgreaterequal|isinf|isless(?:equal|greater)?|isw?lower|isnan|isnormal|isw?print\n|isw?punct|isw?space|isunordered|isw?upper|iswalnum|iswalpha|iswblank|iswcntrl|iswctype|iswdigit|iswgraph\n|isw?xdigit|labs|ldexp[fl]?|ldiv|lgamma[fl]?|llabs|lldiv|llrint[fl]?|llround[fl]?|localeconv|localtime\n|log[2b]?[fl]?|log1[p0][fl]?|longjmp|lrint[fl]?|lround[fl]?|malloc|mbr?len|mbr?towc|mbsinit|mbsrtowcs\n|mbstowcs|memchr|memcmp|memcpy|memmove|memset|mktime|modf[fl]?|perror|pow[fl]?|printf|puts|putw?c(?:har)?\n|qsort|raise|rand|remainder[fl]?|realloc|remove|remquo[fl]?|rename|rewind|rint[fl]?|round[fl]?|scalbl?n[fl]?\n|scanf|setbuf|setjmp|setlocale|setvbuf|signal|signbit|sinh?[fl]?|snprintf|sprintf|sqrt[fl]?|srand|sscanf\n|strcat|strchr|strcmp|strcoll|strcpy|strcspn|strerror|strftime|strlen|strncat|strncmp|strncpy|strpbrk\n|strrchr|strspn|strstr|strto[kdf]|strtoimax|strtol[dl]?|strtoull?|strtoumax|strxfrm|swprintf|swscanf\n|system|tan|tan[fl]|tanh[fl]?|tgamma[fl]?|time|tmpfile|tmpnam|tolower|toupper|trunc[fl]?|ungetw?c|va_arg\n|va_copy|va_end|va_start|vfw?printf|vfw?scanf|vprintf|vscanf|vsnprintf|vsprintf|vsscanf|vswprintf|vswscanf\n|vwprintf|vwscanf|wcrtomb|wcscat|wcschr|wcscmp|wcscoll|wcscpy|wcscspn|wcsftime|wcslen|wcsncat|wcsncmp|wcsncpy\n|wcspbrk|wcsrchr|wcsrtombs|wcsspn|wcsstr|wcsto[dkf]|wcstoimax|wcstol[dl]?|wcstombs|wcstoull?|wcstoumax|wcsxfrm\n|wctom?b|wmem(?:set|chr|cpy|cmp|move)|wprintf|wscanf)\\b" |
| 457 | }, |
| 458 | "line_continuation_character": { |
| 459 | "patterns": [ |
| 460 | { |
| 461 | "match": "(\\\\)\\s*\\n", |
| 462 | "captures": { |
| 463 | "1": { |
| 464 | "name": "constant.character.escape.line-continuation.c" |
| 465 | } |
| 466 | } |
| 467 | } |
| 468 | ] |
| 469 | }, |
| 470 | "numbers": { |
| 471 | "patterns": [ |
| 472 | { |
| 473 | "match": "\\b((0(x|X)[0-9a-fA-F]*)|(0(b|B)[01]*)|(([0-9]+\\.?[0-9]*)|(\\.[0-9]+))((e|E)(\\+|-)?[0-9]+)?)(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b", |
| 474 | "name": "constant.numeric.c" |
| 475 | } |
| 476 | ] |
| 477 | }, |
| 478 | "parens": { |
| 479 | "begin": "\\(", |
| 480 | "beginCaptures": { |
| 481 | "0": { |
| 482 | "name": "punctuation.section.parens.begin.c" |
| 483 | } |
| 484 | }, |
| 485 | "end": "\\)", |
| 486 | "endCaptures": { |
| 487 | "0": { |
| 488 | "name": "punctuation.section.parens.end.c" |
| 489 | } |
| 490 | }, |
| 491 | "name": "meta.parens.c", |
| 492 | "patterns": [ |
| 493 | { |
| 494 | "include": "$base" |
| 495 | } |
| 496 | ] |
| 497 | }, |
| 498 | "pragma-mark": { |
| 499 | "captures": { |
| 500 | "1": { |
| 501 | "name": "meta.preprocessor.c" |
| 502 | }, |
| 503 | "2": { |
| 504 | "name": "keyword.control.directive.pragma.pragma-mark.c" |
| 505 | }, |
| 506 | "3": { |
| 507 | "name": "punctuation.definition.directive.c" |
| 508 | }, |
| 509 | "4": { |
| 510 | "name": "meta.toc-list.pragma-mark.c" |
| 511 | } |
| 512 | }, |
| 513 | "match": "^\\s*(((#)\\s*pragma\\s+mark)\\s+(.*))", |
| 514 | "name": "meta.section" |
| 515 | }, |
| 516 | "preprocessor-rule-disabled": { |
| 517 | "begin": "^\\s*(((#)if)\\s+(0)\\b).*", |
| 518 | "beginCaptures": { |
| 519 | "1": { |
| 520 | "name": "meta.preprocessor.c" |
| 521 | }, |
| 522 | "2": { |
| 523 | "name": "keyword.control.directive.conditional.c" |
| 524 | }, |
| 525 | "3": { |
| 526 | "name": "punctuation.definition.directive.c" |
| 527 | }, |
| 528 | "4": { |
| 529 | "name": "constant.numeric.preprocessor.c" |
| 530 | } |
| 531 | }, |
| 532 | "end": "^\\s*(((#)\\s*endif)\\b)", |
| 533 | "endCaptures": { |
| 534 | "1": { |
| 535 | "name": "meta.preprocessor.c" |
| 536 | }, |
| 537 | "2": { |
| 538 | "name": "keyword.control.directive.conditional.c" |
| 539 | }, |
| 540 | "3": { |
| 541 | "name": "punctuation.definition.directive.c" |
| 542 | } |
| 543 | }, |
| 544 | "patterns": [ |
| 545 | { |
| 546 | "begin": "^\\s*(((#)\\s*else)\\b)", |
| 547 | "beginCaptures": { |
| 548 | "1": { |
| 549 | "name": "meta.preprocessor.c" |
| 550 | }, |
| 551 | "2": { |
| 552 | "name": "keyword.control.directive.conditional.c" |
| 553 | }, |
| 554 | "3": { |
| 555 | "name": "punctuation.definition.directive.c" |
| 556 | } |
| 557 | }, |
| 558 | "end": "(?=^\\s*#\\s*endif\\b)", |
| 559 | "patterns": [ |
| 560 | { |
| 561 | "include": "$base" |
| 562 | } |
| 563 | ] |
| 564 | }, |
| 565 | { |
| 566 | "begin": "\\G", |
| 567 | "end": "(?=^\\s*#\\s*(else|endif)\\b)", |
| 568 | "contentName": "comment.block.preprocessor.if-branch", |
| 569 | "patterns": [ |
| 570 | { |
| 571 | "include": "#disabled" |
| 572 | }, |
| 573 | { |
| 574 | "include": "#pragma-mark" |
| 575 | } |
| 576 | ] |
| 577 | } |
| 578 | ] |
| 579 | }, |
| 580 | "preprocessor-rule-disabled-block": { |
| 581 | "begin": "^\\s*(((#)if)\\s+(0)\\b).*", |
| 582 | "beginCaptures": { |
| 583 | "1": { |
| 584 | "name": "meta.preprocessor.c" |
| 585 | }, |
| 586 | "2": { |
| 587 | "name": "keyword.control.directive.conditional.c" |
| 588 | }, |
| 589 | "3": { |
| 590 | "name": "punctuation.definition.directive.c" |
| 591 | }, |
| 592 | "4": { |
| 593 | "name": "constant.numeric.preprocessor.c" |
| 594 | } |
| 595 | }, |
| 596 | "end": "^\\s*(((#)\\s*endif)\\b)", |
| 597 | "endCaptures": { |
| 598 | "1": { |
| 599 | "name": "meta.preprocessor.c" |
| 600 | }, |
| 601 | "2": { |
| 602 | "name": "keyword.control.directive.conditional.c" |
| 603 | }, |
| 604 | "3": { |
| 605 | "name": "punctuation.definition.directive.c" |
| 606 | } |
| 607 | }, |
| 608 | "patterns": [ |
| 609 | { |
| 610 | "begin": "^\\s*(((#)\\s*else\\b))", |
| 611 | "beginCaptures": { |
| 612 | "1": { |
| 613 | "name": "meta.preprocessor.c" |
| 614 | }, |
| 615 | "2": { |
| 616 | "name": "keyword.control.directive.conditional.c" |
| 617 | }, |
| 618 | "3": { |
| 619 | "name": "punctuation.definition.directive.c" |
| 620 | } |
| 621 | }, |
| 622 | "end": "(?=^\\s*#\\s*endif\\b)", |
| 623 | "patterns": [ |
| 624 | { |
| 625 | "include": "#block_innards" |
| 626 | } |
| 627 | ] |
| 628 | }, |
| 629 | { |
| 630 | "begin": "\\G", |
| 631 | "end": "(?=^\\s*#\\s*(else|endif)\\b)", |
| 632 | "contentName": "comment.block.preprocessor.if-branch.in-block", |
| 633 | "patterns": [ |
| 634 | { |
| 635 | "include": "#disabled" |
| 636 | }, |
| 637 | { |
| 638 | "include": "#pragma-mark" |
| 639 | } |
| 640 | ] |
| 641 | } |
| 642 | ] |
| 643 | }, |
| 644 | "preprocessor-rule-enabled": { |
| 645 | "begin": "^\\s*(((#)if)\\s+(0*1)\\b)", |
| 646 | "beginCaptures": { |
| 647 | "1": { |
| 648 | "name": "meta.preprocessor.c" |
| 649 | }, |
| 650 | "2": { |
| 651 | "name": "keyword.control.directive.conditional.c" |
| 652 | }, |
| 653 | "3": { |
| 654 | "name": "punctuation.definition.directive.c" |
| 655 | }, |
| 656 | "4": { |
| 657 | "name": "constant.numeric.preprocessor.c" |
| 658 | } |
| 659 | }, |
| 660 | "end": "^\\s*(((#)\\s*endif)\\b)", |
| 661 | "endCaptures": { |
| 662 | "1": { |
| 663 | "name": "meta.preprocessor.c" |
| 664 | }, |
| 665 | "2": { |
| 666 | "name": "keyword.control.directive.conditional.c" |
| 667 | }, |
| 668 | "3": { |
| 669 | "name": "punctuation.definition.directive.c" |
| 670 | } |
| 671 | }, |
| 672 | "patterns": [ |
| 673 | { |
| 674 | "begin": "^\\s*(((#)\\s*else)\\b).*", |
| 675 | "beginCaptures": { |
| 676 | "1": { |
| 677 | "name": "meta.preprocessor.c" |
| 678 | }, |
| 679 | "2": { |
| 680 | "name": "keyword.control.directive.conditional.c" |
| 681 | }, |
| 682 | "3": { |
| 683 | "name": "punctuation.definition.directive.c" |
| 684 | } |
| 685 | }, |
| 686 | "contentName": "comment.block.preprocessor.else-branch", |
| 687 | "end": "(?=^\\s*#\\s*endif\\b)", |
| 688 | "patterns": [ |
| 689 | { |
| 690 | "include": "#disabled" |
| 691 | }, |
| 692 | { |
| 693 | "include": "#pragma-mark" |
| 694 | } |
| 695 | ] |
| 696 | }, |
| 697 | { |
| 698 | "begin": "\\G", |
| 699 | "end": "(?=^\\s*#\\s*(else|endif)\\b)", |
| 700 | "patterns": [ |
| 701 | { |
| 702 | "include": "$base" |
| 703 | } |
| 704 | ] |
| 705 | } |
| 706 | ] |
| 707 | }, |
| 708 | "preprocessor-rule-enabled-block": { |
| 709 | "begin": "^\\s*(((#)if)\\s+(0*1)\\b)", |
| 710 | "beginCaptures": { |
| 711 | "1": { |
| 712 | "name": "meta.preprocessor.c" |
| 713 | }, |
| 714 | "2": { |
| 715 | "name": "keyword.control.directive.conditional.c" |
| 716 | }, |
| 717 | "3": { |
| 718 | "name": "punctuation.definition.directive.c" |
| 719 | }, |
| 720 | "4": { |
| 721 | "name": "constant.numeric.preprocessor.c" |
| 722 | } |
| 723 | }, |
| 724 | "end": "^\\s*(((#)\\s*endif)\\b)", |
| 725 | "endCaptures": { |
| 726 | "1": { |
| 727 | "name": "meta.preprocessor.c" |
| 728 | }, |
| 729 | "2": { |
| 730 | "name": "keyword.control.directive.conditional.c" |
| 731 | }, |
| 732 | "3": { |
| 733 | "name": "punctuation.definition.directive.c" |
| 734 | } |
| 735 | }, |
| 736 | "patterns": [ |
| 737 | { |
| 738 | "begin": "^\\s*(((#)\\s*else)\\b).*", |
| 739 | "beginCaptures": { |
| 740 | "1": { |
| 741 | "name": "meta.preprocessor.c" |
| 742 | }, |
| 743 | "2": { |
| 744 | "name": "keyword.control.directive.conditional.c" |
| 745 | }, |
| 746 | "3": { |
| 747 | "name": "punctuation.definition.directive.c" |
| 748 | } |
| 749 | }, |
| 750 | "contentName": "comment.block.preprocessor.else-branch.in-block", |
| 751 | "end": "(?=^\\s*#\\s*endif\\b)", |
| 752 | "patterns": [ |
| 753 | { |
| 754 | "include": "#disabled" |
| 755 | }, |
| 756 | { |
| 757 | "include": "#pragma-mark" |
| 758 | } |
| 759 | ] |
| 760 | }, |
| 761 | { |
| 762 | "begin": "\\G", |
| 763 | "end": "(?=^\\s*#\\s*(else|endif)\\b)", |
| 764 | "patterns": [ |
| 765 | { |
| 766 | "include": "#block_innards" |
| 767 | } |
| 768 | ] |
| 769 | } |
| 770 | ] |
| 771 | }, |
| 772 | "preprocessor-rule-other": { |
| 773 | "begin": "^\\s*(((#)\\s*if(n?def)?)\\b.*?(?:(?=(?://|/\\*))|$))", |
| 774 | "beginCaptures": { |
| 775 | "1": { |
| 776 | "name": "meta.preprocessor.c" |
| 777 | }, |
| 778 | "2": { |
| 779 | "name": "keyword.control.directive.conditional.c" |
| 780 | }, |
| 781 | "3": { |
| 782 | "name": "punctuation.definition.directive.c" |
| 783 | } |
| 784 | }, |
| 785 | "end": "^\\s*(((#)\\s*(endif))\\b)", |
| 786 | "endCaptures": { |
| 787 | "1": { |
| 788 | "name": "meta.preprocessor.c" |
| 789 | }, |
| 790 | "2": { |
| 791 | "name": "keyword.control.directive.conditional.c" |
| 792 | }, |
| 793 | "3": { |
| 794 | "name": "punctuation.definition.directive.c" |
| 795 | } |
| 796 | }, |
| 797 | "patterns": [ |
| 798 | { |
| 799 | "include": "$base" |
| 800 | } |
| 801 | ] |
| 802 | }, |
| 803 | "preprocessor-rule-other-block": { |
| 804 | "begin": "^\\s*(((#)\\s*if(n?def)?)\\b.*?(?:(?=(?://|/\\*))|$))", |
| 805 | "beginCaptures": { |
| 806 | "1": { |
| 807 | "name": "meta.preprocessor.c" |
| 808 | }, |
| 809 | "2": { |
| 810 | "name": "keyword.control.directive.conditional.c" |
| 811 | }, |
| 812 | "3": { |
| 813 | "name": "punctuation.definition.directive.c" |
| 814 | } |
| 815 | }, |
| 816 | "end": "^\\s*(((#)\\s*endif)\\b)", |
| 817 | "endCaptures": { |
| 818 | "1": { |
| 819 | "name": "meta.preprocessor.c" |
| 820 | }, |
| 821 | "2": { |
| 822 | "name": "keyword.control.directive.conditional.c" |
| 823 | }, |
| 824 | "3": { |
| 825 | "name": "punctuation.definition.directive.c" |
| 826 | } |
| 827 | }, |
| 828 | "patterns": [ |
| 829 | { |
| 830 | "include": "#block_innards" |
| 831 | } |
| 832 | ] |
| 833 | }, |
| 834 | "operators": { |
| 835 | "patterns": [ |
| 836 | { |
| 837 | "match": "(?<![\\w$])(sizeof)(?![\\w$])", |
| 838 | "name": "keyword.operator.sizeof.c" |
| 839 | }, |
| 840 | { |
| 841 | "match": "--", |
| 842 | "name": "keyword.operator.decrement.c" |
| 843 | }, |
| 844 | { |
| 845 | "match": "\\+\\+", |
| 846 | "name": "keyword.operator.increment.c" |
| 847 | }, |
| 848 | { |
| 849 | "match": "%=|\\+=|-=|\\*=|(?<!\\()/=", |
| 850 | "name": "keyword.operator.assignment.compound.c" |
| 851 | }, |
| 852 | { |
| 853 | "match": "&=|\\^=|<<=|>>=|\\|=", |
| 854 | "name": "keyword.operator.assignment.compound.bitwise.c" |
| 855 | }, |
| 856 | { |
| 857 | "match": "<<|>>", |
| 858 | "name": "keyword.operator.bitwise.shift.c" |
| 859 | }, |
| 860 | { |
| 861 | "match": "!=|<=|>=|==|<|>", |
| 862 | "name": "keyword.operator.comparison.c" |
| 863 | }, |
| 864 | { |
| 865 | "match": "&&|!|\\|\\|", |
| 866 | "name": "keyword.operator.logical.c" |
| 867 | }, |
| 868 | { |
| 869 | "match": "&|\\||\\^|~", |
| 870 | "name": "keyword.operator.c" |
| 871 | }, |
| 872 | { |
| 873 | "match": "=", |
| 874 | "name": "keyword.operator.assignment.c" |
| 875 | }, |
| 876 | { |
| 877 | "match": "%|\\*|/|-|\\+", |
| 878 | "name": "keyword.operator.c" |
| 879 | }, |
| 880 | { |
| 881 | "begin": "\\?", |
| 882 | "beginCaptures": { |
| 883 | "0": { |
| 884 | "name": "keyword.operator.ternary.c" |
| 885 | } |
| 886 | }, |
| 887 | "end": ":", |
| 888 | "endCaptures": { |
| 889 | "0": { |
| 890 | "name": "keyword.operator.ternary.c" |
| 891 | } |
| 892 | }, |
| 893 | "patterns": [ |
| 894 | { |
| 895 | "include": "$self" |
| 896 | } |
| 897 | ] |
| 898 | } |
| 899 | ] |
| 900 | }, |
| 901 | "strings": { |
| 902 | "patterns": [ |
| 903 | { |
| 904 | "begin": "\"", |
| 905 | "beginCaptures": { |
| 906 | "0": { |
| 907 | "name": "punctuation.definition.string.begin.c" |
| 908 | } |
| 909 | }, |
| 910 | "end": "\"", |
| 911 | "endCaptures": { |
| 912 | "0": { |
| 913 | "name": "punctuation.definition.string.end.c" |
| 914 | } |
| 915 | }, |
| 916 | "name": "string.quoted.double.c", |
| 917 | "patterns": [ |
| 918 | { |
| 919 | "include": "#string_escaped_char" |
| 920 | }, |
| 921 | { |
| 922 | "include": "#string_placeholder" |
| 923 | }, |
| 924 | { |
| 925 | "include": "#line_continuation_character" |
| 926 | } |
| 927 | ] |
| 928 | }, |
| 929 | { |
| 930 | "begin": "'", |
| 931 | "beginCaptures": { |
| 932 | "0": { |
| 933 | "name": "punctuation.definition.string.begin.c" |
| 934 | } |
| 935 | }, |
| 936 | "end": "'", |
| 937 | "endCaptures": { |
| 938 | "0": { |
| 939 | "name": "punctuation.definition.string.end.c" |
| 940 | } |
| 941 | }, |
| 942 | "name": "string.quoted.single.c", |
| 943 | "patterns": [ |
| 944 | { |
| 945 | "include": "#string_escaped_char" |
| 946 | }, |
| 947 | { |
| 948 | "include": "#line_continuation_character" |
| 949 | } |
| 950 | ] |
| 951 | } |
| 952 | ] |
| 953 | }, |
| 954 | "string_escaped_char": { |
| 955 | "patterns": [ |
| 956 | { |
| 957 | "match": "(?x)\\\\ (\n\\\\ |\n[abefnprtv'\"?] |\n[0-3]\\d{,2} |\n[4-7]\\d? |\nx[a-fA-F0-9]{,2} |\nu[a-fA-F0-9]{,4} |\nU[a-fA-F0-9]{,8} )", |
| 958 | "name": "constant.character.escape.c" |
| 959 | }, |
| 960 | { |
| 961 | "match": "\\\\.", |
| 962 | "name": "invalid.illegal.unknown-escape.c" |
| 963 | } |
| 964 | ] |
| 965 | }, |
| 966 | "string_placeholder": { |
| 967 | "patterns": [ |
| 968 | { |
| 969 | "match": "(?x) %\n(\\d+\\$)? # field (argument #)\n[#0\\- +']* # flags\n[,;:_]? # separator character (AltiVec)\n((-?\\d+)|\\*(-?\\d+\\$)?)? # minimum field width\n(\\.((-?\\d+)|\\*(-?\\d+\\$)?)?)? # precision\n(hh|h|ll|l|j|t|z|q|L|vh|vl|v|hv|hl)? # length modifier\n[diouxXDOUeEfFgGaACcSspn%] # conversion type", |
| 970 | "name": "constant.other.placeholder.c" |
| 971 | }, |
| 972 | { |
| 973 | "match": "%", |
| 974 | "name": "invalid.illegal.placeholder.c" |
| 975 | } |
| 976 | ] |
| 977 | } |
| 978 | }, |
| 979 | "version": "https://github.com/atom/language-c/commit/2a5fafe1d86f690b5ab2c877cea2fc6a598e001a" |
| 980 | } |