Permalink
Find file Copy path
1800 lines (1799 sloc) 51.7 KB
'scopeName': 'source.c'
'fileTypes': [
'c'
'h.in'
'xpm'
]
'firstLineMatch': '(?i)-\\*-[^*]*(Mode:\\s*)?C(\\s*;.*?)?\\s*-\\*-'
'name': 'C'
'patterns': [
{
'include': '#preprocessor-rule-enabled'
}
{
'include': '#preprocessor-rule-disabled'
}
{
'include': '#preprocessor-rule-conditional'
}
{
'include': '#comments'
}
{
'match': '\\b(break|case|continue|default|do|else|for|goto|if|_Pragma|return|switch|while)\\b'
'name': 'keyword.control.c'
}
{
'include': '#storage_types'
}
{
'match': '\\b(const|extern|register|restrict|static|volatile|inline)\\b'
'name': 'storage.modifier.c'
}
{
# Common naming idiom for C constants: "kConstantVariable"
'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'
}
{
'include': '#operators'
}
{
'include': '#numbers'
}
{
'include': '#strings'
}
{
'begin': '''(?x)
^\\s* ((\\#)\\s*define) \\s+ # define
((?<id>[a-zA-Z_$][\\w$]*)) # macro name
(?:
(\\()
(
\\s* \\g<id> \\s* # first argument
((,) \\s* \\g<id> \\s*)* # additional arguments
(?:\\.\\.\\.)? # varargs ellipsis?
)
(\\))
)?
'''
'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': [
{
'include': '#preprocessor-rule-define-line-contents'
}
]
}
{
'begin': '^\\s*((#)\\s*(error|warning))\\b'
'captures':
'1':
'name': 'keyword.control.directive.diagnostic.$3.c'
'2':
'name': 'punctuation.definition.directive.c'
'end': '(?<!\\\\)(?=\\n)|(?=//)|(?=/\\*(?!.*\\\\\\s*\\n))'
'name': 'meta.preprocessor.diagnostic.c'
'patterns': [
{
'include': '#comments'
}
{
'include': '#strings'
}
{
'include': '#line_continuation_character'
}
]
}
{
'begin': '^\\s*((#)\\s*(include(?:_next)?|import))\\b\\s*'
'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'
}
]
}
{
'begin': '^\\s*(?:((#)\\s*undef))\\b'
'beginCaptures':
'1':
'name': 'keyword.control.directive.undef.c'
'2':
'name': 'punctuation.definition.directive.c'
'end': '(?=(?://|/\\*))|(?<!\\\\)(?=\\n)'
'name': 'meta.preprocessor.c'
'patterns': [
{
'match': '[a-zA-Z_$][\\w$]*'
'name': 'entity.name.function.preprocessor.c'
}
{
'include': '#line_continuation_character'
}
]
}
{
'begin': '^\\s*(?:((#)\\s*pragma))\\b'
'beginCaptures':
'1':
'name': 'keyword.control.directive.pragma.c'
'2':
'name': 'punctuation.definition.directive.c'
'end': '(?=(?://|/\\*))|(?<!\\\\)(?=\\n)'
'name': 'meta.preprocessor.pragma.c'
'patterns': [
{
'include': '#strings'
}
{
'match': '[a-zA-Z_$][\\w\\-$]*'
'name': 'entity.other.attribute-name.pragma.preprocessor.c'
}
{
'include': '#numbers'
}
{
'include': '#line_continuation_character'
}
]
}
{
'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'
'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'
}
{
'match': '''(?x) \\b
(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)
\\b'''
'name': 'support.type.stdint.c'
}
{
'match': '\\b(noErr|kNilOptions|kInvalidID|kVariableLengthArray)\\b'
'name': 'support.constant.mac-classic.c'
}
{
'match': '''(?x) \\b
(AbsoluteTime|Boolean|Byte|ByteCount|ByteOffset|BytePtr|CompTimeValue|ConstLogicalAddress|ConstStrFileNameParam
|ConstStringPtr|Duration|Fixed|FixedPtr|Float32|Float32Point|Float64|Float80|Float96|FourCharCode|Fract|FractPtr
|Handle|ItemCount|LogicalAddress|OptionBits|OSErr|OSStatus|OSType|OSTypePtr|PhysicalAddress|ProcessSerialNumber
|ProcessSerialNumberPtr|ProcHandle|Ptr|ResType|ResTypePtr|ShortFixed|ShortFixedPtr|SignedByte|SInt16|SInt32|SInt64
|SInt8|Size|StrFileName|StringHandle|StringPtr|TimeBase|TimeRecord|TimeScale|TimeValue|TimeValue64|UInt16|UInt32
|UInt64|UInt8|UniChar|UniCharCount|UniCharCountPtr|UniCharPtr|UnicodeScalarValue|UniversalProcHandle|UniversalProcPtr
|UnsignedFixed|UnsignedFixedPtr|UnsignedWide|UTF16Char|UTF32Char|UTF8Char)
\\b'''
'name': 'support.type.mac-classic.c'
}
{
# Reserved POSIX types
'match': '\\b([A-Za-z0-9_]+_t)\\b'
'name': 'support.type.posix-reserved.c'
}
{
'include': '#block'
}
{
'include': '#parens'
}
{
# FIRST CAPTURE meta.function.c scope (provides an injectable scope, balanced parentheses and prevents unnecessary scope nesting)
'begin': '''(?x)
(?!(?:while|for|do|if|else|switch|catch|enumerate|return|typeid|alignof|alignas|sizeof|[cr]?iterate|asm|__asm__|auto|bool|_Bool|char|_Complex|double|enum|float|_Imaginary|int|long|short|signed|struct|typedef|union|unsigned|void)\\s*\\()
(?=
(?:[A-Za-z_][A-Za-z0-9_]*+|::)++\\s*\\( # actual name
|
(?:(?<=operator)(?:[-*&<>=+!]+|\\(\\)|\\[\\]))\\s*\\(
)
'''
'end': '(?<=\\))(?!\\w)'
'name': 'meta.function.c'
'patterns': [
{
'include': '#function-innards'
}
]
}
{
'include': '#line_continuation_character'
}
{
'match': '(\\[)|(\\])'
'captures':
'1':
'name': 'punctuation.definition.begin.bracket.square.c'
'2':
'name': 'punctuation.definition.end.bracket.square.c'
}
{
'match': ';'
'name': 'punctuation.terminator.statement.c'
}
{
'match': ','
'name': 'punctuation.separator.delimiter.c'
}
]
'repository':
'access':
'captures':
'2':
'name': 'punctuation.separator.dot-access.c'
'3':
'name': 'punctuation.separator.pointer-access.c'
'4':
'name': 'variable.other.member.c'
'match': '((\\.)|(->))\\s*(([a-zA-Z_][a-zA-Z_0-9]*)\\b(?!\\s*\\())?'
'block':
'patterns': [
{
'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'
'name': 'meta.block.c'
'patterns': [
{
'include': '#block_innards'
}
]
}
]
'block_innards':
'patterns': [
{
'include': '#preprocessor-rule-enabled-block'
}
{
'include': '#preprocessor-rule-disabled-block'
}
{
'include': '#preprocessor-rule-conditional-block'
}
{
'include': '#access'
}
{
'include': '#libc'
}
{
'include': '#c_function_call'
}
{
'captures':
'1':
'name': 'variable.other.c'
'2':
'name': 'punctuation.definition.parameters.c'
'match': '''(?x)
(?:
(?:
(?=\\s)(?<!else|new|return)
(?<=\\w) \\s+ # or word + space before name
)
)
(
(?:[A-Za-z_][A-Za-z0-9_]*+ | :: )++ # actual name
|
(?:(?<=operator) (?:[-*&<>=+!]+ | \\(\\) | \\[\\]))
)
\\s*(\\() # opening bracket
'''
'name': 'meta.initialization.c'
}
{
# Prevent unnecessary nesting of meta.block.c scope
'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'
}
{
'include': '$base'
}
]
'c_function_call':
# FIRST CAPTURE meta.function-call.c scope (provides an injectable scope, balanced parentheses and prevents unnecessary scope nesting)
'begin': '''(?x)
(?!(?:while|for|do|if|else|switch|catch|enumerate|return|typeid|alignof|alignas|sizeof|[cr]?iterate)\\s*\\()
(?=
(?:[A-Za-z_][A-Za-z0-9_]*+|::)++\\s*\\( # actual name
|
(?:(?<=operator)(?:[-*&<>=+!]+|\\(\\)|\\[\\]))\\s*\\(
)
'''
'end': '(?<=\\))(?!\\w)'
'name': 'meta.function-call.c'
'patterns': [
{
'include': '#function-call-innards'
}
]
'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?'
'name': 'comment.line.banner.cpp'
}
{
'begin': '(^[ \\t]+)?(?=//)'
'beginCaptures':
'1':
'name': 'punctuation.whitespace.comment.leading.cpp'
'end': '(?!\\G)'
'patterns': [
{
'begin': '//'
'beginCaptures':
'0':
'name': 'punctuation.definition.comment.cpp'
'end': '(?=\\n)'
'name': 'comment.line.double-slash.cpp'
'patterns': [
{
'include': '#line_continuation_character'
}
]
}
]
}
]
'disabled':
# Consume nested preprocessor if(def)s
'begin': '^\\s*#\\s*if(n?def)?\\b.*$'
'end': '^\\s*#\\s*endif\\b'
'patterns': [
{
'include': '#disabled'
}
{
'include': '#pragma-mark'
}
]
'libc':
'captures':
'1':
'name': 'punctuation.whitespace.support.function.leading.c'
'2':
'name': 'support.function.C99.c'
'match': '''(?x) (\\s*) \\b
(_Exit|(?:nearbyint|nextafter|nexttoward|netoward|nan)[fl]?|a(?:cos|sin)h?[fl]?|abort|abs|asctime|assert
|atan(?:[h2]?[fl]?)?|atexit|ato[ifl]|atoll|bsearch|btowc|cabs[fl]?|cacos|cacos[fl]|cacosh[fl]?
|calloc|carg[fl]?|casinh?[fl]?|catanh?[fl]?|cbrt[fl]?|ccosh?[fl]?|ceil[fl]?|cexp[fl]?|cimag[fl]?
|clearerr|clock|clog[fl]?|conj[fl]?|copysign[fl]?|cosh?[fl]?|cpow[fl]?|cproj[fl]?|creal[fl]?
|csinh?[fl]?|csqrt[fl]?|ctanh?[fl]?|ctime|difftime|div|erfc?[fl]?|exit|fabs[fl]?
|exp(?:2[fl]?|[fl]|m1[fl]?)?|fclose|fdim[fl]?|fe[gs]et(?:env|exceptflag|round)|feclearexcept
|feholdexcept|feof|feraiseexcept|ferror|fetestexcept|feupdateenv|fflush|fgetpos|fgetw?[sc]
|floor[fl]?|fmax?[fl]?|fmin[fl]?|fmod[fl]?|fopen|fpclassify|fprintf|fputw?[sc]|fread|free|freopen
|frexp[fl]?|fscanf|fseek|fsetpos|ftell|fwide|fwprintf|fwrite|fwscanf|genv|get[sc]|getchar|gmtime
|gwc|gwchar|hypot[fl]?|ilogb[fl]?|imaxabs|imaxdiv|isalnum|isalpha|isblank|iscntrl|isdigit|isfinite
|isgraph|isgreater|isgreaterequal|isinf|isless(?:equal|greater)?|isw?lower|isnan|isnormal|isw?print
|isw?punct|isw?space|isunordered|isw?upper|iswalnum|iswalpha|iswblank|iswcntrl|iswctype|iswdigit|iswgraph
|isw?xdigit|labs|ldexp[fl]?|ldiv|lgamma[fl]?|llabs|lldiv|llrint[fl]?|llround[fl]?|localeconv|localtime
|log[2b]?[fl]?|log1[p0][fl]?|longjmp|lrint[fl]?|lround[fl]?|malloc|mbr?len|mbr?towc|mbsinit|mbsrtowcs
|mbstowcs|memchr|memcmp|memcpy|memmove|memset|mktime|modf[fl]?|perror|pow[fl]?|printf|puts|putw?c(?:har)?
|qsort|raise|rand|remainder[fl]?|realloc|remove|remquo[fl]?|rename|rewind|rint[fl]?|round[fl]?|scalbl?n[fl]?
|scanf|setbuf|setjmp|setlocale|setvbuf|signal|signbit|sinh?[fl]?|snprintf|sprintf|sqrt[fl]?|srand|sscanf
|strcat|strchr|strcmp|strcoll|strcpy|strcspn|strerror|strftime|strlen|strncat|strncmp|strncpy|strpbrk
|strrchr|strspn|strstr|strto[kdf]|strtoimax|strtol[dl]?|strtoull?|strtoumax|strxfrm|swprintf|swscanf
|system|tan|tan[fl]|tanh[fl]?|tgamma[fl]?|time|tmpfile|tmpnam|tolower|toupper|trunc[fl]?|ungetw?c|va_arg
|va_copy|va_end|va_start|vfw?printf|vfw?scanf|vprintf|vscanf|vsnprintf|vsprintf|vsscanf|vswprintf|vswscanf
|vwprintf|vwscanf|wcrtomb|wcscat|wcschr|wcscmp|wcscoll|wcscpy|wcscspn|wcsftime|wcslen|wcsncat|wcsncmp|wcsncpy
|wcspbrk|wcsrchr|wcsrtombs|wcsspn|wcsstr|wcsto[dkf]|wcstoimax|wcstol[dl]?|wcstombs|wcstoull?|wcstoumax|wcsxfrm
|wctom?b|wmem(?:set|chr|cpy|cmp|move)|wprintf|wscanf)\\b
'''
'line_continuation_character':
'patterns': [
{
'match': '(\\\\)\\n'
'captures':
'1':
'name': 'constant.character.escape.line-continuation.c'
}
]
'numbers':
'patterns': [
{
'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'
'name': 'constant.numeric.c'
}
]
'parens':
'begin': '\\('
'beginCaptures':
'0':
'name': 'punctuation.section.parens.begin.bracket.round.c'
'end': '\\)'
'endCaptures':
'0':
'name': 'punctuation.section.parens.end.bracket.round.c'
'patterns': [
{
'include': '$base'
}
]
'parens-block':
'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'
}
]
'pragma-mark':
'captures':
'1':
'name': 'meta.preprocessor.pragma.c'
'2':
'name': 'keyword.control.directive.pragma.pragma-mark.c'
'3':
'name': 'punctuation.definition.directive.c'
'4':
'name': 'entity.name.tag.pragma-mark.c'
'match': '^\\s*(((#)\\s*pragma\\s+mark)\\s+(.*))'
'name': 'meta.section'
'operators':
'patterns': [
{
'match': '(?<![\\w$])(sizeof)(?![\\w$])'
'name': 'keyword.operator.sizeof.c'
}
{
'match': '--'
'name': 'keyword.operator.decrement.c'
}
{
'match': '\\+\\+'
'name': 'keyword.operator.increment.c'
}
{
'match': '%=|\\+=|-=|\\*=|(?<!\\()/='
'name': 'keyword.operator.assignment.compound.c'
}
{
'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'
}
{
'begin': '\\?'
'beginCaptures':
'0':
'name': 'keyword.operator.ternary.c'
'end': ':'
'applyEndPatternLast': true # To prevent matching C++ namespace access ::
'endCaptures':
'0':
'name': 'keyword.operator.ternary.c'
'patterns': [
{
'include': '#access'
}
{
'include': '#libc'
}
{
'include': '#c_function_call'
}
{
'include': '$base'
}
]
}
]
'strings':
'patterns': [
{
'begin': '"'
'beginCaptures':
'0':
'name': 'punctuation.definition.string.begin.c'
'end': '"'
'endCaptures':
'0':
'name': 'punctuation.definition.string.end.c'
'name': 'string.quoted.double.c'
'patterns': [
{
'include': '#string_escaped_char'
}
{
'include': '#string_placeholder'
}
{
'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.single.c'
'patterns': [
{
'include': '#string_escaped_char'
}
{
'include': '#line_continuation_character'
}
]
}
]
'string_escaped_char':
'patterns': [
{
'match': '''(?x)\\\\ (
\\\\ |
[abefnprtv'"?] |
[0-3]\\d{,2} |
[4-7]\\d? |
x[a-fA-F0-9]{,2} |
u[a-fA-F0-9]{,4} |
U[a-fA-F0-9]{,8} )
'''
'name': 'constant.character.escape.c'
}
{
'match': '\\\\.'
'name': 'invalid.illegal.unknown-escape.c'
}
]
'string_placeholder':
'patterns': [
{
'match': '''(?x) %
(\\d+\\$)? # field (argument #)
[#0\\- +']* # flags
[,;:_]? # separator character (AltiVec)
((-?\\d+)|\\*(-?\\d+\\$)?)? # minimum field width
(\\.((-?\\d+)|\\*(-?\\d+\\$)?)?)? # precision
(hh|h|ll|l|j|t|z|q|L|vh|vl|v|hv|hl)? # length modifier
[diouxXDOUeEfFgGaACcSspn%] # conversion type
'''
'name': 'constant.other.placeholder.c'
}
{
'match': '(%)(?!"\\s*(PRI|SCN))'
'captures':
'1':
'name': 'invalid.illegal.placeholder.c'
}
]
'storage_types':
'patterns': [
{
'match': '\\b(asm|__asm__|auto|bool|_Bool|char|_Complex|double|enum|float|_Imaginary|int|long|short|signed|struct|typedef|union|unsigned|void)\\b'
'name': 'storage.type.c'
}
]
'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': [
{
'begin': '\\G(?=.)(?!//|/\\*(?!.*\\\\\\s*\\n))'
'end': '(?=//)|(?=/\\*(?!.*\\\\\\s*\\n))|(?<!\\\\)(?=\\n)'
'name': 'meta.preprocessor.c'
'patterns': [
{
'include': '#preprocessor-rule-conditional-line'
}
]
}
#NEVER CHANGE THE ORDER OF THE FOLLOWING INCLUDES!!!
#Their order provides commenting logic
{
'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': [
{
'begin': '\\G(?=.)(?!//|/\\*(?!.*\\\\\\s*\\n))'
'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': [
{
#the valid "defined" keyword usage
'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'
}
{
#consume prohibited macro names
'match': '\\bdefined\\b'
'name': 'invalid.illegal.macro-name.c'
}
{
'include': '#comments'
}
{
'include': '#strings'
}
{
'include': '#numbers'
}
{
#Catch ternary operators here and implement a custom one
'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': [
{
'begin': '\\G(?=.)(?!//|/\\*(?!.*\\\\\\s*\\n))'
'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': [
{
'begin': '\\G(?=.)(?!//|/\\*(?!.*\\\\\\s*\\n))'
'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': [
{
'begin': '\\G(?=.)(?!//|/\\*(?!.*\\\\\\s*\\n))'
'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': [
{
'begin': '\\G(?=.)(?!//|/\\*(?!.*\\\\\\s*\\n))'
'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': [
{
'begin': '\\G(?=.)(?!//|/\\*(?!.*\\\\\\s*\\n))'
'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'
}
{
'include': '#pragma-mark'
}
]
}
]
'preprocessor-rule-enabled':
'patterns': [
{
'begin': '^\\s*((#)\\s*if\\b)(?=\\s*\\(*\\b0*1\\b\\)*\\s*(?:$|//|/\\*))'
'beginCaptures':
'0':
'name': 'meta.preprocessor.c'
'1':
'name': 'keyword.control.directive.conditional.c'
'2':
'name': 'punctuation.definition.directive.c'
'3':
'name': 'constant.numeric.preprocessor.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': [
{
'begin': '\\G(?=.)(?!//|/\\*(?!.*\\\\\\s*\\n))'
'end': '(?=//)|(?=/\\*(?!.*\\\\\\s*\\n))|(?=\\n)'
'name': 'meta.preprocessor.c'
'patterns': [
{
'include': '#preprocessor-rule-conditional-line'
}
]
}
{
'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.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'
}
]
}
]
}
]
'preprocessor-rule-enabled-block':
'patterns': [
{
'begin': '^\\s*((#)\\s*if\\b)(?=\\s*\\(*\\b0*1\\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': [
{
'begin': '\\G(?=.)(?!//|/\\*(?!.*\\\\\\s*\\n))'
'end': '(?=//)|(?=/\\*(?!.*\\\\\\s*\\n))|(?=\\n)'
'name': 'meta.preprocessor.c'
'patterns': [
{
'include': '#preprocessor-rule-conditional-line'
}
]
}
{
'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'
}
]
}
]
}
]
'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'
'2':
'name': 'punctuation.definition.directive.c'
'end': '(?=^\\s*((#)\\s*endif\\b))'
'patterns': [
{
'begin': '\\G(?=.)(?!//|/\\*(?!.*\\\\\\s*\\n))'
'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.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'
}
]
}
]
'preprocessor-rule-enabled-elif-block':
'begin': '^\\s*((#)\\s*elif\\b)(?=\\s*\\(*\\b0*1\\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))'
'patterns': [
{
'begin': '\\G(?=.)(?!//|/\\*(?!.*\\\\\\s*\\n))'
'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':
'name': 'meta.preprocessor.c'
'1':
'name': 'keyword.control.directive.conditional.c'
'2':
'name': 'punctuation.definition.directive.c'
'end': '(?=^\\s*((#)\\s*endif\\b))'
'patterns': [
{
'include': '$base'
}
]
'preprocessor-rule-enabled-else-block':
'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))'
'patterns': [
{
'include': '#block_innards'
}
]
'preprocessor-rule-define-line-contents':
'patterns': [
{
'include': '#vararg_ellipses'
}
{
# block pattern for #define lines (terminates at newline w/o line_continuation_character)
'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'
}
]
}
{
'match': '\\('
'name': 'punctuation.section.parens.begin.bracket.round.c'
}
{
'match': '\\)'
'name': 'punctuation.section.parens.end.bracket.round.c'
}
{
# Function scope patterns for #define lines (terminates at newline w/o line_continuation_character)
# FIRST CAPTURE meta.function.c scope (provides an injectable scope, balanced parentheses and prevents unnecessary scope nesting)
'begin': '''(?x)
(?!(?:while|for|do|if|else|switch|catch|enumerate|return|typeid|alignof|alignas|sizeof|[cr]?iterate|asm|__asm__|auto|bool|_Bool|char|_Complex|double|enum|float|_Imaginary|int|long|short|signed|struct|typedef|union|unsigned|void)\\s*\\()
(?=
(?:[A-Za-z_][A-Za-z0-9_]*+|::)++\\s*\\( # actual name
|
(?:(?<=operator)(?:[-*&<>=+!]+|\\(\\)|\\[\\]))\\s*\\(
)
'''
'end': '(?<=\\))(?!\\w)|(?<!\\\\)(?=\\s*\\n)'
'name': 'meta.function.c'
'patterns': [
{
'include': '#preprocessor-rule-define-line-functions'
}
]
}
{
# double quoted string patterns for #define lines (terminates at newline w/o 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.double.c'
'patterns': [
{
'include': '#string_escaped_char'
}
{
'include': '#string_placeholder'
}
{
'include': '#line_continuation_character'
}
]
}
{
# single quoted string patterns for #define lines (terminates at newline w/o 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'
}
{
'include': '#line_continuation_character'
}
]
}
{
'include': '#access'
}
{
'include': '#libc'
}
{
'include': '$base'
}
]
'preprocessor-rule-define-line-blocks':
'patterns': [
{
# Prevent unnecessary nesting of meta.block.c scope
'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'
'patterns': [
{
'include': '#preprocessor-rule-define-line-blocks'
}
{
'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'
}
{
'include': '#access'
}
{
'include': '#operators'
}
{
# Function patterns in #define lines (terminates at newline w/o line_continuation_character)
'begin': '''(?x)
(?!(?:while|for|do|if|else|switch|catch|enumerate|return|typeid|alignof|alignas|sizeof|[cr]?iterate)\\s*\\()
(
(?:[A-Za-z_][A-Za-z0-9_]*+|::)++ # actual name
|
(?:(?<=operator)(?:[-*&<>=+!]+|\\(\\)|\\[\\]))
)
\\s*(\\()
'''
'beginCaptures':
'1':
'name': 'entity.name.function.c'
'2':
'name': 'punctuation.section.arguments.begin.bracket.round.c'
'end': '(\\))|(?<!\\\\)(?=\\s*\\n)'
'endCaptures':
'1':
'name': 'punctuation.section.arguments.end.bracket.round.c'
'patterns': [
{
'include': '#preprocessor-rule-define-line-functions'
}
]
}
{
# Capture parentheses (terminates at newline w/o line_continuation_character)
'begin': '\\('
'beginCaptures':
'0':
'name': 'punctuation.section.parens.begin.bracket.round.c'
'end': '(\\))|(?<!\\\\)(?=\\s*\\n)'
'endCaptures':
'1':
'name': 'punctuation.section.parens.end.bracket.round.c'
'patterns': [
{
# Provides right matching of inner parentheses
'include': '#preprocessor-rule-define-line-functions'
}
]
}
{
'include': '#preprocessor-rule-define-line-contents'
}
]
'function-innards':
'patterns': [
{
'include': '#comments'
}
{
'include': '#storage_types'
}
{
'include': '#operators'
}
{
'include': '#vararg_ellipses'
}
{
'begin': '''(?x)
(?!(?:while|for|do|if|else|switch|catch|enumerate|return|typeid|alignof|alignas|sizeof|[cr]?iterate)\\s*\\()
(
(?:[A-Za-z_][A-Za-z0-9_]*+|::)++ # actual name
|
(?:(?<=operator)(?:[-*&<>=+!]+|\\(\\)|\\[\\]))
)
\\s*(\\()
'''
'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': [
{
'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'
}
]
'function-call-innards':
'patterns': [
{
'include': '#comments'
}
{
'include': '#storage_types'
}
{
'include': '#access'
}
{
'include': '#operators'
}
{
'begin': '''(?x)
(?!(?:while|for|do|if|else|switch|catch|enumerate|return|typeid|alignof|alignas|sizeof|[cr]?iterate)\\s*\\()
(
(?:[A-Za-z_][A-Za-z0-9_]*+|::)++ # actual name
|
(?:(?<=operator)(?:[-*&<>=+!]+|\\(\\)|\\[\\]))
)
\\s*(\\()
'''
'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'
}
]
}
{
'include': '#block_innards'
}
]