From 48eb3ba4a00ef70d8839a558fb0e7176e160ea75 Mon Sep 17 00:00:00 2001 From: Alex Ross Date: Tue, 16 Apr 2019 17:52:21 +0200 Subject: [PATCH] Update cpp grammar and make small themes change --- extensions/cpp/cgmanifest.json | 4 +- extensions/cpp/syntaxes/c.tmLanguage.json | 6 +- extensions/cpp/syntaxes/cpp.tmLanguage.json | 2022 +++++++++-------- .../theme-defaults/themes/dark_plus.json | 5 +- .../theme-defaults/themes/hc_black.json | 3 +- .../theme-defaults/themes/light_plus.json | 3 +- .../themes/kimbie-dark-color-theme.json | 3 +- .../themes/dimmed-monokai-color-theme.json | 3 +- 8 files changed, 1083 insertions(+), 966 deletions(-) diff --git a/extensions/cpp/cgmanifest.json b/extensions/cpp/cgmanifest.json index 3ab00d30368..ce577b0c4e3 100644 --- a/extensions/cpp/cgmanifest.json +++ b/extensions/cpp/cgmanifest.json @@ -6,11 +6,11 @@ "git": { "name": "jeff-hykin/cpp-textmate-grammar", "repositoryUrl": "https://github.com/jeff-hykin/cpp-textmate-grammar", - "commitHash": "84a65f7cce43f15aceaf1854c5bcc779c8575fe7" + "commitHash": "5381f0d02bd043a279ad6c2e55dc5de6812cb15a" } }, "license": "MIT", - "version": "1.7.6", + "version": "1.8.0", "description": "The files syntaxes/c.json and syntaxes/c++.json were derived from https://github.com/atom/language-c which was originally converted from the C TextMate bundle https://github.com/textmate/c.tmbundle." }, { diff --git a/extensions/cpp/syntaxes/c.tmLanguage.json b/extensions/cpp/syntaxes/c.tmLanguage.json index b7213b949df..e3178b20718 100644 --- a/extensions/cpp/syntaxes/c.tmLanguage.json +++ b/extensions/cpp/syntaxes/c.tmLanguage.json @@ -4,7 +4,7 @@ "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/d450ac8fb4bd1750389acfd88be341e1a91a02f3", + "version": "https://github.com/jeff-hykin/cpp-textmate-grammar/commit/4adcc1a8832391412fc7f55d08c79c52e83c9a3e", "name": "C", "scopeName": "source.c", "patterns": [ @@ -944,11 +944,11 @@ "storage_types": { "patterns": [ { - "match": "(?-mix:void|char|short|int|signed|unsigned|long|float|double|bool|_Bool)", + "match": "(?-mix:(?(?-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*", + "match": "<(?:[\\s<>:,\\w])*>\\s*", "captures": { "0": { "name": "meta.template.call.cpp", @@ -776,7 +318,204 @@ "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": "#cpp_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_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F]))(?:(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F])))*\\s*(?:(?-mix:(?:<(?:[\\s<>:,\\w])*>\\s*)))?::)*\\s*)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F]))(?:(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F])))*)\\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": "(?\\s*$)", + "parameter_struct": { + "match": "(struct)\\s+((?)", + "end": "(\\))", "endCaptures": { "1": { - "name": "punctuation.section.angle-brackets.end.template.definition.cpp" + "name": "punctuation.section.arguments.end.bracket.round.operator.sizeof.cpp keyword.operator.functionlike.cpp keyword.operator.sizeof.cpp" } }, "patterns": [ { - "begin": "((?<=\\w)\\s*<)", + "include": "#cpp_base" + } + ] + }, + "alignof_operator": { + "contentName": "meta.arguments.operator.alignof", + "begin": "((?>=|\\|=", + "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": { - "1": { - "name": "punctuation.section.angle-brackets.begin.template.call.cpp" + "0": { + "name": "keyword.operator.ternary.cpp" } }, - "end": "(>)", + "end": ":", + "applyEndPatternLast": true, "endCaptures": { - "1": { - "name": "punctuation.section.angle-brackets.begin.template.call.cpp" + "0": { + "name": "keyword.operator.ternary.cpp" } }, "patterns": [ { - "include": "#storage_types" - }, - { - "include": "#constants" - }, - { - "include": "#scope_resolution" - }, - { - "match": "(?\\]\\)]|\\.\\.\\.)\\s*(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F]))(?:(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F])))*\\s*(?=(?:\\[\\]\\s*)?(?:,|\\)))))", "captures": { "1": { - "name": "storage.type.template.cpp" + "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_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F]))(?:(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F])))*\\s*(?:(?-mix:(?:<(?:[\\s<>:,\\w])*>\\s*)))?::)*(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F]))(?:(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F])))*\\s*(?:&)?)))\\s*(\\()", + "beginCaptures": { + "1": { + "name": "keyword.other.operator.overload.cpp" }, "2": { - "name": "entity.name.type.template.cpp" + "name": "entity.name.operator.overloadee.cpp", + "patterns": [ + { + "include": "#scope_resolution" + } + ] }, "3": { - "name": "keyword.operator.assignment.cpp" + "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" + } + ] }, - "template_definition_argument": { - "match": "(?:(?:\\s*([a-zA-Z_]\\w*)|((?:[a-zA-Z_]\\w*\\s+)+)([a-zA-Z_]\\w*))|([a-zA-Z_]\\w*)\\s*(\\.\\.\\.)\\s*([a-zA-Z_]\\w*))\\s*(?:(,)|(?=>|$))", + "member_access": { + "match": "(?:((?\\*|->)))((?:(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F]))(?:(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F])))*\\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_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F]))(?:(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F])))*\\b(?!\\())", "captures": { "1": { - "name": "storage.type.template.argument.$1.cpp" + "name": "variable.language.this.cpp" }, "2": { - "name": "storage.type.template.argument.$2.cpp" + "name": "variable.other.object.access.cpp" }, "3": { - "name": "entity.name.type.template.cpp" + "name": "punctuation.separator.dot-access.cpp" }, "4": { - "name": "storage.type.template.cpp" + "name": "punctuation.separator.pointer-access.cpp" }, "5": { - "name": "ellipses.cpp punctuation.vararg-ellipses.template.definition.cpp" + "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.type.template.cpp" - }, - "7": { - "name": "comma.cpp punctuation.separator.template.argument.cpp" + "name": "variable.other.property.cpp" } } }, - "scope_resolution": { - "match": "((?:[a-zA-Z_]\\w*\\s*(?:(?-mix:(?:<(?:[\\s<>,\\w])*>\\s*)))?::)*\\s*)([a-zA-Z_]\\w*)\\s*(?:(<(?:[\\s<>,\\w])*>\\s*))?(::)", - "captures": { + "method_access": { + "contentName": "meta.function-call.member", + "begin": "(?:((?\\*|->)))((?:(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F]))(?:(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F])))*\\s*(?-mix:(?:(?:\\.\\*|\\.))|(?:(?:->\\*|->)))\\s*)*)\\s*((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F]))(?:(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F])))*)(\\()", + "beginCaptures": { "1": { - "patterns": [ - { - "include": "#scope_resolution" - } - ] + "name": "variable.language.this.cpp" }, "2": { - "name": "entity.name.namespace.scope-resolution.cpp" + "name": "variable.other.object.access.cpp" }, "3": { - "name": "meta.template.call.cpp", + "name": "punctuation.separator.dot-access.cpp" + }, + "4": { + "name": "punctuation.separator.pointer-access.cpp" + }, + "5": { "patterns": [ { - "include": "#storage_types" - }, - { - "include": "#constants" - }, - { - "include": "#scope_resolution" - }, - { - "match": "(?|->\\*))\\s*(?-mix:(?:(?:(?\\*|->))))", + "name": "variable.other.object.property.cpp" }, { - "include": "#number_literal" + "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": "#strings" + "include": "#member_access" }, { - "match": ",", - "name": "comma.cpp punctuation.separator.template.argument.cpp" + "include": "#method_access" } ] }, - "4": { - "name": "punctuation.separator.namespace.access.cpp" - } - }, - "name": "meta.scope-resolution.cpp" - }, - "sizeof_operator": { - "contentName": "meta.arguments.operator.sizeof", - "begin": "((?)(.+?(?=\\{|$))?", + "captures": { + "1": { + "name": "punctuation.definition.lambda.return-type.cpp" + }, + "2": { + "name": "storage.type.return-type.lambda.cpp" + } + } }, - "2": { - "name": "punctuation.section.arguments.begin.bracket.round.decltype.cpp keyword.operator.functionlike.cpp storage.type.decltype.cpp" - } - }, - "end": "(\\))", - "endCaptures": { - "1": { - "name": "punctuation.section.arguments.end.bracket.round.decltype.cpp keyword.operator.functionlike.cpp storage.type.decltype.cpp" - } - }, - "patterns": [ { - "include": "$base" + "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": "#cpp_base" + } + ] } ] }, - "operators": { + "hacky_fix_for_stray_directive": { + "match": "(?>=|\\|=", - "name": "keyword.operator.assignment.compound.bitwise.cpp" + "include": "#memory_operators" }, { - "match": "<<|>>", - "name": "keyword.operator.bitwise.shift.cpp" + "match": "(?=|==|<|>", - "name": "keyword.operator.comparison.cpp" + "include": "#constants" }, { - "match": "&&|!|\\|\\|", - "name": "keyword.operator.logical.cpp" + "include": "#template_isolated_definition" }, { - "match": "&|\\||\\^|~", - "name": "keyword.operator.cpp" + "include": "#template_definition" }, { - "match": "=", - "name": "keyword.operator.assignment.cpp" + "include": "#scope_resolution" }, { - "match": "%|\\*|/|-|\\+", - "name": "keyword.operator.cpp" + "match": "(?-mix:\\b(constexpr|export|mutable|typename|thread_local)\\b)", + "name": "storage.modifier.cpp" }, { - "begin": "\\?", + "name": "meta.function.destructor.cpp", + "begin": "(?x)\n(?:\n ^ | # beginning of line\n (?:(?\\]\\)]|\\.\\.\\.)\\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" + { + "include": "#lambdas" }, - "2": { - "name": "entity.name.operator.overloadee.cpp", + { + "include": "#preprocessor-rule-enabled" + }, + { + "include": "#preprocessor-rule-disabled" + }, + { + "include": "#preprocessor-rule-conditional" + }, + { + "include": "#hacky_fix_for_stray_directive" + }, + { + "include": "#comments" + }, + { + "name": "meta.conditional.case.cpp", + "begin": "((?\\*|->)))((?:[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" + "include": "#storage_types" }, - "2": { - "name": "variable.other.object.access.cpp" + { + "match": "\\b(const|extern|register|restrict|static|volatile|inline)\\b", + "name": "storage.modifier.cpp" }, - "3": { - "name": "punctuation.separator.dot-access.cpp" + { + "include": "#operator_overload" }, - "4": { - "name": "punctuation.separator.pointer-access.cpp" + { + "include": "#number_literal" + }, + { + "include": "#strings_c" + }, + { + "name": "meta.preprocessor.macro.cpp", + "begin": "(?x)\n^\\s* ((\\#)\\s*define) \\s+\t# define\n((?(?-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": "(?=(?://|/\\*))|(?|->\\*))\\s*(?-mix:(?:(?:(?\\*|->))))", - "name": "variable.other.object.property.cpp" + "include": "#line_continuation_character" }, { - "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" + "begin": "\"", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.cpp" } - } - }, - { - "include": "#member_access" + }, + "end": "\"", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.cpp" + } + }, + "name": "string.quoted.double.include.cpp" }, { - "include": "#method_access" + "begin": "<", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.cpp" + } + }, + "end": ">", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.cpp" + } + }, + "name": "string.quoted.other.lt-gt.include.cpp" } ] }, - "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" + { + "include": "#pragma-mark" }, - "5": { - "patterns": [ - { - "match": "(?<=(?:\\.\\*|\\.|->|->\\*))\\s*(?-mix:(?:(?:(?\\*|->))))", - "name": "variable.other.object.property.cpp" + { + "name": "meta.preprocessor.cpp", + "begin": "^\\s*((#)\\s*line)\\b", + "beginCaptures": { + "1": { + "name": "keyword.control.directive.line.cpp" }, + "2": { + "name": "punctuation.definition.directive.cpp" + } + }, + "end": "(?=(?://|/\\*))|(?\\*|->)))", - "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": "#strings_c" }, { - "include": "#member_access" + "include": "#number_literal" }, { - "include": "#method_access" + "include": "#line_continuation_character" } ] }, - "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" + "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.cpp" + }, + { + "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.cpp" + }, + { + "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", + "name": "support.type.stdint.cpp" + }, + { + "match": "(?,\\w])*>\\s*)))?::)*\\s*))?((?:,\\w])*>\\s*)))?::)*\\s*))?((?,\\w])*>\\s*)))?::)*\\s*)\\s*(?:((?:,\\w])*>\\s*)))?::)*\\s*)\\s*(?:((?,\\w])*>\\s*)))?::)*\\s*)([a-zA-Z_]\\w*)\\s*(?:(<(?:[\\s<>,\\w])*>\\s*))?(::)))?\\s*((?:,\\w])*>\\s*)))?::)*\\s*)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F]))(?:(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F])))*)\\s*(?:(<(?:[\\s<>:,\\w])*>\\s*))?(::)))?\\s*((?,\\w])*>\\s*)))?)\\( # actual name\n|\n(?:(?<=operator)(?:[-*&<>=+!]+|\\(\\)|\\[\\]))\\s*\\(\n)", + "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": [ @@ -2616,7 +2728,7 @@ }, "patterns": [ { - "include": "$base" + "include": "#cpp_base" } ] }, @@ -2805,7 +2917,7 @@ ] }, { - "include": "$base" + "include": "#cpp_base" } ] } @@ -3031,7 +3143,7 @@ ] }, { - "include": "$base" + "include": "#cpp_base" } ] }, @@ -3289,7 +3401,7 @@ "end": "(?=^\\s*((#)\\s*(?:else|elif|endif)\\b))", "patterns": [ { - "include": "$base" + "include": "#cpp_base" } ] } @@ -3480,7 +3592,7 @@ ] }, { - "include": "$base" + "include": "#cpp_base" } ] } @@ -3589,7 +3701,7 @@ "end": "(?=^\\s*((#)\\s*endif\\b))", "patterns": [ { - "include": "$base" + "include": "#cpp_base" } ] }, @@ -3619,7 +3731,7 @@ "include": "#vararg_ellipses" }, { - "match": "(?-mix:##?[a-zA-Z_]\\w*(?!\\w))", + "match": "(?-mix:##?(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F]))(?:(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F])))*(?!\\w))", "name": "variable.other.macro.argument.cpp" }, { @@ -3716,7 +3828,7 @@ "include": "#member_access" }, { - "include": "$base" + "include": "#cpp_base" } ] }, @@ -3878,7 +3990,7 @@ ] }, { - "include": "$base" + "include": "#cpp_base" } ] }, @@ -3903,7 +4015,7 @@ "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*(\\()", + "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" @@ -3932,7 +4044,7 @@ ] }, { - "begin": "(?,\\w])*>\\s*)))?::)*\\s*)([a-zA-Z_]\\w*)\\s*(?:(<(?:[\\s<>,\\w])*>\\s*))?(\\()", + "begin": "(?:,\\w])*>\\s*)))?::)*\\s*)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F]))(?:(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F])))*)\\s*(?:(<(?:[\\s<>:,\\w])*>\\s*))?(\\()", "beginCaptures": { "1": { "patterns": [ @@ -3957,7 +4069,7 @@ "include": "#scope_resolution" }, { - "match": "(?