c.tmLanguage.json 55.1 KB
Newer Older
1
{
2
	"information_for_contributors": [
3
		"This file has been converted from https://github.com/jeff-hykin/cpp-textmate-grammar/blob/master//syntaxes/c.tmLanguage.json",
4 5 6
		"If you want to provide a fix or improvement, please create a pull request against the original repository.",
		"Once accepted there, we are happy to receive an update request."
	],
A
Alex Ross 已提交
7
	"version": "https://github.com/jeff-hykin/cpp-textmate-grammar/commit/d450ac8fb4bd1750389acfd88be341e1a91a02f3",
8
	"name": "C",
9
	"scopeName": "source.c",
10 11 12 13 14 15 16 17
	"patterns": [
		{
			"include": "#preprocessor-rule-enabled"
		},
		{
			"include": "#preprocessor-rule-disabled"
		},
		{
18
			"include": "#preprocessor-rule-conditional"
19 20 21 22 23 24 25 26 27
		},
		{
			"include": "#comments"
		},
		{
			"match": "\\b(break|case|continue|default|do|else|for|goto|if|_Pragma|return|switch|while)\\b",
			"name": "keyword.control.c"
		},
		{
28
			"include": "#storage_types"
29
		},
A
Alex Ross 已提交
30 31 32 33
		{
			"match": "typedef",
			"name": "keyword.other.typedef.c"
		},
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
		{
			"match": "\\b(const|extern|register|restrict|static|volatile|inline)\\b",
			"name": "storage.modifier.c"
		},
		{
			"match": "\\bk[A-Z]\\w*\\b",
			"name": "constant.other.variable.mac-classic.c"
		},
		{
			"match": "\\bg[A-Z]\\w*\\b",
			"name": "variable.other.readwrite.global.mac-classic.c"
		},
		{
			"match": "\\bs[A-Z]\\w*\\b",
			"name": "variable.other.readwrite.static.mac-classic.c"
		},
		{
			"match": "\\b(NULL|true|false|TRUE|FALSE)\\b",
			"name": "constant.language.c"
		},
		{
M
Martin Aeschlimann 已提交
55
			"include": "#operators"
56 57 58 59 60 61 62 63
		},
		{
			"include": "#numbers"
		},
		{
			"include": "#strings"
		},
		{
64
			"begin": "(?x)\n^\\s* ((\\#)\\s*define) \\s+\t# define\n((?<id>[a-zA-Z_$][\\w$]*))\t  # macro name\n(?:\n  (\\()\n\t(\n\t  \\s* \\g<id> \\s*\t\t # first argument\n\t  ((,) \\s* \\g<id> \\s*)*  # additional arguments\n\t  (?:\\.\\.\\.)?\t\t\t# varargs ellipsis?\n\t)\n  (\\))\n)?",
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
			"beginCaptures": {
				"1": {
					"name": "keyword.control.directive.define.c"
				},
				"2": {
					"name": "punctuation.definition.directive.c"
				},
				"3": {
					"name": "entity.name.function.preprocessor.c"
				},
				"5": {
					"name": "punctuation.definition.parameters.begin.c"
				},
				"6": {
					"name": "variable.parameter.preprocessor.c"
				},
				"8": {
					"name": "punctuation.separator.parameters.c"
				},
				"9": {
					"name": "punctuation.definition.parameters.end.c"
				}
			},
			"end": "(?=(?://|/\\*))|(?<!\\\\)(?=\\n)",
			"name": "meta.preprocessor.macro.c",
			"patterns": [
				{
92
					"include": "#preprocessor-rule-define-line-contents"
93 94 95 96
				}
			]
		},
		{
97 98
			"begin": "^\\s*((#)\\s*(error|warning))\\b\\s*",
			"beginCaptures": {
99 100 101 102 103 104 105
				"1": {
					"name": "keyword.control.directive.diagnostic.$3.c"
				},
				"2": {
					"name": "punctuation.definition.directive.c"
				}
			},
106
			"end": "(?<!\\\\)(?=\\n)",
107 108
			"name": "meta.preprocessor.diagnostic.c",
			"patterns": [
109
				{
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
					"begin": "\"",
					"beginCaptures": {
						"0": {
							"name": "punctuation.definition.string.begin.c"
						}
					},
					"end": "\"|(?<!\\\\)(?=\\s*\\n)",
					"endCaptures": {
						"0": {
							"name": "punctuation.definition.string.end.c"
						}
					},
					"name": "string.quoted.double.c",
					"patterns": [
						{
							"include": "#line_continuation_character"
						}
					]
128 129
				},
				{
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147
					"begin": "'",
					"beginCaptures": {
						"0": {
							"name": "punctuation.definition.string.begin.c"
						}
					},
					"end": "'|(?<!\\\\)(?=\\s*\\n)",
					"endCaptures": {
						"0": {
							"name": "punctuation.definition.string.end.c"
						}
					},
					"name": "string.quoted.single.c",
					"patterns": [
						{
							"include": "#line_continuation_character"
						}
					]
148
				},
149
				{
150 151 152 153 154 155 156 157 158 159 160
					"begin": "[^'\"]",
					"end": "(?<!\\\\)(?=\\s*\\n)",
					"name": "string.unquoted.single.c",
					"patterns": [
						{
							"include": "#line_continuation_character"
						},
						{
							"include": "#comments"
						}
					]
161 162 163 164
				}
			]
		},
		{
165
			"begin": "^\\s*((#)\\s*(include(?:_next)?|import))\\b\\s*",
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239
			"beginCaptures": {
				"1": {
					"name": "keyword.control.directive.$3.c"
				},
				"2": {
					"name": "punctuation.definition.directive.c"
				}
			},
			"end": "(?=(?://|/\\*))|(?<!\\\\)(?=\\n)",
			"name": "meta.preprocessor.include.c",
			"patterns": [
				{
					"include": "#line_continuation_character"
				},
				{
					"begin": "\"",
					"beginCaptures": {
						"0": {
							"name": "punctuation.definition.string.begin.c"
						}
					},
					"end": "\"",
					"endCaptures": {
						"0": {
							"name": "punctuation.definition.string.end.c"
						}
					},
					"name": "string.quoted.double.include.c"
				},
				{
					"begin": "<",
					"beginCaptures": {
						"0": {
							"name": "punctuation.definition.string.begin.c"
						}
					},
					"end": ">",
					"endCaptures": {
						"0": {
							"name": "punctuation.definition.string.end.c"
						}
					},
					"name": "string.quoted.other.lt-gt.include.c"
				}
			]
		},
		{
			"include": "#pragma-mark"
		},
		{
			"begin": "^\\s*((#)\\s*line)\\b",
			"beginCaptures": {
				"1": {
					"name": "keyword.control.directive.line.c"
				},
				"2": {
					"name": "punctuation.definition.directive.c"
				}
			},
			"end": "(?=(?://|/\\*))|(?<!\\\\)(?=\\n)",
			"name": "meta.preprocessor.c",
			"patterns": [
				{
					"include": "#strings"
				},
				{
					"include": "#numbers"
				},
				{
					"include": "#line_continuation_character"
				}
			]
		},
		{
240
			"begin": "^\\s*(?:((#)\\s*undef))\\b",
241 242
			"beginCaptures": {
				"1": {
243
					"name": "keyword.control.directive.undef.c"
244 245 246
				},
				"2": {
					"name": "punctuation.definition.directive.c"
247 248 249 250 251 252 253 254
				}
			},
			"end": "(?=(?://|/\\*))|(?<!\\\\)(?=\\n)",
			"name": "meta.preprocessor.c",
			"patterns": [
				{
					"match": "[a-zA-Z_$][\\w$]*",
					"name": "entity.name.function.preprocessor.c"
255
				},
256 257 258 259 260 261 262 263 264 265
				{
					"include": "#line_continuation_character"
				}
			]
		},
		{
			"begin": "^\\s*(?:((#)\\s*pragma))\\b",
			"beginCaptures": {
				"1": {
					"name": "keyword.control.directive.pragma.c"
266
				},
267
				"2": {
268 269 270 271
					"name": "punctuation.definition.directive.c"
				}
			},
			"end": "(?=(?://|/\\*))|(?<!\\\\)(?=\\n)",
272
			"name": "meta.preprocessor.pragma.c",
273
			"patterns": [
274 275 276 277 278 279 280 281 282 283
				{
					"include": "#strings"
				},
				{
					"match": "[a-zA-Z_$][\\w\\-$]*",
					"name": "entity.other.attribute-name.pragma.preprocessor.c"
				},
				{
					"include": "#numbers"
				},
284 285 286 287 288 289
				{
					"include": "#line_continuation_character"
				}
			]
		},
		{
290
			"match": "\\b(u_char|u_short|u_int|u_long|ushort|uint|u_quad_t|quad_t|qaddr_t|caddr_t|daddr_t|div_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",
291 292 293 294 295 296 297
			"name": "support.type.sys-types.c"
		},
		{
			"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",
			"name": "support.type.pthread.c"
		},
		{
M
Martin Aeschlimann 已提交
298
			"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",
299 300 301 302 303 304 305
			"name": "support.type.stdint.c"
		},
		{
			"match": "\\b(noErr|kNilOptions|kInvalidID|kVariableLengthArray)\\b",
			"name": "support.constant.mac-classic.c"
		},
		{
M
Martin Aeschlimann 已提交
306
			"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",
307 308 309 310 311 312 313 314 315 316
			"name": "support.type.mac-classic.c"
		},
		{
			"match": "\\b([A-Za-z0-9_]+_t)\\b",
			"name": "support.type.posix-reserved.c"
		},
		{
			"include": "#block"
		},
		{
317 318 319
			"include": "#parens"
		},
		{
320
			"name": "meta.function.c",
A
Alex Ross 已提交
321 322
			"begin": "(?<!\\w)(?!\\s*(?:not|compl|sizeof|not_eq|bitand|xor|bitor|and|or|and_eq|xor_eq|or_eq|alignof|alignas|_Alignof|_Alignas|while|for|do|if|else|goto|switch|return|break|case|continue|default|void|char|short|int|signed|unsigned|long|float|double|bool|_Bool|_Complex|_Imaginary|u_char|u_short|u_int|u_long|ushort|uint|u_quad_t|quad_t|qaddr_t|caddr_t|daddr_t|div_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|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|int8_t|int16_t|int32_t|int64_t|uint8_t|uint16_t|uint32_t|uint64_t|int_least8_t|int_least16_t|int_least32_t|int_least64_t|uint_least8_t|uint_least16_t|uint_least32_t|uint_least64_t|int_fast8_t|int_fast16_t|int_fast32_t|int_fast64_t|uint_fast8_t|uint_fast16_t|uint_fast32_t|uint_fast64_t|intptr_t|uintptr_t|intmax_t|intmax_t|uintmax_t|uintmax_t|NULL|true|false|memory_order|atomic_bool|atomic_char|atomic_schar|atomic_uchar|atomic_short|atomic_ushort|atomic_int|atomic_uint|atomic_long|atomic_ulong|atomic_llong|atomic_ullong|atomic_char16_t|atomic_char32_t|atomic_wchar_t|atomic_int_least8_t|atomic_uint_least8_t|atomic_int_least16_t|atomic_uint_least16_t|atomic_int_least32_t|atomic_uint_least32_t|atomic_int_least64_t|atomic_uint_least64_t|atomic_int_fast8_t|atomic_uint_fast8_t|atomic_int_fast16_t|atomic_uint_fast16_t|atomic_int_fast32_t|atomic_uint_fast32_t|atomic_int_fast64_t|atomic_uint_fast64_t|atomic_intptr_t|atomic_uintptr_t|atomic_size_t|atomic_ptrdiff_t|atomic_intmax_t|atomic_uintmax_t|struct|union|enum|typedef|auto|register|static|extern|thread_local|inline|_Noreturn|const|volatile|restrict|_Atomic)\\s*\\()(?=[a-zA-Z_]\\w*\\s*\\()",
			"end": "(?<=\\))",
323 324
			"patterns": [
				{
325
					"include": "#function-innards"
326 327 328 329 330
				}
			]
		},
		{
			"include": "#line_continuation_character"
331 332
		},
		{
333 334 335
			"name": "meta.bracket.square.access.c",
			"begin": "([a-zA-Z_][a-zA-Z_0-9]*|(?<=[\\]\\)]))?(\\[)(?!\\])",
			"beginCaptures": {
336
				"1": {
337
					"name": "variable.object.c"
338 339
				},
				"2": {
340 341 342 343 344 345
					"name": "punctuation.definition.begin.bracket.square.c"
				}
			},
			"end": "\\]",
			"endCaptures": {
				"0": {
346 347
					"name": "punctuation.definition.end.bracket.square.c"
				}
348 349 350 351 352 353 354 355 356 357
			},
			"patterns": [
				{
					"include": "#function-call-innards"
				}
			]
		},
		{
			"name": "storage.modifier.array.bracket.square.c",
			"match": "\\[\\s*\\]"
358 359 360 361 362 363 364 365
		},
		{
			"match": ";",
			"name": "punctuation.terminator.statement.c"
		},
		{
			"match": ",",
			"name": "punctuation.separator.delimiter.c"
366 367 368
		}
	],
	"repository": {
369
		"probably_a_parameter": {
A
Alex Ross 已提交
370
			"include": "#probably_a_parameter"
371
		},
A
Alex Ross 已提交
372 373 374
		"member_access": {
			"match": "((?:[a-zA-Z_]\\w*|(?<=\\]|\\)))\\s*)(?:((?:\\.\\*|\\.))|((?:->\\*|->)))((?:[a-zA-Z_]\\w*\\s*(?-mix:(?:(?:\\.\\*|\\.))|(?:(?:->\\*|->)))\\s*)*)\\s*(\\b(?!(?:void|char|short|int|signed|unsigned|long|float|double|bool|_Bool|_Complex|_Imaginary|u_char|u_short|u_int|u_long|ushort|uint|u_quad_t|quad_t|qaddr_t|caddr_t|daddr_t|div_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|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|int8_t|int16_t|int32_t|int64_t|uint8_t|uint16_t|uint32_t|uint64_t|int_least8_t|int_least16_t|int_least32_t|int_least64_t|uint_least8_t|uint_least16_t|uint_least32_t|uint_least64_t|int_fast8_t|int_fast16_t|int_fast32_t|int_fast64_t|uint_fast8_t|uint_fast16_t|uint_fast32_t|uint_fast64_t|intptr_t|uintptr_t|intmax_t|intmax_t|uintmax_t|uintmax_t|memory_order|atomic_bool|atomic_char|atomic_schar|atomic_uchar|atomic_short|atomic_ushort|atomic_int|atomic_uint|atomic_long|atomic_ulong|atomic_llong|atomic_ullong|atomic_char16_t|atomic_char32_t|atomic_wchar_t|atomic_int_least8_t|atomic_uint_least8_t|atomic_int_least16_t|atomic_uint_least16_t|atomic_int_least32_t|atomic_uint_least32_t|atomic_int_least64_t|atomic_uint_least64_t|atomic_int_fast8_t|atomic_uint_fast8_t|atomic_int_fast16_t|atomic_uint_fast16_t|atomic_int_fast32_t|atomic_uint_fast32_t|atomic_int_fast64_t|atomic_uint_fast64_t|atomic_intptr_t|atomic_uintptr_t|atomic_size_t|atomic_ptrdiff_t|atomic_intmax_t|atomic_uintmax_t))[a-zA-Z_]\\w*\\b(?!\\())",
			"captures": {
375
				"1": {
A
Alex Ross 已提交
376
					"name": "variable.other.object.access.c"
377 378
				},
				"2": {
A
Alex Ross 已提交
379
					"name": "punctuation.separator.dot-access.c"
380 381
				},
				"3": {
A
Alex Ross 已提交
382
					"name": "punctuation.separator.pointer-access.c"
383 384
				},
				"4": {
A
Alex Ross 已提交
385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406
					"patterns": [
						{
							"include": "#member_access"
						},
						{
							"include": "#method_access"
						},
						{
							"match": "((?:[a-zA-Z_]\\w*|(?<=\\]|\\)))\\s*)(?:((?:\\.\\*|\\.))|((?:->\\*|->)))",
							"captures": {
								"1": {
									"name": "variable.other.object.access.c"
								},
								"2": {
									"name": "punctuation.separator.dot-access.c"
								},
								"3": {
									"name": "punctuation.separator.pointer-access.c"
								}
							}
						}
					]
407
				},
A
Alex Ross 已提交
408 409
				"5": {
					"name": "variable.other.member.c"
410
				}
A
Alex Ross 已提交
411
			}
412
		},
A
Alex Ross 已提交
413 414 415
		"method_access": {
			"contentName": "meta.function-call.member",
			"begin": "((?:[a-zA-Z_]\\w*|(?<=\\]|\\)))\\s*)(?:((?:\\.\\*|\\.))|((?:->\\*|->)))((?:[a-zA-Z_]\\w*\\s*(?-mix:(?:(?:\\.\\*|\\.))|(?:(?:->\\*|->)))\\s*)*)\\s*([a-zA-Z_]\\w*)(\\()",
416 417
			"beginCaptures": {
				"1": {
A
Alex Ross 已提交
418
					"name": "variable.other.object.access.c"
419
				},
420 421 422 423 424 425 426
				"2": {
					"name": "punctuation.separator.dot-access.c"
				},
				"3": {
					"name": "punctuation.separator.pointer-access.c"
				},
				"4": {
427 428
					"patterns": [
						{
A
Alex Ross 已提交
429
							"include": "#member_access"
430 431
						},
						{
A
Alex Ross 已提交
432
							"include": "#method_access"
433 434
						},
						{
A
Alex Ross 已提交
435 436 437 438 439 440 441 442 443 444 445 446
							"match": "((?:[a-zA-Z_]\\w*|(?<=\\]|\\)))\\s*)(?:((?:\\.\\*|\\.))|((?:->\\*|->)))",
							"captures": {
								"1": {
									"name": "variable.other.object.access.c"
								},
								"2": {
									"name": "punctuation.separator.dot-access.c"
								},
								"3": {
									"name": "punctuation.separator.pointer-access.c"
								}
							}
447 448 449 450 451 452 453 454 455 456
						}
					]
				},
				"5": {
					"name": "entity.name.function.member.c"
				},
				"6": {
					"name": "punctuation.section.arguments.begin.bracket.round.function.member.c"
				}
			},
A
Alex Ross 已提交
457
			"end": "(\\))",
458
			"endCaptures": {
A
Alex Ross 已提交
459
				"1": {
460
					"name": "punctuation.section.arguments.end.bracket.round.function.member.c"
461 462
				}
			},
463 464 465 466 467 468
			"patterns": [
				{
					"include": "#function-call-innards"
				}
			]
		},
A
Alex Ross 已提交
469 470 471 472
		"access-method": {
			"name": "meta.function-call.member.c",
			"begin": "([a-zA-Z_][a-zA-Z_0-9]*|(?<=[\\]\\)]))\\s*(?:(\\.)|(->))((?:(?:[a-zA-Z_][a-zA-Z_0-9]*)\\s*(?:(?:\\.)|(?:->)))*)\\s*([a-zA-Z_][a-zA-Z_0-9]*)(\\()",
			"beginCaptures": {
473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492
				"1": {
					"name": "variable.object.c"
				},
				"2": {
					"name": "punctuation.separator.dot-access.c"
				},
				"3": {
					"name": "punctuation.separator.pointer-access.c"
				},
				"4": {
					"patterns": [
						{
							"match": "\\.",
							"name": "punctuation.separator.dot-access.c"
						},
						{
							"match": "->",
							"name": "punctuation.separator.pointer-access.c"
						},
						{
A
Alex Ross 已提交
493
							"match": "[a-zA-Z_][a-zA-Z_0-9]*",
494 495 496
							"name": "variable.object.c"
						},
						{
A
Alex Ross 已提交
497 498
							"name": "everything.else.c",
							"match": ".+"
499 500 501 502
						}
					]
				},
				"5": {
A
Alex Ross 已提交
503 504 505 506
					"name": "entity.name.function.member.c"
				},
				"6": {
					"name": "punctuation.section.arguments.begin.bracket.round.function.member.c"
507
				}
A
Alex Ross 已提交
508 509 510 511 512 513 514 515 516 517 518 519
			},
			"end": "\\)",
			"endCaptures": {
				"0": {
					"name": "punctuation.section.arguments.end.bracket.round.function.member.c"
				}
			},
			"patterns": [
				{
					"include": "#function-call-innards"
				}
			]
520 521 522 523
		},
		"block": {
			"patterns": [
				{
524
					"begin": "{",
525 526
					"beginCaptures": {
						"0": {
527
							"name": "punctuation.section.block.begin.bracket.curly.c"
528 529
						}
					},
530
					"end": "}|(?=\\s*#\\s*(?:elif|else|endif)\\b)",
531 532
					"endCaptures": {
						"0": {
533
							"name": "punctuation.section.block.end.bracket.curly.c"
534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553
						}
					},
					"name": "meta.block.c",
					"patterns": [
						{
							"include": "#block_innards"
						}
					]
				}
			]
		},
		"block_innards": {
			"patterns": [
				{
					"include": "#preprocessor-rule-enabled-block"
				},
				{
					"include": "#preprocessor-rule-disabled-block"
				},
				{
554
					"include": "#preprocessor-rule-conditional-block"
555 556
				},
				{
A
Alex Ross 已提交
557
					"include": "#method_access"
558 559
				},
				{
A
Alex Ross 已提交
560
					"include": "#member_access"
561 562 563 564 565
				},
				{
					"include": "#c_function_call"
				},
				{
566 567 568
					"name": "meta.initialization.c",
					"begin": "(?x)\n(?:\n  (?:\n\t(?=\\s)(?<!else|new|return)\n\t(?<=\\w) \\s+(and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq|alignof|alignas)  # 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",
					"beginCaptures": {
569 570 571 572
						"1": {
							"name": "variable.other.c"
						},
						"2": {
573
							"name": "punctuation.section.parens.begin.bracket.round.initialization.c"
574 575
						}
					},
576 577 578 579 580 581 582 583 584 585 586
					"end": "\\)",
					"endCaptures": {
						"0": {
							"name": "punctuation.section.parens.end.bracket.round.initialization.c"
						}
					},
					"patterns": [
						{
							"include": "#function-call-innards"
						}
					]
587 588
				},
				{
589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608
					"begin": "{",
					"beginCaptures": {
						"0": {
							"name": "punctuation.section.block.begin.bracket.curly.c"
						}
					},
					"end": "}|(?=\\s*#\\s*(?:elif|else|endif)\\b)",
					"endCaptures": {
						"0": {
							"name": "punctuation.section.block.end.bracket.curly.c"
						}
					},
					"patterns": [
						{
							"include": "#block_innards"
						}
					]
				},
				{
					"include": "#parens-block"
609 610 611 612 613 614 615
				},
				{
					"include": "$base"
				}
			]
		},
		"c_function_call": {
616
			"begin": "(?x)\n(?!(?:while|for|do|if|else|switch|catch|enumerate|return|typeid|alignof|alignas|sizeof|[cr]?iterate|and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq|alignof|alignas)\\s*\\()\n(?=\n(?:[A-Za-z_][A-Za-z0-9_]*+|::)++\\s*\\(  # actual name\n|\n(?:(?<=operator)(?:[-*&<>=+!]+|\\(\\)|\\[\\]))\\s*\\(\n)",
617 618 619 620 621
			"end": "(?<=\\))(?!\\w)",
			"name": "meta.function-call.c",
			"patterns": [
				{
					"include": "#function-call-innards"
622
				}
623
			]
624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661
		},
		"comments": {
			"patterns": [
				{
					"captures": {
						"1": {
							"name": "meta.toc-list.banner.block.c"
						}
					},
					"match": "^/\\* =(\\s*.*?)\\s*= \\*/$\\n?",
					"name": "comment.block.c"
				},
				{
					"begin": "/\\*",
					"beginCaptures": {
						"0": {
							"name": "punctuation.definition.comment.begin.c"
						}
					},
					"end": "\\*/",
					"endCaptures": {
						"0": {
							"name": "punctuation.definition.comment.end.c"
						}
					},
					"name": "comment.block.c"
				},
				{
					"match": "\\*/.*\\n",
					"name": "invalid.illegal.stray-comment-end.c"
				},
				{
					"captures": {
						"1": {
							"name": "meta.toc-list.banner.line.c"
						}
					},
					"match": "^// =(\\s*.*?)\\s*=\\s*$\\n?",
A
Alex Ross 已提交
662
					"name": "comment.line.banner.cpp.c"
663 664 665 666 667
				},
				{
					"begin": "(^[ \\t]+)?(?=//)",
					"beginCaptures": {
						"1": {
A
Alex Ross 已提交
668
							"name": "punctuation.whitespace.comment.leading.cpp.c"
669 670 671 672 673 674 675 676
						}
					},
					"end": "(?!\\G)",
					"patterns": [
						{
							"begin": "//",
							"beginCaptures": {
								"0": {
A
Alex Ross 已提交
677
									"name": "punctuation.definition.comment.cpp.c"
678 679
								}
							},
680
							"end": "(?=\\n)",
A
Alex Ross 已提交
681
							"name": "comment.line.double-slash.cpp.c",
682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706
							"patterns": [
								{
									"include": "#line_continuation_character"
								}
							]
						}
					]
				}
			]
		},
		"disabled": {
			"begin": "^\\s*#\\s*if(n?def)?\\b.*$",
			"end": "^\\s*#\\s*endif\\b",
			"patterns": [
				{
					"include": "#disabled"
				},
				{
					"include": "#pragma-mark"
				}
			]
		},
		"line_continuation_character": {
			"patterns": [
				{
707
					"match": "(\\\\)\\n",
708 709 710 711 712 713 714 715 716 717 718
					"captures": {
						"1": {
							"name": "constant.character.escape.line-continuation.c"
						}
					}
				}
			]
		},
		"numbers": {
			"patterns": [
				{
719
					"match": "\\b((0(x|X)[0-9a-fA-F]([0-9a-fA-F']*[0-9a-fA-F])?)|(0(b|B)[01]([01']*[01])?)|(([0-9]([0-9']*[0-9])?\\.?[0-9]*([0-9']*[0-9])?)|(\\.[0-9]([0-9']*[0-9])?))((e|E)(\\+|-)?[0-9]([0-9']*[0-9])?)?)(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b",
720 721 722 723 724
					"name": "constant.numeric.c"
				}
			]
		},
		"parens": {
A
Alex Ross 已提交
725
			"name": "punctuation.section.parens.c",
726 727 728
			"begin": "\\(",
			"beginCaptures": {
				"0": {
729
					"name": "punctuation.section.parens.begin.bracket.round.c"
730 731 732 733 734
				}
			},
			"end": "\\)",
			"endCaptures": {
				"0": {
735
					"name": "punctuation.section.parens.end.bracket.round.c"
736 737 738 739 740 741 742 743
				}
			},
			"patterns": [
				{
					"include": "$base"
				}
			]
		},
744
		"parens-block": {
A
Alex Ross 已提交
745
			"name": "punctuation.section.parens.block.c",
746 747 748 749 750 751 752 753 754 755 756 757 758 759 760
			"begin": "\\(",
			"beginCaptures": {
				"0": {
					"name": "punctuation.section.parens.begin.bracket.round.c"
				}
			},
			"end": "\\)",
			"endCaptures": {
				"0": {
					"name": "punctuation.section.parens.end.bracket.round.c"
				}
			},
			"patterns": [
				{
					"include": "#block_innards"
761 762
				},
				{
A
Alex Ross 已提交
763 764
					"match": "(?-mix:(?<!:):(?!:))",
					"name": "punctuation.range-based.cpp.c"
765 766 767
				}
			]
		},
768 769 770
		"pragma-mark": {
			"captures": {
				"1": {
771
					"name": "meta.preprocessor.pragma.c"
772 773 774 775 776 777 778 779
				},
				"2": {
					"name": "keyword.control.directive.pragma.pragma-mark.c"
				},
				"3": {
					"name": "punctuation.definition.directive.c"
				},
				"4": {
780
					"name": "entity.name.tag.pragma-mark.c"
781 782 783
				}
			},
			"match": "^\\s*(((#)\\s*pragma\\s+mark)\\s+(.*))",
A
Alex Ross 已提交
784
			"name": "meta.section.c"
785
		},
786 787 788 789 790
		"operators": {
			"patterns": [
				{
					"match": "(?<![\\w$])(sizeof)(?![\\w$])",
					"name": "keyword.operator.sizeof.c"
791
				},
792 793 794
				{
					"match": "--",
					"name": "keyword.operator.decrement.c"
795
				},
796 797 798
				{
					"match": "\\+\\+",
					"name": "keyword.operator.increment.c"
799
				},
800 801 802
				{
					"match": "%=|\\+=|-=|\\*=|(?<!\\()/=",
					"name": "keyword.operator.assignment.compound.c"
803
				},
804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830
				{
					"match": "&=|\\^=|<<=|>>=|\\|=",
					"name": "keyword.operator.assignment.compound.bitwise.c"
				},
				{
					"match": "<<|>>",
					"name": "keyword.operator.bitwise.shift.c"
				},
				{
					"match": "!=|<=|>=|==|<|>",
					"name": "keyword.operator.comparison.c"
				},
				{
					"match": "&&|!|\\|\\|",
					"name": "keyword.operator.logical.c"
				},
				{
					"match": "&|\\||\\^|~",
					"name": "keyword.operator.c"
				},
				{
					"match": "=",
					"name": "keyword.operator.assignment.c"
				},
				{
					"match": "%|\\*|/|-|\\+",
					"name": "keyword.operator.c"
831 832
				},
				{
833
					"begin": "\\?",
834
					"beginCaptures": {
835 836
						"0": {
							"name": "keyword.operator.ternary.c"
837 838
						}
					},
839
					"end": ":",
840
					"applyEndPatternLast": true,
841 842 843
					"endCaptures": {
						"0": {
							"name": "keyword.operator.ternary.c"
844
						}
845
					},
846 847
					"patterns": [
						{
A
Alex Ross 已提交
848
							"include": "#method_access"
849 850
						},
						{
A
Alex Ross 已提交
851
							"include": "#member_access"
852 853 854 855 856
						},
						{
							"include": "#c_function_call"
						},
						{
857
							"include": "$base"
858 859 860 861 862
						}
					]
				}
			]
		},
863
		"strings": {
864 865
			"patterns": [
				{
866
					"begin": "\"",
867
					"beginCaptures": {
868 869 870 871 872 873 874 875
						"0": {
							"name": "punctuation.definition.string.begin.c"
						}
					},
					"end": "\"",
					"endCaptures": {
						"0": {
							"name": "punctuation.definition.string.end.c"
876 877
						}
					},
878
					"name": "string.quoted.double.c",
879 880
					"patterns": [
						{
881 882 883 884 885 886 887
							"include": "#string_escaped_char"
						},
						{
							"include": "#string_placeholder"
						},
						{
							"include": "#line_continuation_character"
888 889 890 891
						}
					]
				},
				{
892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918
					"begin": "'",
					"beginCaptures": {
						"0": {
							"name": "punctuation.definition.string.begin.c"
						}
					},
					"end": "'",
					"endCaptures": {
						"0": {
							"name": "punctuation.definition.string.end.c"
						}
					},
					"name": "string.quoted.single.c",
					"patterns": [
						{
							"include": "#string_escaped_char"
						},
						{
							"include": "#line_continuation_character"
						}
					]
				}
			]
		},
		"string_escaped_char": {
			"patterns": [
				{
919
					"match": "(?x)\\\\ (\n\\\\\t\t\t |\n[abefnprtv'\"?]   |\n[0-3]\\d{,2}\t |\n[4-7]\\d?\t\t|\nx[a-fA-F0-9]{,2} |\nu[a-fA-F0-9]{,4} |\nU[a-fA-F0-9]{,8} )",
920 921 922 923 924 925 926 927 928 929 930
					"name": "constant.character.escape.c"
				},
				{
					"match": "\\\\.",
					"name": "invalid.illegal.unknown-escape.c"
				}
			]
		},
		"string_placeholder": {
			"patterns": [
				{
931
					"match": "(?x) %\n(\\d+\\$)?\t\t\t\t\t\t   # field (argument #)\n[#0\\- +']*\t\t\t\t\t\t  # flags\n[,;:_]?\t\t\t\t\t\t\t  # separator character (AltiVec)\n((-?\\d+)|\\*(-?\\d+\\$)?)?\t\t  # minimum field width\n(\\.((-?\\d+)|\\*(-?\\d+\\$)?)?)?\t# precision\n(hh|h|ll|l|j|t|z|q|L|vh|vl|v|hv|hl)? # length modifier\n[diouxXDOUeEfFgGaACcSspn%]\t\t   # conversion type",
932 933 934 935 936 937 938 939 940 941 942 943 944 945 946
					"name": "constant.other.placeholder.c"
				},
				{
					"match": "(%)(?!\"\\s*(PRI|SCN))",
					"captures": {
						"1": {
							"name": "invalid.illegal.placeholder.c"
						}
					}
				}
			]
		},
		"storage_types": {
			"patterns": [
				{
A
Alex Ross 已提交
947 948
					"match": "(?-mix:void|char|short|int|signed|unsigned|long|float|double|bool|_Bool)",
					"name": "storage.type.built-in.primitive.c"
949 950
				},
				{
A
Alex Ross 已提交
951 952
					"match": "(?-mix:_Complex|_Imaginary|u_char|u_short|u_int|u_long|ushort|uint|u_quad_t|quad_t|qaddr_t|caddr_t|daddr_t|div_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|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|int8_t|int16_t|int32_t|int64_t|uint8_t|uint16_t|uint32_t|uint64_t|int_least8_t|int_least16_t|int_least32_t|int_least64_t|uint_least8_t|uint_least16_t|uint_least32_t|uint_least64_t|int_fast8_t|int_fast16_t|int_fast32_t|int_fast64_t|uint_fast8_t|uint_fast16_t|uint_fast32_t|uint_fast64_t|intptr_t|uintptr_t|intmax_t|intmax_t|uintmax_t|uintmax_t|memory_order|atomic_bool|atomic_char|atomic_schar|atomic_uchar|atomic_short|atomic_ushort|atomic_int|atomic_uint|atomic_long|atomic_ulong|atomic_llong|atomic_ullong|atomic_char16_t|atomic_char32_t|atomic_wchar_t|atomic_int_least8_t|atomic_uint_least8_t|atomic_int_least16_t|atomic_uint_least16_t|atomic_int_least32_t|atomic_uint_least32_t|atomic_int_least64_t|atomic_uint_least64_t|atomic_int_fast8_t|atomic_uint_fast8_t|atomic_int_fast16_t|atomic_uint_fast16_t|atomic_int_fast32_t|atomic_uint_fast32_t|atomic_int_fast64_t|atomic_uint_fast64_t|atomic_intptr_t|atomic_uintptr_t|atomic_size_t|atomic_ptrdiff_t|atomic_intmax_t|atomic_uintmax_t)",
					"name": "storage.type.built-in.c"
953 954
				},
				{
A
Alex Ross 已提交
955
					"match": "(?-mix:\\b(asm|__asm__|enum|struct|union)\\b)",
956
					"name": "storage.type.$1.c"
957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992
				}
			]
		},
		"vararg_ellipses": {
			"match": "(?<!\\.)\\.\\.\\.(?!\\.)",
			"name": "punctuation.vararg-ellipses.c"
		},
		"preprocessor-rule-conditional": {
			"patterns": [
				{
					"begin": "^\\s*((#)\\s*if(?:n?def)?\\b)",
					"beginCaptures": {
						"0": {
							"name": "meta.preprocessor.c"
						},
						"1": {
							"name": "keyword.control.directive.conditional.c"
						},
						"2": {
							"name": "punctuation.definition.directive.c"
						}
					},
					"end": "^\\s*((#)\\s*endif\\b)",
					"endCaptures": {
						"0": {
							"name": "meta.preprocessor.c"
						},
						"1": {
							"name": "keyword.control.directive.conditional.c"
						},
						"2": {
							"name": "punctuation.definition.directive.c"
						}
					},
					"patterns": [
						{
M
Martin Aeschlimann 已提交
993
							"begin": "\\G(?=.)(?!//|/\\*(?!.*\\\\\\s*\\n))",
994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072
							"end": "(?=//)|(?=/\\*(?!.*\\\\\\s*\\n))|(?<!\\\\)(?=\\n)",
							"name": "meta.preprocessor.c",
							"patterns": [
								{
									"include": "#preprocessor-rule-conditional-line"
								}
							]
						},
						{
							"include": "#preprocessor-rule-enabled-elif"
						},
						{
							"include": "#preprocessor-rule-enabled-else"
						},
						{
							"include": "#preprocessor-rule-disabled-elif"
						},
						{
							"begin": "^\\s*((#)\\s*elif\\b)",
							"beginCaptures": {
								"1": {
									"name": "keyword.control.directive.conditional.c"
								},
								"2": {
									"name": "punctuation.definition.directive.c"
								}
							},
							"end": "(?=//)|(?=/\\*(?!.*\\\\\\s*\\n))|(?<!\\\\)(?=\\n)",
							"name": "meta.preprocessor.c",
							"patterns": [
								{
									"include": "#preprocessor-rule-conditional-line"
								}
							]
						},
						{
							"include": "$base"
						}
					]
				},
				{
					"match": "^\\s*#\\s*(else|elif|endif)\\b",
					"captures": {
						"0": {
							"name": "invalid.illegal.stray-$1.c"
						}
					}
				}
			]
		},
		"preprocessor-rule-conditional-block": {
			"patterns": [
				{
					"begin": "^\\s*((#)\\s*if(?:n?def)?\\b)",
					"beginCaptures": {
						"0": {
							"name": "meta.preprocessor.c"
						},
						"1": {
							"name": "keyword.control.directive.conditional.c"
						},
						"2": {
							"name": "punctuation.definition.directive.c"
						}
					},
					"end": "^\\s*((#)\\s*endif\\b)",
					"endCaptures": {
						"0": {
							"name": "meta.preprocessor.c"
						},
						"1": {
							"name": "keyword.control.directive.conditional.c"
						},
						"2": {
							"name": "punctuation.definition.directive.c"
						}
					},
					"patterns": [
						{
M
Martin Aeschlimann 已提交
1073
							"begin": "\\G(?=.)(?!//|/\\*(?!.*\\\\\\s*\\n))",
1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225
							"end": "(?=//)|(?=/\\*(?!.*\\\\\\s*\\n))|(?<!\\\\)(?=\\n)",
							"name": "meta.preprocessor.c",
							"patterns": [
								{
									"include": "#preprocessor-rule-conditional-line"
								}
							]
						},
						{
							"include": "#preprocessor-rule-enabled-elif-block"
						},
						{
							"include": "#preprocessor-rule-enabled-else-block"
						},
						{
							"include": "#preprocessor-rule-disabled-elif"
						},
						{
							"begin": "^\\s*((#)\\s*elif\\b)",
							"beginCaptures": {
								"1": {
									"name": "keyword.control.directive.conditional.c"
								},
								"2": {
									"name": "punctuation.definition.directive.c"
								}
							},
							"end": "(?=//)|(?=/\\*(?!.*\\\\\\s*\\n))|(?<!\\\\)(?=\\n)",
							"name": "meta.preprocessor.c",
							"patterns": [
								{
									"include": "#preprocessor-rule-conditional-line"
								}
							]
						},
						{
							"include": "#block_innards"
						}
					]
				},
				{
					"match": "^\\s*#\\s*(else|elif|endif)\\b",
					"captures": {
						"0": {
							"name": "invalid.illegal.stray-$1.c"
						}
					}
				}
			]
		},
		"preprocessor-rule-conditional-line": {
			"patterns": [
				{
					"match": "(?:\\bdefined\\b\\s*$)|(?:\\bdefined\\b(?=\\s*\\(*\\s*(?:(?!defined\\b)[a-zA-Z_$][\\w$]*\\b)\\s*\\)*\\s*(?:\\n|//|/\\*|\\?|\\:|&&|\\|\\||\\\\\\s*\\n)))",
					"name": "keyword.control.directive.conditional.c"
				},
				{
					"match": "\\bdefined\\b",
					"name": "invalid.illegal.macro-name.c"
				},
				{
					"include": "#comments"
				},
				{
					"include": "#strings"
				},
				{
					"include": "#numbers"
				},
				{
					"begin": "\\?",
					"beginCaptures": {
						"0": {
							"name": "keyword.operator.ternary.c"
						}
					},
					"end": ":",
					"endCaptures": {
						"0": {
							"name": "keyword.operator.ternary.c"
						}
					},
					"patterns": [
						{
							"include": "#preprocessor-rule-conditional-line"
						}
					]
				},
				{
					"include": "#operators"
				},
				{
					"match": "\\b(NULL|true|false|TRUE|FALSE)\\b",
					"name": "constant.language.c"
				},
				{
					"match": "[a-zA-Z_$][\\w$]*",
					"name": "entity.name.function.preprocessor.c"
				},
				{
					"include": "#line_continuation_character"
				},
				{
					"begin": "\\(",
					"beginCaptures": {
						"0": {
							"name": "punctuation.section.parens.begin.bracket.round.c"
						}
					},
					"end": "\\)|(?=//)|(?=/\\*(?!.*\\\\\\s*\\n))|(?<!\\\\)(?=\\n)",
					"endCaptures": {
						"0": {
							"name": "punctuation.section.parens.end.bracket.round.c"
						}
					},
					"patterns": [
						{
							"include": "#preprocessor-rule-conditional-line"
						}
					]
				}
			]
		},
		"preprocessor-rule-disabled": {
			"patterns": [
				{
					"begin": "^\\s*((#)\\s*if\\b)(?=\\s*\\(*\\b0+\\b\\)*\\s*(?:$|//|/\\*))",
					"beginCaptures": {
						"0": {
							"name": "meta.preprocessor.c"
						},
						"1": {
							"name": "keyword.control.directive.conditional.c"
						},
						"2": {
							"name": "punctuation.definition.directive.c"
						}
					},
					"end": "^\\s*((#)\\s*endif\\b)",
					"endCaptures": {
						"0": {
							"name": "meta.preprocessor.c"
						},
						"1": {
							"name": "keyword.control.directive.conditional.c"
						},
						"2": {
							"name": "punctuation.definition.directive.c"
						}
					},
					"patterns": [
						{
M
Martin Aeschlimann 已提交
1226
							"begin": "\\G(?=.)(?!//|/\\*(?!.*\\\\\\s*\\n))",
1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262
							"end": "(?=//)|(?=/\\*(?!.*\\\\\\s*\\n))|(?=\\n)",
							"name": "meta.preprocessor.c",
							"patterns": [
								{
									"include": "#preprocessor-rule-conditional-line"
								}
							]
						},
						{
							"include": "#comments"
						},
						{
							"include": "#preprocessor-rule-enabled-elif"
						},
						{
							"include": "#preprocessor-rule-enabled-else"
						},
						{
							"include": "#preprocessor-rule-disabled-elif"
						},
						{
							"begin": "^\\s*((#)\\s*elif\\b)",
							"beginCaptures": {
								"0": {
									"name": "meta.preprocessor.c"
								},
								"1": {
									"name": "keyword.control.directive.conditional.c"
								},
								"2": {
									"name": "punctuation.definition.directive.c"
								}
							},
							"end": "(?=^\\s*((#)\\s*(?:elif|else|endif)\\b))",
							"patterns": [
								{
M
Martin Aeschlimann 已提交
1263
									"begin": "\\G(?=.)(?!//|/\\*(?!.*\\\\\\s*\\n))",
1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322
									"end": "(?=//)|(?=/\\*(?!.*\\\\\\s*\\n))|(?<!\\\\)(?=\\n)",
									"name": "meta.preprocessor.c",
									"patterns": [
										{
											"include": "#preprocessor-rule-conditional-line"
										}
									]
								},
								{
									"include": "$base"
								}
							]
						},
						{
							"begin": "\\n",
							"end": "(?=^\\s*((#)\\s*(?:else|elif|endif)\\b))",
							"contentName": "comment.block.preprocessor.if-branch.c",
							"patterns": [
								{
									"include": "#disabled"
								},
								{
									"include": "#pragma-mark"
								}
							]
						}
					]
				}
			]
		},
		"preprocessor-rule-disabled-block": {
			"patterns": [
				{
					"begin": "^\\s*((#)\\s*if\\b)(?=\\s*\\(*\\b0+\\b\\)*\\s*(?:$|//|/\\*))",
					"beginCaptures": {
						"0": {
							"name": "meta.preprocessor.c"
						},
						"1": {
							"name": "keyword.control.directive.conditional.c"
						},
						"2": {
							"name": "punctuation.definition.directive.c"
						}
					},
					"end": "^\\s*((#)\\s*endif\\b)",
					"endCaptures": {
						"0": {
							"name": "meta.preprocessor.c"
						},
						"1": {
							"name": "keyword.control.directive.conditional.c"
						},
						"2": {
							"name": "punctuation.definition.directive.c"
						}
					},
					"patterns": [
						{
M
Martin Aeschlimann 已提交
1323
							"begin": "\\G(?=.)(?!//|/\\*(?!.*\\\\\\s*\\n))",
1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359
							"end": "(?=//)|(?=/\\*(?!.*\\\\\\s*\\n))|(?=\\n)",
							"name": "meta.preprocessor.c",
							"patterns": [
								{
									"include": "#preprocessor-rule-conditional-line"
								}
							]
						},
						{
							"include": "#comments"
						},
						{
							"include": "#preprocessor-rule-enabled-elif-block"
						},
						{
							"include": "#preprocessor-rule-enabled-else-block"
						},
						{
							"include": "#preprocessor-rule-disabled-elif"
						},
						{
							"begin": "^\\s*((#)\\s*elif\\b)",
							"beginCaptures": {
								"0": {
									"name": "meta.preprocessor.c"
								},
								"1": {
									"name": "keyword.control.directive.conditional.c"
								},
								"2": {
									"name": "punctuation.definition.directive.c"
								}
							},
							"end": "(?=^\\s*((#)\\s*(?:elif|else|endif)\\b))",
							"patterns": [
								{
M
Martin Aeschlimann 已提交
1360
									"begin": "\\G(?=.)(?!//|/\\*(?!.*\\\\\\s*\\n))",
1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406
									"end": "(?=//)|(?=/\\*(?!.*\\\\\\s*\\n))|(?<!\\\\)(?=\\n)",
									"name": "meta.preprocessor.c",
									"patterns": [
										{
											"include": "#preprocessor-rule-conditional-line"
										}
									]
								},
								{
									"include": "#block_innards"
								}
							]
						},
						{
							"begin": "\\n",
							"end": "(?=^\\s*((#)\\s*(?:else|elif|endif)\\b))",
							"contentName": "comment.block.preprocessor.if-branch.in-block.c",
							"patterns": [
								{
									"include": "#disabled"
								},
								{
									"include": "#pragma-mark"
								}
							]
						}
					]
				}
			]
		},
		"preprocessor-rule-disabled-elif": {
			"begin": "^\\s*((#)\\s*elif\\b)(?=\\s*\\(*\\b0+\\b\\)*\\s*(?:$|//|/\\*))",
			"beginCaptures": {
				"0": {
					"name": "meta.preprocessor.c"
				},
				"1": {
					"name": "keyword.control.directive.conditional.c"
				},
				"2": {
					"name": "punctuation.definition.directive.c"
				}
			},
			"end": "(?=^\\s*((#)\\s*(?:elif|else|endif)\\b))",
			"patterns": [
				{
M
Martin Aeschlimann 已提交
1407
					"begin": "\\G(?=.)(?!//|/\\*(?!.*\\\\\\s*\\n))",
1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425
					"end": "(?=//)|(?=/\\*(?!.*\\\\\\s*\\n))|(?<!\\\\)(?=\\n)",
					"name": "meta.preprocessor.c",
					"patterns": [
						{
							"include": "#preprocessor-rule-conditional-line"
						}
					]
				},
				{
					"include": "#comments"
				},
				{
					"begin": "\\n",
					"end": "(?=^\\s*((#)\\s*(?:else|elif|endif)\\b))",
					"contentName": "comment.block.preprocessor.elif-branch.c",
					"patterns": [
						{
							"include": "#disabled"
1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436
						},
						{
							"include": "#pragma-mark"
						}
					]
				}
			]
		},
		"preprocessor-rule-enabled": {
			"patterns": [
				{
1437
					"begin": "^\\s*((#)\\s*if\\b)(?=\\s*\\(*\\b0*1\\b\\)*\\s*(?:$|//|/\\*))",
1438
					"beginCaptures": {
1439
						"0": {
1440 1441
							"name": "meta.preprocessor.c"
						},
1442
						"1": {
1443 1444
							"name": "keyword.control.directive.conditional.c"
						},
1445 1446 1447
						"2": {
							"name": "punctuation.definition.directive.c"
						},
1448
						"3": {
1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460
							"name": "constant.numeric.preprocessor.c"
						}
					},
					"end": "^\\s*((#)\\s*endif\\b)",
					"endCaptures": {
						"0": {
							"name": "meta.preprocessor.c"
						},
						"1": {
							"name": "keyword.control.directive.conditional.c"
						},
						"2": {
1461 1462 1463 1464 1465
							"name": "punctuation.definition.directive.c"
						}
					},
					"patterns": [
						{
M
Martin Aeschlimann 已提交
1466
							"begin": "\\G(?=.)(?!//|/\\*(?!.*\\\\\\s*\\n))",
1467 1468 1469 1470 1471 1472 1473
							"end": "(?=//)|(?=/\\*(?!.*\\\\\\s*\\n))|(?=\\n)",
							"name": "meta.preprocessor.c",
							"patterns": [
								{
									"include": "#preprocessor-rule-conditional-line"
								}
							]
1474 1475
						},
						{
1476 1477
							"include": "#comments"
						},
1478
						{
1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533
							"begin": "^\\s*((#)\\s*else\\b)",
							"beginCaptures": {
								"0": {
									"name": "meta.preprocessor.c"
								},
								"1": {
									"name": "keyword.control.directive.conditional.c"
								},
								"2": {
									"name": "punctuation.definition.directive.c"
								}
							},
							"end": "(?=^\\s*((#)\\s*endif\\b))",
							"contentName": "comment.block.preprocessor.else-branch.c",
							"patterns": [
								{
									"include": "#disabled"
								},
								{
									"include": "#pragma-mark"
								}
							]
						},
						{
							"begin": "^\\s*((#)\\s*elif\\b)",
							"beginCaptures": {
								"0": {
									"name": "meta.preprocessor.c"
								},
								"1": {
									"name": "keyword.control.directive.conditional.c"
								},
								"2": {
									"name": "punctuation.definition.directive.c"
								}
							},
							"end": "(?=^\\s*((#)\\s*(?:else|elif|endif)\\b))",
							"contentName": "comment.block.preprocessor.if-branch.c",
							"patterns": [
								{
									"include": "#disabled"
								},
								{
									"include": "#pragma-mark"
								}
							]
						},
						{
							"begin": "\\n",
							"end": "(?=^\\s*((#)\\s*(?:else|elif|endif)\\b))",
							"patterns": [
								{
									"include": "$base"
								}
							]
1534 1535 1536 1537 1538 1539 1540 1541
						}
					]
				}
			]
		},
		"preprocessor-rule-enabled-block": {
			"patterns": [
				{
1542
					"begin": "^\\s*((#)\\s*if\\b)(?=\\s*\\(*\\b0*1\\b\\)*\\s*(?:$|//|/\\*))",
1543
					"beginCaptures": {
1544
						"0": {
1545 1546
							"name": "meta.preprocessor.c"
						},
1547 1548 1549
						"1": {
							"name": "keyword.control.directive.conditional.c"
						},
1550
						"2": {
1551 1552 1553 1554 1555 1556 1557 1558 1559
							"name": "punctuation.definition.directive.c"
						}
					},
					"end": "^\\s*((#)\\s*endif\\b)",
					"endCaptures": {
						"0": {
							"name": "meta.preprocessor.c"
						},
						"1": {
1560 1561
							"name": "keyword.control.directive.conditional.c"
						},
1562
						"2": {
1563 1564 1565 1566 1567
							"name": "punctuation.definition.directive.c"
						}
					},
					"patterns": [
						{
M
Martin Aeschlimann 已提交
1568
							"begin": "\\G(?=.)(?!//|/\\*(?!.*\\\\\\s*\\n))",
1569 1570 1571 1572 1573 1574 1575
							"end": "(?=//)|(?=/\\*(?!.*\\\\\\s*\\n))|(?=\\n)",
							"name": "meta.preprocessor.c",
							"patterns": [
								{
									"include": "#preprocessor-rule-conditional-line"
								}
							]
1576 1577
						},
						{
1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635
							"include": "#comments"
						},
						{
							"begin": "^\\s*((#)\\s*else\\b)",
							"beginCaptures": {
								"0": {
									"name": "meta.preprocessor.c"
								},
								"1": {
									"name": "keyword.control.directive.conditional.c"
								},
								"2": {
									"name": "punctuation.definition.directive.c"
								}
							},
							"end": "(?=^\\s*((#)\\s*endif\\b))",
							"contentName": "comment.block.preprocessor.else-branch.in-block.c",
							"patterns": [
								{
									"include": "#disabled"
								},
								{
									"include": "#pragma-mark"
								}
							]
						},
						{
							"begin": "^\\s*((#)\\s*elif\\b)",
							"beginCaptures": {
								"0": {
									"name": "meta.preprocessor.c"
								},
								"1": {
									"name": "keyword.control.directive.conditional.c"
								},
								"2": {
									"name": "punctuation.definition.directive.c"
								}
							},
							"end": "(?=^\\s*((#)\\s*(?:else|elif|endif)\\b))",
							"contentName": "comment.block.preprocessor.if-branch.in-block.c",
							"patterns": [
								{
									"include": "#disabled"
								},
								{
									"include": "#pragma-mark"
								}
							]
						},
						{
							"begin": "\\n",
							"end": "(?=^\\s*((#)\\s*(?:else|elif|endif)\\b))",
							"patterns": [
								{
									"include": "#block_innards"
								}
							]
1636 1637
						}
					]
1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648
				}
			]
		},
		"preprocessor-rule-enabled-elif": {
			"begin": "^\\s*((#)\\s*elif\\b)(?=\\s*\\(*\\b0*1\\b\\)*\\s*(?:$|//|/\\*))",
			"beginCaptures": {
				"0": {
					"name": "meta.preprocessor.c"
				},
				"1": {
					"name": "keyword.control.directive.conditional.c"
1649
				},
1650 1651 1652 1653 1654 1655
				"2": {
					"name": "punctuation.definition.directive.c"
				}
			},
			"end": "(?=^\\s*((#)\\s*endif\\b))",
			"patterns": [
1656
				{
M
Martin Aeschlimann 已提交
1657
					"begin": "\\G(?=.)(?!//|/\\*(?!.*\\\\\\s*\\n))",
1658 1659
					"end": "(?=//)|(?=/\\*(?!.*\\\\\\s*\\n))|(?<!\\\\)(?=\\n)",
					"name": "meta.preprocessor.c",
1660 1661
					"patterns": [
						{
1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722
							"include": "#preprocessor-rule-conditional-line"
						}
					]
				},
				{
					"include": "#comments"
				},
				{
					"begin": "\\n",
					"end": "(?=^\\s*((#)\\s*(?:endif)\\b))",
					"patterns": [
						{
							"begin": "^\\s*((#)\\s*(else)\\b)",
							"beginCaptures": {
								"0": {
									"name": "meta.preprocessor.c"
								},
								"1": {
									"name": "keyword.control.directive.conditional.c"
								},
								"2": {
									"name": "punctuation.definition.directive.c"
								}
							},
							"end": "(?=^\\s*((#)\\s*endif\\b))",
							"contentName": "comment.block.preprocessor.elif-branch.c",
							"patterns": [
								{
									"include": "#disabled"
								},
								{
									"include": "#pragma-mark"
								}
							]
						},
						{
							"begin": "^\\s*((#)\\s*(elif)\\b)",
							"beginCaptures": {
								"0": {
									"name": "meta.preprocessor.c"
								},
								"1": {
									"name": "keyword.control.directive.conditional.c"
								},
								"2": {
									"name": "punctuation.definition.directive.c"
								}
							},
							"end": "(?=^\\s*((#)\\s*(?:else|elif|endif)\\b))",
							"contentName": "comment.block.preprocessor.elif-branch.c",
							"patterns": [
								{
									"include": "#disabled"
								},
								{
									"include": "#pragma-mark"
								}
							]
						},
						{
							"include": "$base"
1723 1724 1725 1726 1727
						}
					]
				}
			]
		},
1728 1729
		"preprocessor-rule-enabled-elif-block": {
			"begin": "^\\s*((#)\\s*elif\\b)(?=\\s*\\(*\\b0*1\\b\\)*\\s*(?:$|//|/\\*))",
1730
			"beginCaptures": {
1731
				"0": {
1732 1733
					"name": "meta.preprocessor.c"
				},
1734
				"1": {
1735 1736
					"name": "keyword.control.directive.conditional.c"
				},
1737
				"2": {
1738 1739 1740
					"name": "punctuation.definition.directive.c"
				}
			},
1741 1742 1743
			"end": "(?=^\\s*((#)\\s*endif\\b))",
			"patterns": [
				{
M
Martin Aeschlimann 已提交
1744
					"begin": "\\G(?=.)(?!//|/\\*(?!.*\\\\\\s*\\n))",
1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818
					"end": "(?=//)|(?=/\\*(?!.*\\\\\\s*\\n))|(?<!\\\\)(?=\\n)",
					"name": "meta.preprocessor.c",
					"patterns": [
						{
							"include": "#preprocessor-rule-conditional-line"
						}
					]
				},
				{
					"include": "#comments"
				},
				{
					"begin": "\\n",
					"end": "(?=^\\s*((#)\\s*(?:endif)\\b))",
					"patterns": [
						{
							"begin": "^\\s*((#)\\s*(else)\\b)",
							"beginCaptures": {
								"0": {
									"name": "meta.preprocessor.c"
								},
								"1": {
									"name": "keyword.control.directive.conditional.c"
								},
								"2": {
									"name": "punctuation.definition.directive.c"
								}
							},
							"end": "(?=^\\s*((#)\\s*endif\\b))",
							"contentName": "comment.block.preprocessor.elif-branch.in-block.c",
							"patterns": [
								{
									"include": "#disabled"
								},
								{
									"include": "#pragma-mark"
								}
							]
						},
						{
							"begin": "^\\s*((#)\\s*(elif)\\b)",
							"beginCaptures": {
								"0": {
									"name": "meta.preprocessor.c"
								},
								"1": {
									"name": "keyword.control.directive.conditional.c"
								},
								"2": {
									"name": "punctuation.definition.directive.c"
								}
							},
							"end": "(?=^\\s*((#)\\s*(?:else|elif|endif)\\b))",
							"contentName": "comment.block.preprocessor.elif-branch.c",
							"patterns": [
								{
									"include": "#disabled"
								},
								{
									"include": "#pragma-mark"
								}
							]
						},
						{
							"include": "#block_innards"
						}
					]
				}
			]
		},
		"preprocessor-rule-enabled-else": {
			"begin": "^\\s*((#)\\s*else\\b)",
			"beginCaptures": {
				"0": {
1819 1820
					"name": "meta.preprocessor.c"
				},
1821
				"1": {
1822 1823
					"name": "keyword.control.directive.conditional.c"
				},
1824
				"2": {
1825 1826 1827
					"name": "punctuation.definition.directive.c"
				}
			},
1828
			"end": "(?=^\\s*((#)\\s*endif\\b))",
1829 1830 1831 1832 1833 1834
			"patterns": [
				{
					"include": "$base"
				}
			]
		},
1835 1836
		"preprocessor-rule-enabled-else-block": {
			"begin": "^\\s*((#)\\s*else\\b)",
1837
			"beginCaptures": {
1838
				"0": {
1839 1840 1841 1842 1843
					"name": "meta.preprocessor.c"
				},
				"1": {
					"name": "keyword.control.directive.conditional.c"
				},
1844
				"2": {
1845 1846 1847
					"name": "punctuation.definition.directive.c"
				}
			},
1848
			"end": "(?=^\\s*((#)\\s*endif\\b))",
1849 1850 1851 1852 1853 1854
			"patterns": [
				{
					"include": "#block_innards"
				}
			]
		},
1855
		"preprocessor-rule-define-line-contents": {
M
Martin Aeschlimann 已提交
1856 1857
			"patterns": [
				{
1858
					"include": "#vararg_ellipses"
M
Martin Aeschlimann 已提交
1859 1860
				},
				{
1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878
					"begin": "{",
					"beginCaptures": {
						"0": {
							"name": "punctuation.section.block.begin.bracket.curly.c"
						}
					},
					"end": "}|(?=\\s*#\\s*(?:elif|else|endif)\\b)|(?<!\\\\)(?=\\s*\\n)",
					"endCaptures": {
						"0": {
							"name": "punctuation.section.block.end.bracket.curly.c"
						}
					},
					"name": "meta.block.c",
					"patterns": [
						{
							"include": "#preprocessor-rule-define-line-blocks"
						}
					]
M
Martin Aeschlimann 已提交
1879 1880
				},
				{
1881 1882
					"match": "\\(",
					"name": "punctuation.section.parens.begin.bracket.round.c"
M
Martin Aeschlimann 已提交
1883 1884
				},
				{
1885 1886
					"match": "\\)",
					"name": "punctuation.section.parens.end.bracket.round.c"
M
Martin Aeschlimann 已提交
1887 1888
				},
				{
1889
					"begin": "(?x)\n(?!(?:while|for|do|if|else|switch|catch|enumerate|return|typeid|alignof|alignas|sizeof|[cr]?iterate|and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq|alignof|alignas|asm|__asm__|auto|bool|_Bool|char|_Complex|double|enum|float|_Imaginary|int|long|short|signed|struct|typedef|union|unsigned|void)\\s*\\()\n(?=\n  (?:[A-Za-z_][A-Za-z0-9_]*+|::)++\\s*\\(  # actual name\n  |\n  (?:(?<=operator)(?:[-*&<>=+!]+|\\(\\)|\\[\\]))\\s*\\(\n)",
1890 1891 1892 1893 1894 1895 1896
					"end": "(?<=\\))(?!\\w)|(?<!\\\\)(?=\\s*\\n)",
					"name": "meta.function.c",
					"patterns": [
						{
							"include": "#preprocessor-rule-define-line-functions"
						}
					]
M
Martin Aeschlimann 已提交
1897 1898
				},
				{
1899
					"begin": "\"",
M
Martin Aeschlimann 已提交
1900 1901
					"beginCaptures": {
						"0": {
1902
							"name": "punctuation.definition.string.begin.c"
M
Martin Aeschlimann 已提交
1903 1904
						}
					},
1905
					"end": "\"|(?<!\\\\)(?=\\s*\\n)",
M
Martin Aeschlimann 已提交
1906 1907
					"endCaptures": {
						"0": {
1908
							"name": "punctuation.definition.string.end.c"
M
Martin Aeschlimann 已提交
1909 1910
						}
					},
1911
					"name": "string.quoted.double.c",
M
Martin Aeschlimann 已提交
1912
					"patterns": [
1913
						{
1914
							"include": "#string_escaped_char"
1915 1916
						},
						{
1917
							"include": "#string_placeholder"
1918 1919
						},
						{
1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940
							"include": "#line_continuation_character"
						}
					]
				},
				{
					"begin": "'",
					"beginCaptures": {
						"0": {
							"name": "punctuation.definition.string.begin.c"
						}
					},
					"end": "'|(?<!\\\\)(?=\\s*\\n)",
					"endCaptures": {
						"0": {
							"name": "punctuation.definition.string.end.c"
						}
					},
					"name": "string.quoted.single.c",
					"patterns": [
						{
							"include": "#string_escaped_char"
1941
						},
M
Martin Aeschlimann 已提交
1942
						{
1943
							"include": "#line_continuation_character"
M
Martin Aeschlimann 已提交
1944 1945
						}
					]
1946 1947
				},
				{
A
Alex Ross 已提交
1948
					"include": "#method_access"
1949 1950
				},
				{
A
Alex Ross 已提交
1951
					"include": "#member_access"
1952 1953 1954
				},
				{
					"include": "$base"
M
Martin Aeschlimann 已提交
1955 1956
				}
			]
1957
		},
1958
		"preprocessor-rule-define-line-blocks": {
1959 1960
			"patterns": [
				{
1961
					"begin": "{",
1962 1963
					"beginCaptures": {
						"0": {
1964
							"name": "punctuation.section.block.begin.bracket.curly.c"
1965 1966
						}
					},
1967
					"end": "}|(?=\\s*#\\s*(?:elif|else|endif)\\b)|(?<!\\\\)(?=\\s*\\n)",
1968 1969
					"endCaptures": {
						"0": {
1970
							"name": "punctuation.section.block.end.bracket.curly.c"
1971 1972 1973 1974
						}
					},
					"patterns": [
						{
1975
							"include": "#preprocessor-rule-define-line-blocks"
1976 1977
						},
						{
1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998
							"include": "#preprocessor-rule-define-line-contents"
						}
					]
				},
				{
					"include": "#preprocessor-rule-define-line-contents"
				}
			]
		},
		"preprocessor-rule-define-line-functions": {
			"patterns": [
				{
					"include": "#comments"
				},
				{
					"include": "#storage_types"
				},
				{
					"include": "#vararg_ellipses"
				},
				{
A
Alex Ross 已提交
1999
					"include": "#method_access"
2000 2001
				},
				{
A
Alex Ross 已提交
2002
					"include": "#member_access"
2003 2004 2005 2006 2007
				},
				{
					"include": "#operators"
				},
				{
2008
					"begin": "(?x)\n(?!(?:while|for|do|if|else|switch|catch|enumerate|return|typeid|alignof|alignas|sizeof|[cr]?iterate|and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq|alignof|alignas)\\s*\\()\n(\n(?:[A-Za-z_][A-Za-z0-9_]*+|::)++  # actual name\n|\n(?:(?<=operator)(?:[-*&<>=+!]+|\\(\\)|\\[\\]))\n)\n\\s*(\\()",
2009 2010 2011
					"beginCaptures": {
						"1": {
							"name": "entity.name.function.c"
2012
						},
2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023
						"2": {
							"name": "punctuation.section.arguments.begin.bracket.round.c"
						}
					},
					"end": "(\\))|(?<!\\\\)(?=\\s*\\n)",
					"endCaptures": {
						"1": {
							"name": "punctuation.section.arguments.end.bracket.round.c"
						}
					},
					"patterns": [
2024
						{
2025
							"include": "#preprocessor-rule-define-line-functions"
2026 2027 2028 2029
						}
					]
				},
				{
2030
					"begin": "\\(",
2031 2032
					"beginCaptures": {
						"0": {
2033
							"name": "punctuation.section.parens.begin.bracket.round.c"
2034 2035
						}
					},
2036
					"end": "(\\))|(?<!\\\\)(?=\\s*\\n)",
2037
					"endCaptures": {
2038 2039
						"1": {
							"name": "punctuation.section.parens.end.bracket.round.c"
2040 2041 2042 2043
						}
					},
					"patterns": [
						{
2044
							"include": "#preprocessor-rule-define-line-functions"
2045 2046
						}
					]
2047 2048 2049
				},
				{
					"include": "#preprocessor-rule-define-line-contents"
2050 2051 2052
				}
			]
		},
2053
		"function-innards": {
2054 2055
			"patterns": [
				{
2056
					"include": "#comments"
2057 2058
				},
				{
2059 2060 2061 2062 2063 2064 2065 2066 2067
					"include": "#storage_types"
				},
				{
					"include": "#operators"
				},
				{
					"include": "#vararg_ellipses"
				},
				{
A
Alex Ross 已提交
2068
					"name": "meta.function.definition.parameters.c",
2069
					"begin": "(?x)\n(?!(?:while|for|do|if|else|switch|catch|enumerate|return|typeid|alignof|alignas|sizeof|[cr]?iterate|and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq|alignof|alignas)\\s*\\()\n(\n(?:[A-Za-z_][A-Za-z0-9_]*+|::)++  # actual name\n|\n(?:(?<=operator)(?:[-*&<>=+!]+|\\(\\)|\\[\\]))\n)\n\\s*(\\()",
2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084
					"beginCaptures": {
						"1": {
							"name": "entity.name.function.c"
						},
						"2": {
							"name": "punctuation.section.parameters.begin.bracket.round.c"
						}
					},
					"end": "\\)",
					"endCaptures": {
						"0": {
							"name": "punctuation.section.parameters.end.bracket.round.c"
						}
					},
					"patterns": [
2085 2086 2087
						{
							"include": "#probably_a_parameter"
						},
2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113
						{
							"include": "#function-innards"
						}
					]
				},
				{
					"begin": "\\(",
					"beginCaptures": {
						"0": {
							"name": "punctuation.section.parens.begin.bracket.round.c"
						}
					},
					"end": "\\)",
					"endCaptures": {
						"0": {
							"name": "punctuation.section.parens.end.bracket.round.c"
						}
					},
					"patterns": [
						{
							"include": "#function-innards"
						}
					]
				},
				{
					"include": "$base"
2114 2115 2116
				}
			]
		},
2117
		"function-call-innards": {
2118 2119
			"patterns": [
				{
2120 2121 2122 2123 2124 2125
					"include": "#comments"
				},
				{
					"include": "#storage_types"
				},
				{
A
Alex Ross 已提交
2126
					"include": "#method_access"
2127 2128
				},
				{
A
Alex Ross 已提交
2129
					"include": "#member_access"
2130 2131 2132 2133 2134
				},
				{
					"include": "#operators"
				},
				{
2135
					"begin": "(?x)\n(?!(?:while|for|do|if|else|switch|catch|enumerate|return|typeid|alignof|alignas|sizeof|[cr]?iterate|and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq|alignof|alignas)\\s*\\()\n(\n(?:[A-Za-z_][A-Za-z0-9_]*+|::)++  # actual name\n|\n(?:(?<=operator)(?:[-*&<>=+!]+|\\(\\)|\\[\\]))\n)\n\\s*(\\()",
2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173
					"beginCaptures": {
						"1": {
							"name": "entity.name.function.c"
						},
						"2": {
							"name": "punctuation.section.arguments.begin.bracket.round.c"
						}
					},
					"end": "\\)",
					"endCaptures": {
						"0": {
							"name": "punctuation.section.arguments.end.bracket.round.c"
						}
					},
					"patterns": [
						{
							"include": "#function-call-innards"
						}
					]
				},
				{
					"begin": "\\(",
					"beginCaptures": {
						"0": {
							"name": "punctuation.section.parens.begin.bracket.round.c"
						}
					},
					"end": "\\)",
					"endCaptures": {
						"0": {
							"name": "punctuation.section.parens.end.bracket.round.c"
						}
					},
					"patterns": [
						{
							"include": "#function-call-innards"
						}
					]
2174 2175
				},
				{
2176
					"include": "#block_innards"
2177 2178 2179
				}
			]
		}
2180
	}
2181
}