{ "scopeName": "source.c", "fileTypes": [ "c", "h.in" ], "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" }, { "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)\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)(?:[-*&<>=+!]+|\\(\\)|\\[\\]))\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": "#access" }, { "include": "#libc" }, { "include": "#c_function_call" }, { "captures": { "1": { "name": "variable.other.c" }, "2": { "name": "punctuation.definition.parameters.c" } }, "match": "(?x)\n(?:\n (?:\n (?=\\s)(?=+!]+ | \\(\\) | \\[\\]))\n)\n\\s*(\\() # opening bracket", "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)\n(?:\n (?=\\s)\n (?:(?<=else|new|return) | (?>=|\\|=", "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": ":", "endCaptures": { "0": { "name": "keyword.operator.ternary.c" } }, "patterns": [ { "include": "#access" }, { "include": "#libc" }, { "include": "#c_function_call" }, { "include": "$self" } ] } ] }, "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)\\\\ (\n\\\\ |\n[abefnprtv'\"?] |\n[0-3]\\d{,2} |\n[4-7]\\d? |\nx[a-fA-F0-9]{,2} |\nu[a-fA-F0-9]{,4} |\nU[a-fA-F0-9]{,8} )", "name": "constant.character.escape.c" }, { "match": "\\\\.", "name": "invalid.illegal.unknown-escape.c" } ] }, "string_placeholder": { "patterns": [ { "match": "(?x) %\n(\\d+\\$)? # field (argument #)\n[#0\\- +']* # flags\n[,;:_]? # separator character (AltiVec)\n((-?\\d+)|\\*(-?\\d+\\$)?)? # minimum field width\n(\\.((-?\\d+)|\\*(-?\\d+\\$)?)?)? # precision\n(hh|h|ll|l|j|t|z|q|L|vh|vl|v|hv|hl)? # length modifier\n[diouxXDOUeEfFgGaACcSspn%] # conversion type", "name": "constant.other.placeholder.c" }, { "match": "%", "name": "invalid.illegal.placeholder.c" } ] } }, "version": "https://github.com/atom/language-c/commit/0d0f32388e73fc91a86f4c31ff59c36191869d63" }