{ "information_for_contributors": [ "This file has been converted from https://github.com/jeff-hykin/cpp-textmate-grammar/blob/master//syntaxes/cpp.tmLanguage.json", "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." ], "version": "https://github.com/jeff-hykin/cpp-textmate-grammar/commit/84a65f7cce43f15aceaf1854c5bcc779c8575fe7", "name": "C++", "scopeName": "source.cpp", "patterns": [ { "include": "#special_block" }, { "match": "##[a-zA-Z_]\\w*(?!\\w)", "name": "variable.other.macro.argument.cpp" }, { "include": "#strings" }, { "match": "(?(?-mix:[a-zA-Z_$][\\w$]*)))\t # macro name\n(?:\n (\\()\n\t(\n\t \\s* \\g \\s*\t\t # first argument\n\t ((,) \\s* \\g \\s*)* # additional arguments\n\t (?:\\.\\.\\.)?\t\t\t# varargs ellipsis?\n\t)\n (\\))\n)?", "beginCaptures": { "1": { "name": "keyword.control.directive.define.cpp" }, "2": { "name": "punctuation.definition.directive.cpp" }, "3": { "name": "entity.name.function.preprocessor.cpp" }, "5": { "name": "punctuation.definition.parameters.begin.cpp" }, "6": { "name": "variable.parameter.preprocessor.cpp" }, "8": { "name": "punctuation.separator.parameters.cpp" }, "9": { "name": "punctuation.definition.parameters.end.cpp" } }, "end": "(?=(?://|/\\*))|(?", "endCaptures": { "0": { "name": "punctuation.definition.string.end.cpp" } }, "name": "string.quoted.other.lt-gt.include.cpp" } ] }, { "include": "#pragma-mark" }, { "name": "meta.preprocessor.cpp", "begin": "^\\s*((#)\\s*line)\\b", "beginCaptures": { "1": { "name": "keyword.control.directive.line.cpp" }, "2": { "name": "punctuation.definition.directive.cpp" } }, "end": "(?=(?://|/\\*))|(?,\\w])*>\\s*", "captures": { "0": { "name": "meta.template.call.cpp", "patterns": [ { "include": "#storage_types" }, { "include": "#constants" }, { "include": "#scope_resolution" }, { "match": "(?\\s*$)", "captures": { "1": { "name": "storage.type.template.cpp" }, "2": { "name": "punctuation.section.angle-brackets.start.template.definition.cpp" }, "3": { "name": "meta.template.definition.cpp", "patterns": [ { "include": "#scope_resolution" }, { "include": "#template_definition_argument" }, { "include": "#template_argument_defaulted" }, { "include": "#template_call_innards" }, { "include": "$base" } ] }, "4": { "name": "punctuation.section.angle-brackets.end.template.definition.cpp" } } }, "template_definition": { "name": "meta.template.definition.cpp", "begin": "(?)", "endCaptures": { "1": { "name": "punctuation.section.angle-brackets.end.template.definition.cpp" } }, "patterns": [ { "begin": "((?<=\\w)\\s*<)", "beginCaptures": { "1": { "name": "punctuation.section.angle-brackets.begin.template.call.cpp" } }, "end": "(>)", "endCaptures": { "1": { "name": "punctuation.section.angle-brackets.begin.template.call.cpp" } }, "patterns": [ { "include": "#storage_types" }, { "include": "#constants" }, { "include": "#scope_resolution" }, { "match": "(?|$))", "captures": { "1": { "name": "storage.type.template.argument.$1.cpp" }, "2": { "name": "storage.type.template.argument.$2.cpp" }, "3": { "name": "entity.name.type.template.cpp" }, "4": { "name": "storage.type.template.cpp" }, "5": { "name": "ellipses.cpp punctuation.vararg-ellipses.template.definition.cpp" }, "6": { "name": "entity.name.type.template.cpp" }, "7": { "name": "comma.cpp punctuation.separator.template.argument.cpp" } } }, "scope_resolution": { "match": "((?:[a-zA-Z_]\\w*\\s*(?:(?-mix:(?:<(?:[\\s<>,\\w])*>\\s*)))?::)*\\s*)([a-zA-Z_]\\w*)\\s*(?:(<(?:[\\s<>,\\w])*>\\s*))?(::)", "captures": { "1": { "patterns": [ { "include": "#scope_resolution" } ] }, "2": { "name": "entity.name.namespace.scope-resolution.cpp" }, "3": { "name": "meta.template.call.cpp", "patterns": [ { "include": "#storage_types" }, { "include": "#constants" }, { "include": "#scope_resolution" }, { "match": "(?>=|\\|=", "name": "keyword.operator.assignment.compound.bitwise.cpp" }, { "match": "<<|>>", "name": "keyword.operator.bitwise.shift.cpp" }, { "match": "!=|<=|>=|==|<|>", "name": "keyword.operator.comparison.cpp" }, { "match": "&&|!|\\|\\|", "name": "keyword.operator.logical.cpp" }, { "match": "&|\\||\\^|~", "name": "keyword.operator.cpp" }, { "match": "=", "name": "keyword.operator.assignment.cpp" }, { "match": "%|\\*|/|-|\\+", "name": "keyword.operator.cpp" }, { "begin": "\\?", "beginCaptures": { "0": { "name": "keyword.operator.ternary.cpp" } }, "end": ":", "applyEndPatternLast": true, "endCaptures": { "0": { "name": "keyword.operator.ternary.cpp" } }, "patterns": [ { "include": "#method_access" }, { "include": "#member_access" }, { "include": "#c_function_call" }, { "include": "$base" } ] } ] }, "probably_a_parameter": { "match": "(?:([a-zA-Z_]\\w*\\s*(?==))|((?<=\\w |\\*\\/|[&*>\\]\\)]|\\.\\.\\.)\\s*[a-zA-Z_]\\w*\\s*(?=(?:\\[\\]\\s*)?(?:,|\\)))))", "captures": { "1": { "name": "variable.parameter.defaulted.cpp" }, "2": { "name": "variable.parameter.cpp" } } }, "operator_overload": { "name": "meta.function.definition.parameters.operator-overload.cpp", "begin": "(operator)((?:\\s*(?:\\+\\+|\\-\\-|\\(\\)|\\[\\]|\\->|\\+\\+|\\-\\-|\\+|\\-|!|~|\\*|&|\\->\\*|\\*|\\/|%|\\+|\\-|<<|>>|<=>|<|<=|>|>=|==|!=|&|\\^|\\||&&|\\|\\||=|\\+=|\\-=|\\*=|\\/=|%=|<<=|>>=|&=|\\^=|\\|=|,)|\\s+(?:(?:new|new\\[\\]|delete|delete\\[\\])|(?:[a-zA-Z_]\\w*\\s*(?:(?-mix:(?:<(?:[\\s<>,\\w])*>\\s*)))?::)*[a-zA-Z_]\\w*\\s*(?:&)?)))\\s*(\\()", "beginCaptures": { "1": { "name": "keyword.other.operator.overload.cpp" }, "2": { "name": "entity.name.operator.overloadee.cpp", "patterns": [ { "include": "#scope_resolution" } ] }, "3": { "name": "punctuation.section.parameters.begin.bracket.round.operator-overload.cpp" } }, "end": "(\\))", "endCaptures": { "1": { "name": "punctuation.section.parameters.end.bracket.round.operator-overload.cpp" } }, "patterns": [ { "include": "#probably_a_parameter" }, { "include": "#function-innards-c" } ] }, "member_access": { "match": "(?:((?\\*|->)))((?:[a-zA-Z_]\\w*\\s*(?-mix:(?:(?:\\.\\*|\\.))|(?:(?:->\\*|->)))\\s*)*)\\s*(\\b(?!auto[^(?-mix:\\w)]|void[^(?-mix:\\w)]|char[^(?-mix:\\w)]|short[^(?-mix:\\w)]|int[^(?-mix:\\w)]|signed[^(?-mix:\\w)]|unsigned[^(?-mix:\\w)]|long[^(?-mix:\\w)]|float[^(?-mix:\\w)]|double[^(?-mix:\\w)]|bool[^(?-mix:\\w)]|wchar_t[^(?-mix:\\w)]|u_char[^(?-mix:\\w)]|u_short[^(?-mix:\\w)]|u_int[^(?-mix:\\w)]|u_long[^(?-mix:\\w)]|ushort[^(?-mix:\\w)]|uint[^(?-mix:\\w)]|u_quad_t[^(?-mix:\\w)]|quad_t[^(?-mix:\\w)]|qaddr_t[^(?-mix:\\w)]|caddr_t[^(?-mix:\\w)]|daddr_t[^(?-mix:\\w)]|div_t[^(?-mix:\\w)]|dev_t[^(?-mix:\\w)]|fixpt_t[^(?-mix:\\w)]|blkcnt_t[^(?-mix:\\w)]|blksize_t[^(?-mix:\\w)]|gid_t[^(?-mix:\\w)]|in_addr_t[^(?-mix:\\w)]|in_port_t[^(?-mix:\\w)]|ino_t[^(?-mix:\\w)]|key_t[^(?-mix:\\w)]|mode_t[^(?-mix:\\w)]|nlink_t[^(?-mix:\\w)]|id_t[^(?-mix:\\w)]|pid_t[^(?-mix:\\w)]|off_t[^(?-mix:\\w)]|segsz_t[^(?-mix:\\w)]|swblk_t[^(?-mix:\\w)]|uid_t[^(?-mix:\\w)]|id_t[^(?-mix:\\w)]|clock_t[^(?-mix:\\w)]|size_t[^(?-mix:\\w)]|ssize_t[^(?-mix:\\w)]|time_t[^(?-mix:\\w)]|useconds_t[^(?-mix:\\w)]|suseconds_t[^(?-mix:\\w)]|pthread_attr_t[^(?-mix:\\w)]|pthread_cond_t[^(?-mix:\\w)]|pthread_condattr_t[^(?-mix:\\w)]|pthread_mutex_t[^(?-mix:\\w)]|pthread_mutexattr_t[^(?-mix:\\w)]|pthread_once_t[^(?-mix:\\w)]|pthread_rwlock_t[^(?-mix:\\w)]|pthread_rwlockattr_t[^(?-mix:\\w)]|pthread_t[^(?-mix:\\w)]|pthread_key_t[^(?-mix:\\w)]|int8_t[^(?-mix:\\w)]|int16_t[^(?-mix:\\w)]|int32_t[^(?-mix:\\w)]|int64_t[^(?-mix:\\w)]|uint8_t[^(?-mix:\\w)]|uint16_t[^(?-mix:\\w)]|uint32_t[^(?-mix:\\w)]|uint64_t[^(?-mix:\\w)]|int_least8_t[^(?-mix:\\w)]|int_least16_t[^(?-mix:\\w)]|int_least32_t[^(?-mix:\\w)]|int_least64_t[^(?-mix:\\w)]|uint_least8_t[^(?-mix:\\w)]|uint_least16_t[^(?-mix:\\w)]|uint_least32_t[^(?-mix:\\w)]|uint_least64_t[^(?-mix:\\w)]|int_fast8_t[^(?-mix:\\w)]|int_fast16_t[^(?-mix:\\w)]|int_fast32_t[^(?-mix:\\w)]|int_fast64_t[^(?-mix:\\w)]|uint_fast8_t[^(?-mix:\\w)]|uint_fast16_t[^(?-mix:\\w)]|uint_fast32_t[^(?-mix:\\w)]|uint_fast64_t[^(?-mix:\\w)]|intptr_t[^(?-mix:\\w)]|uintptr_t[^(?-mix:\\w)]|intmax_t[^(?-mix:\\w)]|intmax_t[^(?-mix:\\w)]|uintmax_t[^(?-mix:\\w)]|uintmax_t[^(?-mix:\\w)])[a-zA-Z_]\\w*\\b(?!\\())", "captures": { "1": { "name": "variable.language.this.cpp" }, "2": { "name": "variable.other.object.access.cpp" }, "3": { "name": "punctuation.separator.dot-access.cpp" }, "4": { "name": "punctuation.separator.pointer-access.cpp" }, "5": { "patterns": [ { "match": "(?<=(?:\\.\\*|\\.|->|->\\*))\\s*(?-mix:(?:(?:(?\\*|->))))", "name": "variable.other.object.property.cpp" }, { "match": "(?:((?\\*|->)))", "captures": { "1": { "name": "variable.language.this.cpp" }, "2": { "name": "variable.other.object.access.cpp" }, "3": { "name": "punctuation.separator.dot-access.cpp" }, "4": { "name": "punctuation.separator.pointer-access.cpp" } } }, { "include": "#member_access" }, { "include": "#method_access" } ] }, "6": { "name": "variable.other.property.cpp" } } }, "method_access": { "contentName": "meta.function-call.member", "begin": "(?:((?\\*|->)))((?:[a-zA-Z_]\\w*\\s*(?-mix:(?:(?:\\.\\*|\\.))|(?:(?:->\\*|->)))\\s*)*)\\s*([a-zA-Z_]\\w*)(\\()", "beginCaptures": { "1": { "name": "variable.language.this.cpp" }, "2": { "name": "variable.other.object.access.cpp" }, "3": { "name": "punctuation.separator.dot-access.cpp" }, "4": { "name": "punctuation.separator.pointer-access.cpp" }, "5": { "patterns": [ { "match": "(?<=(?:\\.\\*|\\.|->|->\\*))\\s*(?-mix:(?:(?:(?\\*|->))))", "name": "variable.other.object.property.cpp" }, { "match": "(?:((?\\*|->)))", "captures": { "1": { "name": "variable.language.this.cpp" }, "2": { "name": "variable.other.object.access.cpp" }, "3": { "name": "punctuation.separator.dot-access.cpp" }, "4": { "name": "punctuation.separator.pointer-access.cpp" } } }, { "include": "#member_access" }, { "include": "#method_access" } ] }, "6": { "name": "entity.name.function.member.cpp" }, "7": { "name": "punctuation.section.arguments.begin.bracket.round.function.member.cpp" } }, "end": "(\\))", "endCaptures": { "1": { "name": "punctuation.section.arguments.end.bracket.round.function.member.cpp" } }, "patterns": [ { "include": "#function-call-innards-c" } ] }, "lambdas": { "begin": "((?:(?<=[^\\s]|^)(?)(.+?(?=\\{|$))?", "captures": { "1": { "name": "punctuation.definition.lambda.return-type.cpp" }, "2": { "name": "storage.type.return-type.lambda.cpp" } } }, { "name": "meta.function.definition.body.lambda.cpp", "begin": "(\\{)", "beginCaptures": { "1": { "name": "punctuation.section.block.begin.bracket.curly.lambda.cpp" } }, "end": "(\\})", "endCaptures": { "1": { "name": "punctuation.section.block.end.bracket.curly.lambda.cpp" } }, "patterns": [ { "include": "$base" } ] } ] }, "block": { "begin": "\\{", "beginCaptures": { "0": { "name": "punctuation.section.block.begin.bracket.curly.cpp" } }, "end": "\\}", "endCaptures": { "0": { "name": "punctuation.section.block.end.bracket.curly.cpp" } }, "name": "meta.block.cpp", "patterns": [ { "captures": { "1": { "name": "support.function.any-method.cpp" }, "2": { "name": "punctuation.definition.parameters.cpp" } }, "match": "(?x)\n(\n (?!while|for|do|if|else|switch|catch|return)\n (?:\\b[A-Za-z_][A-Za-z0-9_]*+\\b|::)*+ # actual name\n)\n\\s*(\\() # opening bracket", "name": "meta.function-call.cpp" }, { "include": "$base" } ] }, "constructor": { "patterns": [ { "begin": "(?x)\n(?:^\\s*) # beginning of line\n((?!while|for|do|if|else|switch|catch)[A-Za-z_][A-Za-z0-9_:]*) # actual name\n\\s*(\\() # opening bracket", "beginCaptures": { "1": { "name": "entity.name.function.constructor.cpp" }, "2": { "name": "punctuation.definition.parameters.begin.constructor.cpp" } }, "end": "\\)", "endCaptures": { "0": { "name": "punctuation.definition.parameters.end.constructor.cpp" } }, "name": "meta.function.constructor.cpp", "patterns": [ { "include": "#probably_a_parameter" }, { "include": "#function-innards-c" } ] }, { "begin": "(?x)\n(:)\n(\n (?=\n \\s*[A-Za-z_][A-Za-z0-9_:]* # actual name\n \\s* (\\() # opening bracket\n )\n)", "beginCaptures": { "1": { "name": "punctuation.definition.initializer-list.parameters.cpp" } }, "end": "(?=\\{)", "name": "meta.function.constructor.initializer-list.cpp", "patterns": [ { "include": "$base" } ] } ] }, "special_block": { "patterns": [ { "include": "#attribute_cpp" }, { "name": "meta.using-namespace.cpp", "begin": "(?,\\w])*>\\s*)))?::)*\\s*))?((?,\\w])*>\\s*)))?::)*\\s*)\\s*(?:((?\\[\\]=]))", "patterns": [ { "name": "meta.head.namespace.cpp", "begin": "\\G", "end": "((?:\\{|(?=;)))", "endCaptures": { "1": { "name": "punctuation.section.block.begin.bracket.curly.namespace.cpp" } } }, { "name": "meta.body.namespace.cpp", "begin": "(?<=\\{)", "end": "(\\})", "endCaptures": { "1": { "name": "punctuation.section.block.end.bracket.curly.namespace.cpp" } }, "patterns": [ { "include": "$base" } ] }, { "name": "meta.tail.namespace.cpp", "begin": "(?<=})[\\s\\n]*", "end": "[\\s\\n]*(?=;)", "patterns": [ { "include": "$base" } ] } ] }, { "name": "meta.block.class.cpp", "begin": "((((?\\[\\]=]))", "endCaptures": { "1": { "name": "punctuation.terminator.statement.cpp" }, "2": { "name": "punctuation.terminator.statement.cpp" } }, "patterns": [ { "name": "meta.head.class.cpp", "begin": "\\G", "end": "((?:\\{|(?=;)))", "endCaptures": { "1": { "name": "punctuation.section.block.begin.bracket.curly.class.cpp" } }, "patterns": [ { "match": ",", "name": "comma.cpp punctuation.separator.delimiter.inhertance.cpp" }, { "match": "(?:private|protected|public)", "name": "storage.type.modifier.access.$0.cpp" }, { "match": "(?<=private|protected|public|,|:)\\s*(?!(?:private|protected|public))((?)", "endCaptures": { "1": { "name": "punctuation.section.angle-brackets.end.template.call.cpp" } }, "patterns": [ { "include": "#storage_types" }, { "include": "#constants" }, { "include": "#scope_resolution" }, { "match": "(?\\[\\]=]))", "endCaptures": { "1": { "name": "punctuation.terminator.statement.cpp" }, "2": { "name": "punctuation.terminator.statement.cpp" } }, "patterns": [ { "name": "meta.head.struct.cpp", "begin": "\\G", "end": "((?:\\{|(?=;)))", "endCaptures": { "1": { "name": "punctuation.section.block.begin.bracket.curly.struct.cpp" } }, "patterns": [ { "match": ",", "name": "comma.cpp punctuation.separator.delimiter.inhertance.cpp" }, { "match": "(?:private|protected|public)", "name": "storage.type.modifier.access.$0.cpp" }, { "match": "(?<=private|protected|public|,|:)\\s*(?!(?:private|protected|public))((?)", "endCaptures": { "1": { "name": "punctuation.section.angle-brackets.end.template.call.cpp" } }, "patterns": [ { "include": "#storage_types" }, { "include": "#constants" }, { "include": "#scope_resolution" }, { "match": "(?\\[\\]=]))", "endCaptures": { "1": { "name": "punctuation.terminator.statement.cpp" }, "2": { "name": "punctuation.terminator.statement.cpp" } }, "patterns": [ { "name": "meta.head.union.cpp", "begin": "\\G", "end": "((?:\\{|(?=;)))", "endCaptures": { "1": { "name": "punctuation.section.block.begin.bracket.curly.union.cpp" } }, "patterns": [ { "match": ",", "name": "comma.cpp punctuation.separator.delimiter.inhertance.cpp" }, { "match": "(?:private|protected|public)", "name": "storage.type.modifier.access.$0.cpp" }, { "match": "(?<=private|protected|public|,|:)\\s*(?!(?:private|protected|public))((?)", "endCaptures": { "1": { "name": "punctuation.section.angle-brackets.end.template.call.cpp" } }, "patterns": [ { "include": "#storage_types" }, { "include": "#constants" }, { "include": "#scope_resolution" }, { "match": "(?,\\w])*>\\s*)))?::)*\\s*)([a-zA-Z_]\\w*)\\s*(?:(<(?:[\\s<>,\\w])*>\\s*))?(::)))?\\s*((?\\[\\]=]))", "endCaptures": { "1": { "name": "punctuation.terminator.statement.cpp" }, "2": { "name": "punctuation.terminator.statement.cpp" } }, "patterns": [ { "name": "meta.head.enum.cpp", "begin": "\\G", "end": "((?:\\{|(?=;)))", "endCaptures": { "1": { "name": "punctuation.section.block.begin.bracket.curly.enum.cpp" } } }, { "name": "meta.body.enum.cpp", "begin": "(?<=\\{)", "end": "(\\})", "endCaptures": { "1": { "name": "punctuation.section.block.end.bracket.curly.enum.cpp" } }, "patterns": [ { "include": "$base" } ] }, { "name": "meta.tail.enum.cpp", "begin": "(?<=})[\\s\\n]*", "end": "[\\s\\n]*(?=;)", "patterns": [ { "include": "$base" } ] } ] }, { "name": "meta.block.extern.cpp", "begin": "((\\bextern)(?=\\s*\\\"))", "beginCaptures": { "1": { "name": "meta.head.extern.cpp" }, "2": { "name": "storage.type.extern.cpp" } }, "end": "(?:(?:(?<=})\\s*(;)|(;))|(?=[;()>\\[\\]=]))", "endCaptures": { "1": { "name": "punctuation.terminator.statement.cpp" }, "2": { "name": "punctuation.terminator.statement.cpp" } }, "patterns": [ { "name": "meta.head.extern.cpp", "begin": "\\G", "end": "((?:\\{|(?=;)))", "endCaptures": { "1": { "name": "punctuation.section.block.begin.bracket.curly.extern.cpp" } }, "patterns": [ { "include": "$base" } ] }, { "name": "meta.body.extern.cpp", "begin": "(?<=\\{)", "end": "(\\})", "endCaptures": { "1": { "name": "punctuation.section.block.end.bracket.curly.extern.cpp" } }, "patterns": [ { "include": "$base" } ] }, { "name": "meta.tail.extern.cpp", "begin": "(?<=})[\\s\\n]*", "end": "[\\s\\n]*(?=;)", "patterns": [ { "include": "$base" } ] }, { "include": "$base" } ] } ] }, "strings": { "patterns": [ { "begin": "(u|u8|U|L)?\"", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.cpp" }, "1": { "name": "meta.encoding.cpp" } }, "end": "\"", "endCaptures": { "0": { "name": "punctuation.definition.string.end.cpp" } }, "name": "string.quoted.double.cpp", "patterns": [ { "match": "\\\\u\\h{4}|\\\\U\\h{8}", "name": "constant.character.escape.cpp" }, { "match": "\\\\['\"?\\\\abfnrtv]", "name": "constant.character.escape.cpp" }, { "match": "\\\\[0-7]{1,3}", "name": "constant.character.escape.cpp" }, { "match": "\\\\x\\h+", "name": "constant.character.escape.cpp" }, { "include": "#string_placeholder-c" } ] }, { "begin": "(u|u8|U|L)?R\"(?:([^ ()\\\\\\t]{0,16})|([^ ()\\\\\\t]*))\\(", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.cpp" }, "1": { "name": "meta.encoding.cpp" }, "3": { "name": "invalid.illegal.delimiter-too-long.cpp" } }, "end": "\\)\\2(\\3)\"", "endCaptures": { "0": { "name": "punctuation.definition.string.end.cpp" }, "1": { "name": "invalid.illegal.delimiter-too-long.cpp" } }, "name": "string.quoted.double.raw.cpp" } ] }, "block-c": { "patterns": [ { "begin": "{", "beginCaptures": { "0": { "name": "punctuation.section.block.begin.bracket.curly.cpp" } }, "end": "}|(?=\\s*#\\s*(?:elif|else|endif)\\b)", "endCaptures": { "0": { "name": "punctuation.section.block.end.bracket.curly.cpp" } }, "name": "meta.block.cpp", "patterns": [ { "include": "#block_innards-c" } ] } ] }, "block_innards-c": { "patterns": [ { "include": "#preprocessor-rule-enabled-block" }, { "include": "#preprocessor-rule-disabled-block" }, { "include": "#preprocessor-rule-conditional-block" }, { "include": "#method_access" }, { "include": "#member_access" }, { "include": "#c_function_call" }, { "name": "meta.initialization.cpp", "begin": "(?x)\n(?:\n (?:\n\t(?=\\s)(?=+!]+ | \\(\\) | \\[\\]))\n)\n\\s*(\\() # opening bracket", "beginCaptures": { "1": { "name": "variable.other.cpp" }, "2": { "name": "punctuation.section.parens.begin.bracket.round.initialization.cpp" } }, "end": "\\)", "endCaptures": { "0": { "name": "punctuation.section.parens.end.bracket.round.initialization.cpp" } }, "patterns": [ { "include": "#function-call-innards-c" } ] }, { "begin": "{", "beginCaptures": { "0": { "name": "punctuation.section.block.begin.bracket.curly.cpp" } }, "end": "}|(?=\\s*#\\s*(?:elif|else|endif)\\b)", "endCaptures": { "0": { "name": "punctuation.section.block.end.bracket.curly.cpp" } }, "patterns": [ { "include": "#block_innards-c" } ] }, { "include": "#parens-block-c" }, { "include": "$base" } ] }, "c_function_call": { "begin": "(?x)\n(?!(?:while|for|do|if|else|switch|catch|return|typeid|alignof|alignas|sizeof|and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq|alignof|alignas|constexpr|volatile|operator|(?:::)?new|(?:::)?delete)\\s*\\()\n(?=\n(?:[A-Za-z_][A-Za-z0-9_]*+|::)++\\s*(?-mix:(?:(?-mix:(?:<(?:[\\s<>,\\w])*>\\s*)))?)\\( # actual name\n|\n(?:(?<=operator)(?:[-*&<>=+!]+|\\(\\)|\\[\\]))\\s*\\(\n)", "end": "(?<=\\))(?!\\w)", "name": "meta.function-call.cpp", "patterns": [ { "include": "#function-call-innards-c" } ] }, "comments": { "patterns": [ { "captures": { "1": { "name": "meta.toc-list.banner.block.cpp" } }, "match": "^/\\* =(\\s*.*?)\\s*= \\*/$\\n?", "name": "comment.block.cpp" }, { "begin": "/\\*", "beginCaptures": { "0": { "name": "punctuation.definition.comment.begin.cpp" } }, "end": "\\*/", "endCaptures": { "0": { "name": "punctuation.definition.comment.end.cpp" } }, "name": "comment.block.cpp" }, { "captures": { "1": { "name": "meta.toc-list.banner.line.cpp" } }, "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": { "begin": "^\\s*#\\s*if(n?def)?\\b.*$", "end": "^\\s*#\\s*endif\\b", "patterns": [ { "include": "#disabled" }, { "include": "#pragma-mark" } ] }, "line_continuation_character": { "patterns": [ { "match": "(\\\\)\\n", "captures": { "1": { "name": "constant.character.escape.line-continuation.cpp" } } } ] }, "parens-c": { "name": "punctuation.section.parens-c.cpp", "begin": "\\(", "beginCaptures": { "0": { "name": "punctuation.section.parens.begin.bracket.round.cpp" } }, "end": "\\)", "endCaptures": { "0": { "name": "punctuation.section.parens.end.bracket.round.cpp" } }, "patterns": [ { "include": "$base" } ] }, "parens-block-c": { "name": "meta.block.parens.cpp", "begin": "\\(", "beginCaptures": { "0": { "name": "punctuation.section.parens.begin.bracket.round.cpp" } }, "end": "\\)", "endCaptures": { "0": { "name": "punctuation.section.parens.end.bracket.round.cpp" } }, "patterns": [ { "include": "#block_innards-c" }, { "match": "(?-mix:(?=+!]+|\\(\\)|\\[\\]))\\s*\\(\n)", "end": "(?<=\\))(?!\\w)|(?=+!]+|\\(\\)|\\[\\]))\n)\n\\s*(\\()", "beginCaptures": { "1": { "name": "entity.name.function.cpp" }, "2": { "name": "punctuation.section.arguments.begin.bracket.round.cpp" } }, "end": "(\\))|(?=+!]+|\\(\\)|\\[\\]))\n)\n\\s*(\\()", "beginCaptures": { "1": { "name": "entity.name.function.cpp" }, "2": { "name": "punctuation.section.parameters.begin.bracket.round.cpp" } }, "end": "(?-mix:\\)|:)", "endCaptures": { "0": { "name": "punctuation.section.parameters.end.bracket.round.cpp" } }, "patterns": [ { "include": "#probably_a_parameter" }, { "include": "#function-innards-c" } ] }, { "begin": "\\(", "beginCaptures": { "0": { "name": "punctuation.section.parens.begin.bracket.round.cpp" } }, "end": "\\)", "endCaptures": { "0": { "name": "punctuation.section.parens.end.bracket.round.cpp" } }, "patterns": [ { "include": "#function-innards-c" } ] }, { "include": "$base" } ] }, "function-call-innards-c": { "patterns": [ { "include": "#attribute_cpp" }, { "include": "#comments" }, { "include": "#storage_types" }, { "include": "#method_access" }, { "include": "#member_access" }, { "include": "#operators" }, { "begin": "(?x)\n(?!(?:while|for|do|if|else|switch|catch|return|typeid|alignof|alignas|sizeof|and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq|alignof|alignas)\\s*\\()\n(\n(?:new)\\s*((?-mix:(?:(?-mix:(?:<(?:[\\s<>,\\w])*>\\s*)))?)) # actual name\n|\n(?:(?<=operator)(?:[-*&<>=+!]+|\\(\\)|\\[\\]))\n)\n\\s*(\\()", "beginCaptures": { "1": { "name": "keyword.operator.wordlike.cpp memory.cpp keyword.operator.new.cpp" }, "2": { "patterns": [ { "include": "#template_call_innards" } ] }, "3": { "name": "punctuation.section.arguments.begin.bracket.round.cpp" } }, "end": "\\)", "endCaptures": { "0": { "name": "punctuation.section.arguments.end.bracket.round.cpp" } }, "patterns": [ { "include": "#function-call-innards-c" } ] }, { "begin": "(?,\\w])*>\\s*)))?::)*\\s*)([a-zA-Z_]\\w*)\\s*(?:(<(?:[\\s<>,\\w])*>\\s*))?(\\()", "beginCaptures": { "1": { "patterns": [ { "include": "#scope_resolution" } ] }, "2": { "name": "entity.name.function.call.cpp" }, "3": { "name": "meta.template.call.cpp", "patterns": [ { "include": "#storage_types" }, { "include": "#constants" }, { "include": "#scope_resolution" }, { "match": "(?