{ "scopeName": "source.c", "fileTypes": [ "c", "h" ], "firstLineMatch": "(?i)-\\*-[^*]*(Mode:\\s*)?C(\\s*;.*?)?\\s*-\\*-", "name": "C", "patterns": [ { "include": "#preprocessor-rule-enabled" }, { "include": "#preprocessor-rule-disabled" }, { "include": "#preprocessor-rule-other" }, { "include": "#comments" }, { "match": "\\b(break|case|continue|default|do|else|for|goto|if|_Pragma|return|switch|while)\\b", "name": "keyword.control.c" }, { "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" }, { "match": "\\b(const|extern|register|restrict|static|volatile|inline)\\b", "name": "storage.modifier.c" }, { "comment": "common C constant naming idiom -- 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": "#sizeof" }, { "include": "#numbers" }, { "include": "#strings" }, { "begin": "(?x)\n^\\s* ((\\#)\\s*define) \\s+ # define\n((?[a-zA-Z_$][\\w$]*)) # macro name\n(?:\n (\\()\n (\n \\s* \\g \\s* # first argument\n ((,) \\s* \\g \\s*)* # additional arguments\n (?:\\.\\.\\.)? # varargs ellipsis?\n )\n (\\))\n)?", "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": "(?=(?://|/\\*))|(?", "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": "(?=(?://|/\\*))|(?]) # type modifier before name\n )\n)\n(\\s*)(?!(while|for|do|if|else|switch|catch|enumerate|return|sizeof|[cr]?iterate)\\s*\\()\n(\n (?:[A-Za-z_][A-Za-z0-9_]*+|::)++ # actual name\n |\n (?:(?<=operator)(?:[-*&<>=+!]+|\\(\\)|\\[\\])) # if it is a C++ operator\n)\n\\s*(?=\\()", "beginCaptures": { "1": { "name": "punctuation.whitespace.function.leading.c" }, "3": { "name": "entity.name.function.c" }, "4": { "name": "punctuation.definition.parameters.c" } }, "end": "(?<=\\})|(?=#)|(;)", "name": "meta.function.c", "patterns": [ { "include": "#comments" }, { "include": "#parens" }, { "match": "\\b(const)\\b", "name": "storage.modifier.c" }, { "include": "#block" } ] }, { "include": "#line_continuation_character" } ], "repository": { "access": { "captures": { "2": { "name": "punctuation.separator.dot-access.c" }, "3": { "name": "punctuation.separator.pointer-access.c" }, "4": { "name": "variable.other.member.c" } }, "match": "((\\.)|(->))([a-zA-Z_][a-zA-Z_0-9]*)\\b(?!\\s*\\()" }, "block": { "patterns": [ { "begin": "\\{", "beginCaptures": { "0": { "name": "punctuation.section.block.begin.c" } }, "end": "\\}|(?=\\s*#\\s*endif\\b)", "endCaptures": { "0": { "name": "punctuation.section.block.end.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-other-block" }, { "include": "#sizeof" }, { "include": "#access" }, { "include": "#libc" }, { "include": "#c_function_call" }, { "captures": { "1": { "name": "variable.other.c" }, "2": { "name": "punctuation.definition.parameters.c" } }, "match": "(?x)\n\t\t\t (?x)\n\t\t\t(?: \n\t\t\t (?: (?= \\s ) (?=+!]+ | \\(\\) | \\[\\] ) ) # if it is a C++ operator\n\t\t\t)\n\t\t\t \\s*(\\()", "name": "meta.initialization.c" }, { "include": "#block" }, { "include": "$base" } ] }, "c_function_call": { "captures": { "1": { "name": "punctuation.whitespace.function-call.leading.c" }, "2": { "name": "support.function.any-method.c" }, "4": { "name": "punctuation.definition.parameters.c" } }, "match": "(?x) (?: (?= \\s ) (?:(?<=else|new|return) | (?