| 1 | { |
| 2 | "scopeName": "source.c", |
| 3 | "fileTypes": ["c", "h.in"], |
| 4 | "firstLineMatch": "(?i)-\\*-[^*]*(Mode:\\s*)?C(\\s*;.*?)?\\s*-\\*-", |
| 5 | "name": "C", |
| 6 | "patterns": [ |
| 7 | { |
| 8 | "include": "#preprocessor-rule-enabled" |
| 9 | }, |
| 10 | { |
| 11 | "include": "#preprocessor-rule-disabled" |
| 12 | }, |
| 13 | { |
| 14 | "include": "#preprocessor-rule-other" |
| 15 | }, |
| 16 | { |
| 17 | "include": "#comments" |
| 18 | }, |
| 19 | { |
| 20 | "match": "\\b(break|case|continue|default|do|else|for|goto|if|_Pragma|return|switch|while)\\b", |
| 21 | "name": "keyword.control.c" |
| 22 | }, |
| 23 | { |
| 24 | "match": "\\b(asm|__asm__|auto|bool|_Bool|char|_Complex|double|enum|float|_Imaginary|int|long|short|signed|struct|typedef|union|unsigned|void)\\b", |
| 25 | "name": "storage.type.c" |
| 26 | }, |
| 27 | { |
| 28 | "match": "\\b(const|extern|register|restrict|static|volatile|inline)\\b", |
| 29 | "name": "storage.modifier.c" |
| 30 | }, |
| 31 | { |
| 32 | "match": "\\bk[A-Z]\\w*\\b", |
| 33 | "name": "constant.other.variable.mac-classic.c" |
| 34 | }, |
| 35 | { |
| 36 | "match": "\\bg[A-Z]\\w*\\b", |
| 37 | "name": "variable.other.readwrite.global.mac-classic.c" |
| 38 | }, |
| 39 | { |
| 40 | "match": "\\bs[A-Z]\\w*\\b", |
| 41 | "name": "variable.other.readwrite.static.mac-classic.c" |
| 42 | }, |
| 43 | { |
| 44 | "match": "\\b(NULL|true|false|TRUE|FALSE)\\b", |
| 45 | "name": "constant.language.c" |
| 46 | }, |
| 47 | { |
| 48 | "include": "#operators" |
| 49 | }, |
| 50 | { |
| 51 | "include": "#numbers" |
| 52 | }, |
| 53 | { |
| 54 | "include": "#strings" |
| 55 | }, |
| 56 | { |
| 57 | "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)?", |
| 58 | "beginCaptures": { |
| 59 | "1": { |
| 60 | "name": "keyword.control.directive.define.c" |
| 61 | }, |
| 62 | "2": { |
| 63 | "name": "punctuation.definition.directive.c" |
| 64 | }, |
| 65 | "3": { |
| 66 | "name": "entity.name.function.preprocessor.c" |
| 67 | }, |
| 68 | "5": { |
| 69 | "name": "punctuation.definition.parameters.begin.c" |
| 70 | }, |
| 71 | "6": { |
| 72 | "name": "variable.parameter.preprocessor.c" |
| 73 | }, |
| 74 | "8": { |
| 75 | "name": "punctuation.separator.parameters.c" |
| 76 | }, |
| 77 | "9": { |
| 78 | "name": "punctuation.definition.parameters.end.c" |
| 79 | } |
| 80 | }, |
| 81 | "end": "(?=(?://|/\\*))|(?<!\\\\)(?=\\n)", |
| 82 | "name": "meta.preprocessor.macro.c", |
| 83 | "patterns": [ |
| 84 | { |
| 85 | "include": "$base" |
| 86 | } |
| 87 | ] |
| 88 | }, |
| 89 | { |
| 90 | "begin": "^\\s*((#)\\s*(error|warning))\\b", |
| 91 | "captures": { |
| 92 | "1": { |
| 93 | "name": "keyword.control.directive.diagnostic.$3.c" |
| 94 | }, |
| 95 | "2": { |
| 96 | "name": "punctuation.definition.directive.c" |
| 97 | } |
| 98 | }, |
| 99 | "end": "(?<!\\\\)(?=\\n)", |
| 100 | "name": "meta.preprocessor.diagnostic.c", |
| 101 | "patterns": [ |
| 102 | { |
| 103 | "include": "#line_continuation_character" |
| 104 | } |
| 105 | ] |
| 106 | }, |
| 107 | { |
| 108 | "begin": "^\\s*((#)\\s*(include|import))\\b\\s*", |
| 109 | "beginCaptures": { |
| 110 | "1": { |
| 111 | "name": "keyword.control.directive.$3.c" |
| 112 | }, |
| 113 | "2": { |
| 114 | "name": "punctuation.definition.directive.c" |
| 115 | } |
| 116 | }, |
| 117 | "end": "(?=(?://|/\\*))|(?<!\\\\)(?=\\n)", |
| 118 | "name": "meta.preprocessor.include.c", |
| 119 | "patterns": [ |
| 120 | { |
| 121 | "include": "#line_continuation_character" |
| 122 | }, |
| 123 | { |
| 124 | "begin": "\"", |
| 125 | "beginCaptures": { |
| 126 | "0": { |
| 127 | "name": "punctuation.definition.string.begin.c" |
| 128 | } |
| 129 | }, |
| 130 | "end": "\"", |
| 131 | "endCaptures": { |
| 132 | "0": { |
| 133 | "name": "punctuation.definition.string.end.c" |
| 134 | } |
| 135 | }, |
| 136 | "name": "string.quoted.double.include.c" |
| 137 | }, |
| 138 | { |
| 139 | "begin": "<", |
| 140 | "beginCaptures": { |
| 141 | "0": { |
| 142 | "name": "punctuation.definition.string.begin.c" |
| 143 | } |
| 144 | }, |
| 145 | "end": ">", |
| 146 | "endCaptures": { |
| 147 | "0": { |
| 148 | "name": "punctuation.definition.string.end.c" |
| 149 | } |
| 150 | }, |
| 151 | "name": "string.quoted.other.lt-gt.include.c" |
| 152 | } |
| 153 | ] |
| 154 | }, |
| 155 | { |
| 156 | "include": "#pragma-mark" |
| 157 | }, |
| 158 | { |
| 159 | "begin": "^\\s*((#)\\s*line)\\b", |
| 160 | "beginCaptures": { |
| 161 | "1": { |
| 162 | "name": "keyword.control.directive.line.c" |
| 163 | }, |
| 164 | "2": { |
| 165 | "name": "punctuation.definition.directive.c" |
| 166 | } |
| 167 | }, |
| 168 | "end": "(?=(?://|/\\*))|(?<!\\\\)(?=\\n)", |
| 169 | "name": "meta.preprocessor.c", |
| 170 | "patterns": [ |
| 171 | { |
| 172 | "include": "#strings" |
| 173 | }, |
| 174 | { |
| 175 | "include": "#numbers" |
| 176 | }, |
| 177 | { |
| 178 | "include": "#line_continuation_character" |
| 179 | } |
| 180 | ] |
| 181 | }, |
| 182 | { |
| 183 | "begin": "^\\s*(?:((#)\\s*(?:elif|else|if|ifdef|ifndef))|((#)\\s*(pragma|undef)))\\b", |
| 184 | "beginCaptures": { |
| 185 | "1": { |
| 186 | "name": "keyword.control.directive.conditional.c" |
| 187 | }, |
| 188 | "2": { |
| 189 | "name": "punctuation.definition.directive.c" |
| 190 | }, |
| 191 | "3": { |
| 192 | "name": "keyword.control.directive.$5.c" |
| 193 | }, |
| 194 | "4": { |
| 195 | "name": "punctuation.definition.directive.c" |
| 196 | } |
| 197 | }, |
| 198 | "end": "(?=(?://|/\\*))|(?<!\\\\)(?=\\n)", |
| 199 | "name": "meta.preprocessor.c", |
| 200 | "patterns": [ |
| 201 | { |
| 202 | "include": "#line_continuation_character" |
| 203 | } |
| 204 | ] |
| 205 | }, |
| 206 | { |
| 207 | "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", |
| 208 | "name": "support.type.sys-types.c" |
| 209 | }, |
| 210 | { |
| 211 | "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", |
| 212 | "name": "support.type.pthread.c" |
| 213 | }, |
| 214 | { |
| 215 | "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", |
| 216 | "name": "support.type.stdint.c" |
| 217 | }, |
| 218 | { |
| 219 | "match": "\\b(noErr|kNilOptions|kInvalidID|kVariableLengthArray)\\b", |
| 220 | "name": "support.constant.mac-classic.c" |
| 221 | }, |
| 222 | { |
| 223 | "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", |
| 224 | "name": "support.type.mac-classic.c" |
| 225 | }, |
| 226 | { |
| 227 | "match": "\\b([A-Za-z0-9_]+_t)\\b", |
| 228 | "name": "support.type.posix-reserved.c" |
| 229 | }, |
| 230 | { |
| 231 | "include": "#block" |
| 232 | }, |
| 233 | { |
| 234 | "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*(?=\\()", |
| 235 | "beginCaptures": { |
| 236 | "1": { |
| 237 | "name": "punctuation.whitespace.function.leading.c" |
| 238 | }, |
| 239 | "3": { |
| 240 | "name": "entity.name.function.c" |
| 241 | }, |
| 242 | "4": { |
| 243 | "name": "punctuation.definition.parameters.c" |
| 244 | } |
| 245 | }, |
| 246 | "end": "(?<=\\})|(?=#)|(;)", |
| 247 | "name": "meta.function.c", |
| 248 | "patterns": [ |
| 249 | { |
| 250 | "include": "#comments" |
| 251 | }, |
| 252 | { |
| 253 | "include": "#parens" |
| 254 | }, |
| 255 | { |
| 256 | "match": "\\b(const)\\b", |
| 257 | "name": "storage.modifier.c" |
| 258 | }, |
| 259 | { |
| 260 | "include": "#block" |
| 261 | } |
| 262 | ] |
| 263 | }, |
| 264 | { |
| 265 | "include": "#line_continuation_character" |
| 266 | } |
| 267 | ], |
| 268 | "repository": { |
| 269 | "access": { |
| 270 | "captures": { |
| 271 | "2": { |
| 272 | "name": "punctuation.separator.dot-access.c" |
| 273 | }, |
| 274 | "3": { |
| 275 | "name": "punctuation.separator.pointer-access.c" |
| 276 | }, |
| 277 | "4": { |
| 278 | "name": "variable.other.member.c" |
| 279 | } |
| 280 | }, |
| 281 | "match": "((\\.)|(->))([a-zA-Z_][a-zA-Z_0-9]*)\\b(?!\\s*\\()" |
| 282 | }, |
| 283 | "block": { |
| 284 | "patterns": [ |
| 285 | { |
| 286 | "begin": "\\{", |
| 287 | "beginCaptures": { |
| 288 | "0": { |
| 289 | "name": "punctuation.section.block.begin.c" |
| 290 | } |
| 291 | }, |
| 292 | "end": "\\}|(?=\\s*#\\s*endif\\b)", |
| 293 | "endCaptures": { |
| 294 | "0": { |
| 295 | "name": "punctuation.section.block.end.c" |
| 296 | } |
| 297 | }, |
| 298 | "name": "meta.block.c", |
| 299 | "patterns": [ |
| 300 | { |
| 301 | "include": "#block_innards" |
| 302 | } |
| 303 | ] |
| 304 | } |
| 305 | ] |
| 306 | }, |
| 307 | "block_innards": { |
| 308 | "patterns": [ |
| 309 | { |
| 310 | "include": "#preprocessor-rule-enabled-block" |
| 311 | }, |
| 312 | { |
| 313 | "include": "#preprocessor-rule-disabled-block" |
| 314 | }, |
| 315 | { |
| 316 | "include": "#preprocessor-rule-other-block" |
| 317 | }, |
| 318 | { |
| 319 | "include": "#sizeof" |
| 320 | }, |
| 321 | { |
| 322 | "include": "#access" |
| 323 | }, |
| 324 | { |
| 325 | "include": "#libc" |
| 326 | }, |
| 327 | { |
| 328 | "include": "#c_function_call" |
| 329 | }, |
| 330 | { |
| 331 | "captures": { |
| 332 | "1": { |
| 333 | "name": "variable.other.c" |
| 334 | }, |
| 335 | "2": { |
| 336 | "name": "punctuation.definition.parameters.c" |
| 337 | } |
| 338 | }, |
| 339 | "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", |
| 340 | "name": "meta.initialization.c" |
| 341 | }, |
| 342 | { |
| 343 | "include": "#block" |
| 344 | }, |
| 345 | { |
| 346 | "include": "$base" |
| 347 | } |
| 348 | ] |
| 349 | }, |
| 350 | "c_function_call": { |
| 351 | "captures": { |
| 352 | "1": { |
| 353 | "name": "punctuation.whitespace.function-call.leading.c" |
| 354 | }, |
| 355 | "2": { |
| 356 | "name": "support.function.any-method.c" |
| 357 | }, |
| 358 | "4": { |
| 359 | "name": "punctuation.definition.parameters.c" |
| 360 | } |
| 361 | }, |
| 362 | "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", |
| 363 | "name": "meta.function-call.c" |
| 364 | }, |
| 365 | "comments": { |
| 366 | "patterns": [ |
| 367 | { |
| 368 | "captures": { |
| 369 | "1": { |
| 370 | "name": "meta.toc-list.banner.block.c" |
| 371 | } |
| 372 | }, |
| 373 | "match": "^/\\* =(\\s*.*?)\\s*= \\*/$\\n?", |
| 374 | "name": "comment.block.c" |
| 375 | }, |
| 376 | { |
| 377 | "begin": "/\\*", |
| 378 | "beginCaptures": { |
| 379 | "0": { |
| 380 | "name": "punctuation.definition.comment.begin.c" |
| 381 | } |
| 382 | }, |
| 383 | "end": "\\*/", |
| 384 | "endCaptures": { |
| 385 | "0": { |
| 386 | "name": "punctuation.definition.comment.end.c" |
| 387 | } |
| 388 | }, |
| 389 | "name": "comment.block.c" |
| 390 | }, |
| 391 | { |
| 392 | "match": "\\*/.*\\n", |
| 393 | "name": "invalid.illegal.stray-comment-end.c" |
| 394 | }, |
| 395 | { |
| 396 | "captures": { |
| 397 | "1": { |
| 398 | "name": "meta.toc-list.banner.line.c" |
| 399 | } |
| 400 | }, |
| 401 | "match": "^// =(\\s*.*?)\\s*=\\s*$\\n?", |
| 402 | "name": "comment.line.banner.cpp" |
| 403 | }, |
| 404 | { |
| 405 | "begin": "(^[ \\t]+)?(?=//)", |
| 406 | "beginCaptures": { |
| 407 | "1": { |
| 408 | "name": "punctuation.whitespace.comment.leading.cpp" |
| 409 | } |
| 410 | }, |
| 411 | "end": "(?!\\G)", |
| 412 | "patterns": [ |
| 413 | { |
| 414 | "begin": "//", |
| 415 | "beginCaptures": { |
| 416 | "0": { |
| 417 | "name": "punctuation.definition.comment.cpp" |
| 418 | } |
| 419 | }, |
| 420 | "end": "\\n", |
| 421 | "name": "comment.line.double-slash.cpp", |
| 422 | "patterns": [ |
| 423 | { |
| 424 | "include": "#line_continuation_character" |
| 425 | } |
| 426 | ] |
| 427 | } |
| 428 | ] |
| 429 | } |
| 430 | ] |
| 431 | }, |
| 432 | "disabled": { |
| 433 | "begin": "^\\s*#\\s*if(n?def)?\\b.*$", |
| 434 | "end": "^\\s*#\\s*endif\\b", |
| 435 | "patterns": [ |
| 436 | { |
| 437 | "include": "#disabled" |
| 438 | }, |
| 439 | { |
| 440 | "include": "#pragma-mark" |
| 441 | } |
| 442 | ] |
| 443 | }, |
| 444 | "libc": { |
| 445 | "captures": { |
| 446 | "1": { |
| 447 | "name": "punctuation.whitespace.support.function.leading.c" |
| 448 | }, |
| 449 | "2": { |
| 450 | "name": "support.function.C99.c" |
| 451 | } |
| 452 | }, |
| 453 | "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" |
| 454 | }, |
| 455 | "line_continuation_character": { |
| 456 | "patterns": [ |
| 457 | { |
| 458 | "match": "(\\\\)\\s*\\n", |
| 459 | "captures": { |
| 460 | "1": { |
| 461 | "name": "constant.character.escape.line-continuation.c" |
| 462 | } |
| 463 | } |
| 464 | } |
| 465 | ] |
| 466 | }, |
| 467 | "numbers": { |
| 468 | "patterns": [ |
| 469 | { |
| 470 | "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", |
| 471 | "name": "constant.numeric.c" |
| 472 | } |
| 473 | ] |
| 474 | }, |
| 475 | "parens": { |
| 476 | "begin": "\\(", |
| 477 | "beginCaptures": { |
| 478 | "0": { |
| 479 | "name": "punctuation.section.parens.begin.c" |
| 480 | } |
| 481 | }, |
| 482 | "end": "\\)", |
| 483 | "endCaptures": { |
| 484 | "0": { |
| 485 | "name": "punctuation.section.parens.end.c" |
| 486 | } |
| 487 | }, |
| 488 | "name": "meta.parens.c", |
| 489 | "patterns": [ |
| 490 | { |
| 491 | "include": "$base" |
| 492 | } |
| 493 | ] |
| 494 | }, |
| 495 | "pragma-mark": { |
| 496 | "captures": { |
| 497 | "1": { |
| 498 | "name": "meta.preprocessor.c" |
| 499 | }, |
| 500 | "2": { |
| 501 | "name": "keyword.control.directive.pragma.pragma-mark.c" |
| 502 | }, |
| 503 | "3": { |
| 504 | "name": "punctuation.definition.directive.c" |
| 505 | }, |
| 506 | "4": { |
| 507 | "name": "meta.toc-list.pragma-mark.c" |
| 508 | } |
| 509 | }, |
| 510 | "match": "^\\s*(((#)\\s*pragma\\s+mark)\\s+(.*))", |
| 511 | "name": "meta.section" |
| 512 | }, |
| 513 | "preprocessor-rule-disabled": { |
| 514 | "begin": "^\\s*(((#)if)\\s+(0)\\b).*", |
| 515 | "beginCaptures": { |
| 516 | "1": { |
| 517 | "name": "meta.preprocessor.c" |
| 518 | }, |
| 519 | "2": { |
| 520 | "name": "keyword.control.directive.conditional.c" |
| 521 | }, |
| 522 | "3": { |
| 523 | "name": "punctuation.definition.directive.c" |
| 524 | }, |
| 525 | "4": { |
| 526 | "name": "constant.numeric.preprocessor.c" |
| 527 | } |
| 528 | }, |
| 529 | "end": "^\\s*(((#)\\s*endif)\\b)", |
| 530 | "endCaptures": { |
| 531 | "1": { |
| 532 | "name": "meta.preprocessor.c" |
| 533 | }, |
| 534 | "2": { |
| 535 | "name": "keyword.control.directive.conditional.c" |
| 536 | }, |
| 537 | "3": { |
| 538 | "name": "punctuation.definition.directive.c" |
| 539 | } |
| 540 | }, |
| 541 | "patterns": [ |
| 542 | { |
| 543 | "begin": "^\\s*(((#)\\s*else)\\b)", |
| 544 | "beginCaptures": { |
| 545 | "1": { |
| 546 | "name": "meta.preprocessor.c" |
| 547 | }, |
| 548 | "2": { |
| 549 | "name": "keyword.control.directive.conditional.c" |
| 550 | }, |
| 551 | "3": { |
| 552 | "name": "punctuation.definition.directive.c" |
| 553 | } |
| 554 | }, |
| 555 | "end": "(?=^\\s*#\\s*endif\\b)", |
| 556 | "patterns": [ |
| 557 | { |
| 558 | "include": "$base" |
| 559 | } |
| 560 | ] |
| 561 | }, |
| 562 | { |
| 563 | "begin": "\\G", |
| 564 | "end": "(?=^\\s*#\\s*(else|endif)\\b)", |
| 565 | "contentName": "comment.block.preprocessor.if-branch", |
| 566 | "patterns": [ |
| 567 | { |
| 568 | "include": "#disabled" |
| 569 | }, |
| 570 | { |
| 571 | "include": "#pragma-mark" |
| 572 | } |
| 573 | ] |
| 574 | } |
| 575 | ] |
| 576 | }, |
| 577 | "preprocessor-rule-disabled-block": { |
| 578 | "begin": "^\\s*(((#)if)\\s+(0)\\b).*", |
| 579 | "beginCaptures": { |
| 580 | "1": { |
| 581 | "name": "meta.preprocessor.c" |
| 582 | }, |
| 583 | "2": { |
| 584 | "name": "keyword.control.directive.conditional.c" |
| 585 | }, |
| 586 | "3": { |
| 587 | "name": "punctuation.definition.directive.c" |
| 588 | }, |
| 589 | "4": { |
| 590 | "name": "constant.numeric.preprocessor.c" |
| 591 | } |
| 592 | }, |
| 593 | "end": "^\\s*(((#)\\s*endif)\\b)", |
| 594 | "endCaptures": { |
| 595 | "1": { |
| 596 | "name": "meta.preprocessor.c" |
| 597 | }, |
| 598 | "2": { |
| 599 | "name": "keyword.control.directive.conditional.c" |
| 600 | }, |
| 601 | "3": { |
| 602 | "name": "punctuation.definition.directive.c" |
| 603 | } |
| 604 | }, |
| 605 | "patterns": [ |
| 606 | { |
| 607 | "begin": "^\\s*(((#)\\s*else\\b))", |
| 608 | "beginCaptures": { |
| 609 | "1": { |
| 610 | "name": "meta.preprocessor.c" |
| 611 | }, |
| 612 | "2": { |
| 613 | "name": "keyword.control.directive.conditional.c" |
| 614 | }, |
| 615 | "3": { |
| 616 | "name": "punctuation.definition.directive.c" |
| 617 | } |
| 618 | }, |
| 619 | "end": "(?=^\\s*#\\s*endif\\b)", |
| 620 | "patterns": [ |
| 621 | { |
| 622 | "include": "#block_innards" |
| 623 | } |
| 624 | ] |
| 625 | }, |
| 626 | { |
| 627 | "begin": "\\G", |
| 628 | "end": "(?=^\\s*#\\s*(else|endif)\\b)", |
| 629 | "contentName": "comment.block.preprocessor.if-branch.in-block", |
| 630 | "patterns": [ |
| 631 | { |
| 632 | "include": "#disabled" |
| 633 | }, |
| 634 | { |
| 635 | "include": "#pragma-mark" |
| 636 | } |
| 637 | ] |
| 638 | } |
| 639 | ] |
| 640 | }, |
| 641 | "preprocessor-rule-enabled": { |
| 642 | "begin": "^\\s*(((#)if)\\s+(0*1)\\b)", |
| 643 | "beginCaptures": { |
| 644 | "1": { |
| 645 | "name": "meta.preprocessor.c" |
| 646 | }, |
| 647 | "2": { |
| 648 | "name": "keyword.control.directive.conditional.c" |
| 649 | }, |
| 650 | "3": { |
| 651 | "name": "punctuation.definition.directive.c" |
| 652 | }, |
| 653 | "4": { |
| 654 | "name": "constant.numeric.preprocessor.c" |
| 655 | } |
| 656 | }, |
| 657 | "end": "^\\s*(((#)\\s*endif)\\b)", |
| 658 | "endCaptures": { |
| 659 | "1": { |
| 660 | "name": "meta.preprocessor.c" |
| 661 | }, |
| 662 | "2": { |
| 663 | "name": "keyword.control.directive.conditional.c" |
| 664 | }, |
| 665 | "3": { |
| 666 | "name": "punctuation.definition.directive.c" |
| 667 | } |
| 668 | }, |
| 669 | "patterns": [ |
| 670 | { |
| 671 | "begin": "^\\s*(((#)\\s*else)\\b).*", |
| 672 | "beginCaptures": { |
| 673 | "1": { |
| 674 | "name": "meta.preprocessor.c" |
| 675 | }, |
| 676 | "2": { |
| 677 | "name": "keyword.control.directive.conditional.c" |
| 678 | }, |
| 679 | "3": { |
| 680 | "name": "punctuation.definition.directive.c" |
| 681 | } |
| 682 | }, |
| 683 | "contentName": "comment.block.preprocessor.else-branch", |
| 684 | "end": "(?=^\\s*#\\s*endif\\b)", |
| 685 | "patterns": [ |
| 686 | { |
| 687 | "include": "#disabled" |
| 688 | }, |
| 689 | { |
| 690 | "include": "#pragma-mark" |
| 691 | } |
| 692 | ] |
| 693 | }, |
| 694 | { |
| 695 | "begin": "\\G", |
| 696 | "end": "(?=^\\s*#\\s*(else|endif)\\b)", |
| 697 | "patterns": [ |
| 698 | { |
| 699 | "include": "$base" |
| 700 | } |
| 701 | ] |
| 702 | } |
| 703 | ] |
| 704 | }, |
| 705 | "preprocessor-rule-enabled-block": { |
| 706 | "begin": "^\\s*(((#)if)\\s+(0*1)\\b)", |
| 707 | "beginCaptures": { |
| 708 | "1": { |
| 709 | "name": "meta.preprocessor.c" |
| 710 | }, |
| 711 | "2": { |
| 712 | "name": "keyword.control.directive.conditional.c" |
| 713 | }, |
| 714 | "3": { |
| 715 | "name": "punctuation.definition.directive.c" |
| 716 | }, |
| 717 | "4": { |
| 718 | "name": "constant.numeric.preprocessor.c" |
| 719 | } |
| 720 | }, |
| 721 | "end": "^\\s*(((#)\\s*endif)\\b)", |
| 722 | "endCaptures": { |
| 723 | "1": { |
| 724 | "name": "meta.preprocessor.c" |
| 725 | }, |
| 726 | "2": { |
| 727 | "name": "keyword.control.directive.conditional.c" |
| 728 | }, |
| 729 | "3": { |
| 730 | "name": "punctuation.definition.directive.c" |
| 731 | } |
| 732 | }, |
| 733 | "patterns": [ |
| 734 | { |
| 735 | "begin": "^\\s*(((#)\\s*else)\\b).*", |
| 736 | "beginCaptures": { |
| 737 | "1": { |
| 738 | "name": "meta.preprocessor.c" |
| 739 | }, |
| 740 | "2": { |
| 741 | "name": "keyword.control.directive.conditional.c" |
| 742 | }, |
| 743 | "3": { |
| 744 | "name": "punctuation.definition.directive.c" |
| 745 | } |
| 746 | }, |
| 747 | "contentName": "comment.block.preprocessor.else-branch.in-block", |
| 748 | "end": "(?=^\\s*#\\s*endif\\b)", |
| 749 | "patterns": [ |
| 750 | { |
| 751 | "include": "#disabled" |
| 752 | }, |
| 753 | { |
| 754 | "include": "#pragma-mark" |
| 755 | } |
| 756 | ] |
| 757 | }, |
| 758 | { |
| 759 | "begin": "\\G", |
| 760 | "end": "(?=^\\s*#\\s*(else|endif)\\b)", |
| 761 | "patterns": [ |
| 762 | { |
| 763 | "include": "#block_innards" |
| 764 | } |
| 765 | ] |
| 766 | } |
| 767 | ] |
| 768 | }, |
| 769 | "preprocessor-rule-other": { |
| 770 | "begin": "^\\s*(((#)\\s*if(n?def)?)\\b.*?(?:(?=(?://|/\\*))|$))", |
| 771 | "beginCaptures": { |
| 772 | "1": { |
| 773 | "name": "meta.preprocessor.c" |
| 774 | }, |
| 775 | "2": { |
| 776 | "name": "keyword.control.directive.conditional.c" |
| 777 | }, |
| 778 | "3": { |
| 779 | "name": "punctuation.definition.directive.c" |
| 780 | } |
| 781 | }, |
| 782 | "end": "^\\s*(((#)\\s*(endif))\\b)", |
| 783 | "endCaptures": { |
| 784 | "1": { |
| 785 | "name": "meta.preprocessor.c" |
| 786 | }, |
| 787 | "2": { |
| 788 | "name": "keyword.control.directive.conditional.c" |
| 789 | }, |
| 790 | "3": { |
| 791 | "name": "punctuation.definition.directive.c" |
| 792 | } |
| 793 | }, |
| 794 | "patterns": [ |
| 795 | { |
| 796 | "include": "$base" |
| 797 | } |
| 798 | ] |
| 799 | }, |
| 800 | "preprocessor-rule-other-block": { |
| 801 | "begin": "^\\s*(((#)\\s*if(n?def)?)\\b.*?(?:(?=(?://|/\\*))|$))", |
| 802 | "beginCaptures": { |
| 803 | "1": { |
| 804 | "name": "meta.preprocessor.c" |
| 805 | }, |
| 806 | "2": { |
| 807 | "name": "keyword.control.directive.conditional.c" |
| 808 | }, |
| 809 | "3": { |
| 810 | "name": "punctuation.definition.directive.c" |
| 811 | } |
| 812 | }, |
| 813 | "end": "^\\s*(((#)\\s*endif)\\b)", |
| 814 | "endCaptures": { |
| 815 | "1": { |
| 816 | "name": "meta.preprocessor.c" |
| 817 | }, |
| 818 | "2": { |
| 819 | "name": "keyword.control.directive.conditional.c" |
| 820 | }, |
| 821 | "3": { |
| 822 | "name": "punctuation.definition.directive.c" |
| 823 | } |
| 824 | }, |
| 825 | "patterns": [ |
| 826 | { |
| 827 | "include": "#block_innards" |
| 828 | } |
| 829 | ] |
| 830 | }, |
| 831 | "operators": { |
| 832 | "patterns": [ |
| 833 | { |
| 834 | "match": "(?<![\\w$])(sizeof)(?![\\w$])", |
| 835 | "name": "keyword.operator.sizeof.c" |
| 836 | }, |
| 837 | { |
| 838 | "match": "--", |
| 839 | "name": "keyword.operator.decrement.c" |
| 840 | }, |
| 841 | { |
| 842 | "match": "\\+\\+", |
| 843 | "name": "keyword.operator.increment.c" |
| 844 | }, |
| 845 | { |
| 846 | "match": "%=|\\+=|-=|\\*=|(?<!\\()/=", |
| 847 | "name": "keyword.operator.assignment.compound.c" |
| 848 | }, |
| 849 | { |
| 850 | "match": "&=|\\^=|<<=|>>=|\\|=", |
| 851 | "name": "keyword.operator.assignment.compound.bitwise.c" |
| 852 | }, |
| 853 | { |
| 854 | "match": "<<|>>", |
| 855 | "name": "keyword.operator.bitwise.shift.c" |
| 856 | }, |
| 857 | { |
| 858 | "match": "!=|<=|>=|==|<|>", |
| 859 | "name": "keyword.operator.comparison.c" |
| 860 | }, |
| 861 | { |
| 862 | "match": "&&|!|\\|\\|", |
| 863 | "name": "keyword.operator.logical.c" |
| 864 | }, |
| 865 | { |
| 866 | "match": "&|\\||\\^|~", |
| 867 | "name": "keyword.operator.c" |
| 868 | }, |
| 869 | { |
| 870 | "match": "=", |
| 871 | "name": "keyword.operator.assignment.c" |
| 872 | }, |
| 873 | { |
| 874 | "match": "%|\\*|/|-|\\+", |
| 875 | "name": "keyword.operator.c" |
| 876 | }, |
| 877 | { |
| 878 | "begin": "\\?", |
| 879 | "beginCaptures": { |
| 880 | "0": { |
| 881 | "name": "keyword.operator.ternary.c" |
| 882 | } |
| 883 | }, |
| 884 | "end": ":", |
| 885 | "endCaptures": { |
| 886 | "0": { |
| 887 | "name": "keyword.operator.ternary.c" |
| 888 | } |
| 889 | }, |
| 890 | "patterns": [ |
| 891 | { |
| 892 | "include": "$self" |
| 893 | } |
| 894 | ] |
| 895 | } |
| 896 | ] |
| 897 | }, |
| 898 | "strings": { |
| 899 | "patterns": [ |
| 900 | { |
| 901 | "begin": "\"", |
| 902 | "beginCaptures": { |
| 903 | "0": { |
| 904 | "name": "punctuation.definition.string.begin.c" |
| 905 | } |
| 906 | }, |
| 907 | "end": "\"", |
| 908 | "endCaptures": { |
| 909 | "0": { |
| 910 | "name": "punctuation.definition.string.end.c" |
| 911 | } |
| 912 | }, |
| 913 | "name": "string.quoted.double.c", |
| 914 | "patterns": [ |
| 915 | { |
| 916 | "include": "#string_escaped_char" |
| 917 | }, |
| 918 | { |
| 919 | "include": "#string_placeholder" |
| 920 | }, |
| 921 | { |
| 922 | "include": "#line_continuation_character" |
| 923 | } |
| 924 | ] |
| 925 | }, |
| 926 | { |
| 927 | "begin": "'", |
| 928 | "beginCaptures": { |
| 929 | "0": { |
| 930 | "name": "punctuation.definition.string.begin.c" |
| 931 | } |
| 932 | }, |
| 933 | "end": "'", |
| 934 | "endCaptures": { |
| 935 | "0": { |
| 936 | "name": "punctuation.definition.string.end.c" |
| 937 | } |
| 938 | }, |
| 939 | "name": "string.quoted.single.c", |
| 940 | "patterns": [ |
| 941 | { |
| 942 | "include": "#string_escaped_char" |
| 943 | }, |
| 944 | { |
| 945 | "include": "#line_continuation_character" |
| 946 | } |
| 947 | ] |
| 948 | } |
| 949 | ] |
| 950 | }, |
| 951 | "string_escaped_char": { |
| 952 | "patterns": [ |
| 953 | { |
| 954 | "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} )", |
| 955 | "name": "constant.character.escape.c" |
| 956 | }, |
| 957 | { |
| 958 | "match": "\\\\.", |
| 959 | "name": "invalid.illegal.unknown-escape.c" |
| 960 | } |
| 961 | ] |
| 962 | }, |
| 963 | "string_placeholder": { |
| 964 | "patterns": [ |
| 965 | { |
| 966 | "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", |
| 967 | "name": "constant.other.placeholder.c" |
| 968 | }, |
| 969 | { |
| 970 | "match": "%", |
| 971 | "name": "invalid.illegal.placeholder.c" |
| 972 | } |
| 973 | ] |
| 974 | } |
| 975 | }, |
| 976 | "version": "https://github.com/atom/language-c/commit/2a5fafe1d86f690b5ab2c877cea2fc6a598e001a" |
| 977 | } |