diff --git a/package.json b/package.json index 2d6b9a40..82311751 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "displayName": "Better Syntax", "description": "The bleeding edge of C-like syntaxes", "icon": "icon.png", - "version": "1.11.0", + "version": "1.11.2", "scripts": { "build": "ruby scripts/generate.rb", "prelint": "npm run build", diff --git a/source/languages/cpp/generate.rb b/source/languages/cpp/generate.rb index 994263e9..b3b508e9 100644 --- a/source/languages/cpp/generate.rb +++ b/source/languages/cpp/generate.rb @@ -3341,16 +3341,45 @@ def generateBlockFinder( name:"", tag_as:"", start_pattern:nil, needs_semicolon: :preprocessor_rule_define_line_context ] cpp_grammar[:function_call_context] = [ - :attributes_context, + :struct_declare, + :string_context, + :functional_specifiers_pre_parameters, + :qualifiers_and_specifiers_post_parameters, + :storage_specifiers, + :access_control_keywords, + :exception_keywords, + :static_assert, + :other_keywords, + :memory_operators, + :the_this_keyword, + :language_constants, + :misc_storage_modifiers_1, + :lambdas, + :preprocessor_context, :comments_context, + :misc_storage_modifiers_2, + :number_literal, + :string_context_c, + :meta_preprocessor_macro, + :meta_preprocessor_diagnostic, + :meta_preprocessor_include, + :pragma_mark, + :meta_preprocessor_line, + :meta_preprocessor_undef, + :meta_preprocessor_pragma, + :predefined_macros, :operators, - :string_context, - :storage_types, - :method_access, - :member_access, - legacy_memory_new_call, + :attributes_context, # this is here because it needs to be lower than :operators. TODO: once all the contexts are cleaned up, this should be put in a better spot + :parentheses, + :type_casting_operators, :function_call, - :block_context + :scope_resolution_inner_generated, + :storage_types, + :line_continuation_character, + :square_brackets, + :empty_square_brackets, + :semicolon, + :comma, ] # Save diff --git a/syntaxes/cpp.tmLanguage.json b/syntaxes/cpp.tmLanguage.json index c06d8b83..c77f18de 100644 --- a/syntaxes/cpp.tmLanguage.json +++ b/syntaxes/cpp.tmLanguage.json @@ -6882,60 +6882,121 @@ "function_call_context": { "patterns": [ { - "include": "#attributes_context" + "include": "#struct_declare" + }, + { + "include": "#string_context" + }, + { + "include": "#functional_specifiers_pre_parameters" + }, + { + "include": "#qualifiers_and_specifiers_post_parameters" + }, + { + "include": "#storage_specifiers" + }, + { + "include": "#access_control_keywords" + }, + { + "include": "#exception_keywords" + }, + { + "include": "#static_assert" + }, + { + "include": "#other_keywords" + }, + { + "include": "#memory_operators" + }, + { + "include": "#the_this_keyword" + }, + { + "include": "#language_constants" + }, + { + "include": "#misc_storage_modifiers_1" + }, + { + "include": "#lambdas" + }, + { + "include": "#preprocessor_context" }, { "include": "#comments_context" }, + { + "include": "#misc_storage_modifiers_2" + }, + { + "include": "#number_literal" + }, + { + "include": "#string_context_c" + }, + { + "include": "#meta_preprocessor_macro" + }, + { + "include": "#meta_preprocessor_diagnostic" + }, + { + "include": "#meta_preprocessor_include" + }, + { + "include": "#pragma_mark" + }, + { + "include": "#meta_preprocessor_line" + }, + { + "include": "#meta_preprocessor_undef" + }, + { + "include": "#meta_preprocessor_pragma" + }, + { + "include": "#predefined_macros" + }, { "include": "#operators" }, { - "include": "#string_context" + "include": "#attributes_context" + }, + { + "include": "#parentheses" + }, + { + "include": "#type_casting_operators" + }, + { + "include": "#function_call" + }, + { + "include": "#scope_resolution_inner_generated" }, { "include": "#storage_types" }, { - "include": "#method_access" + "include": "#line_continuation_character" }, { - "include": "#member_access" + "include": "#square_brackets" }, { - "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*)))?)) # 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_context" - } - ] + "include": "#empty_square_brackets" }, { - "include": "#function_call" + "include": "#semicolon" }, { - "include": "#block_context" + "include": "#comma" } ] } diff --git a/syntaxes/cpp.tmLanguage.yaml b/syntaxes/cpp.tmLanguage.yaml index 4c9ba27a..7206a0f7 100644 --- a/syntaxes/cpp.tmLanguage.yaml +++ b/syntaxes/cpp.tmLanguage.yaml @@ -3647,35 +3647,42 @@ - include: "#preprocessor_rule_define_line_context" function_call_context: patterns: - - include: "#attributes_context" + - include: "#struct_declare" + - include: "#string_context" + - include: "#functional_specifiers_pre_parameters" + - include: "#qualifiers_and_specifiers_post_parameters" + - include: "#storage_specifiers" + - include: "#access_control_keywords" + - include: "#exception_keywords" + - include: "#static_assert" + - include: "#other_keywords" + - include: "#memory_operators" + - include: "#the_this_keyword" + - include: "#language_constants" + - include: "#misc_storage_modifiers_1" + - include: "#lambdas" + - include: "#preprocessor_context" - include: "#comments_context" + - include: "#misc_storage_modifiers_2" + - include: "#number_literal" + - include: "#string_context_c" + - include: "#meta_preprocessor_macro" + - include: "#meta_preprocessor_diagnostic" + - include: "#meta_preprocessor_include" + - include: "#pragma_mark" + - include: "#meta_preprocessor_line" + - include: "#meta_preprocessor_undef" + - include: "#meta_preprocessor_pragma" + - include: "#predefined_macros" - include: "#operators" - - include: "#string_context" - - include: "#storage_types" - - include: "#method_access" - - include: "#member_access" - - begin: |- - (?x) - (?!(?: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*\() - ( - (?:new)\s*((?-mix:(?:(?-mix:(?:(?]*|[^>]*+<[^>]*+>)++>\s*)))?)) # actual name - | - (?:(?<=operator)(?:[-*&<>=+!]+|\(\)|\[\])) - ) - \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_context" + - include: "#attributes_context" + - include: "#parentheses" + - include: "#type_casting_operators" - include: "#function_call" - - include: "#block_context" + - include: "#scope_resolution_inner_generated" + - include: "#storage_types" + - include: "#line_continuation_character" + - include: "#square_brackets" + - include: "#empty_square_brackets" + - include: "#semicolon" + - include: "#comma" diff --git a/test/fixtures/issues/218.cpp b/test/fixtures/issues/218.cpp new file mode 100644 index 00000000..3bb11b23 --- /dev/null +++ b/test/fixtures/issues/218.cpp @@ -0,0 +1,78 @@ +static void a( + a a, + a a, + a a, + a a, + a a, + bool a, + bool a, + bool a, + bool a) + +{ + a a; + + + a(a, a, + a, + a, + a, + a, + a, + a, + a); + a->a(&a); + for (auto a : a) { + auto &a = a.a; + auto a = a.a; + + if (a && a) { + switch (a) { + case a: + a->a(a->a()); + break; + case a: + a->a(a->a()); + break; + case a: + a->a(a->a()); + break; + case a: + a->a(a->a()); + break; + } + } + a(a, a, + a, + a, + a, + a, + a, + a, + a); + } +} + +static void a( + a a, + a a, + a a, + a a) + +{ + a a; + a a =0; + a->a()->a(); + + a(a->a()); + a->a(a); + a->a(a); + a(a, a, a, + a, + a); + a->a(&a); + for (auto a: a) { + a(a->a(), a, a, + a); + } +} \ No newline at end of file diff --git a/test/specs/issues/055.cpp.yaml b/test/specs/issues/055.cpp.yaml index c755be63..b0c656f1 100644 --- a/test/specs/issues/055.cpp.yaml +++ b/test/specs/issues/055.cpp.yaml @@ -54,14 +54,13 @@ - source: enum scopesBegin: - meta.function.definition.parameters - - meta.block.enum - - meta.head.enum - scopes: - - storage.type.enum - source: foo scopes: - - entity.name.type.enum + - entity.name.scope-resolution - source: '::' + scopes: + - punctuation.separator.namespace.access + - punctuation.separator.scope-resolution - source: bar scopes: - entity.name.scope-resolution @@ -69,9 +68,18 @@ scopes: - punctuation.separator.namespace.access - punctuation.separator.scope-resolution -- source: baz quix) +- source: 'baz ' +- source: quix + scopes: + - variable.parameter scopesEnd: - - meta.head.enum + - meta.function.definition.parameters +- source: ) + scopes: + - punctuation.section.parameters.end.bracket.round + scopesEnd: + - meta.function.definition + - meta.head.function.definition - source: ; scopes: - punctuation.terminator.statement diff --git a/test/specs/issues/188.cpp.yaml b/test/specs/issues/188.cpp.yaml index 757e48e1..77724b85 100644 --- a/test/specs/issues/188.cpp.yaml +++ b/test/specs/issues/188.cpp.yaml @@ -32,26 +32,23 @@ - punctuation.section.arguments.begin.bracket.round.function.call - source: static_cast scopes: - - entity.name.function.call + - keyword.operator.wordlike + - keyword.operator.cast.static_cast - source: < - scopesBegin: - - meta.template.call - - meta.template.call scopes: - - punctuation.section.angle-brackets.begin.template.call + - keyword.operator.comparison - source: f64_t scopes: - support.type.posix-reserved - support.type.built-in.posix-reserved - source: '>' scopes: - - punctuation.section.angle-brackets.end.template.call - scopesEnd: - - meta.template.call - - meta.template.call + - keyword.operator.comparison - source: ( + scopesBegin: + - meta.parens scopes: - - punctuation.section.arguments.begin.bracket.round.function.call + - punctuation.section.parens.begin.bracket.round - source: audio_spec scopes: - variable.other.object.access @@ -63,38 +60,39 @@ - variable.other.property - source: ) scopes: - - punctuation.section.arguments.end.bracket.round.function.call + - punctuation.section.parens.end.bracket.round + scopesEnd: + - meta.parens - source: / scopes: - keyword.operator - source: static_cast scopes: - - entity.name.function.call + - keyword.operator.wordlike + - keyword.operator.cast.static_cast - source: < - scopesBegin: - - meta.template.call - - meta.template.call scopes: - - punctuation.section.angle-brackets.begin.template.call + - keyword.operator.comparison - source: f64_t scopes: - support.type.posix-reserved - support.type.built-in.posix-reserved - source: '>' scopes: - - punctuation.section.angle-brackets.end.template.call - scopesEnd: - - meta.template.call - - meta.template.call + - keyword.operator.comparison - source: ( + scopesBegin: + - meta.parens scopes: - - punctuation.section.arguments.begin.bracket.round.function.call + - punctuation.section.parens.begin.bracket.round - source: tgt_fps - source: ) - scopesBegin: - - punctuation.section.arguments.end.bracket.round.function.call -- source: ) + scopes: + - punctuation.section.parens.end.bracket.round scopesEnd: + - meta.parens +- source: ) + scopes: - punctuation.section.arguments.end.bracket.round.function.call - source: '}' scopes: diff --git a/test/specs/issues/218.cpp.yaml b/test/specs/issues/218.cpp.yaml new file mode 100644 index 00000000..1787aeb3 --- /dev/null +++ b/test/specs/issues/218.cpp.yaml @@ -0,0 +1,877 @@ +- source: static + scopesBegin: + - source + scopes: + - storage.modifier.specifier.static +- source: void + scopesBegin: + - meta.function.definition + scopes: + - meta.qualified_type + - storage.type.primitive + - storage.type.built-in.primitive +- source: a + scopesBegin: + - meta.head.function.definition + scopes: + - entity.name.function.definition +- source: ( + scopes: + - punctuation.section.parameters.begin.bracket.round +- source: ' a ' + scopesBegin: + - meta.function.definition.parameters +- source: ' a' + scopes: + - variable.parameter +- source: ',' + scopes: + - comma + - punctuation.separator.delimiter +- source: ' a ' +- source: a + scopes: + - variable.parameter +- source: ',' + scopes: + - comma + - punctuation.separator.delimiter +- source: ' a ' +- source: a + scopes: + - variable.parameter +- source: ',' + scopes: + - comma + - punctuation.separator.delimiter +- source: ' a ' +- source: a + scopes: + - variable.parameter +- source: ',' + scopes: + - comma + - punctuation.separator.delimiter +- source: ' a ' +- source: a + scopes: + - variable.parameter +- source: ',' + scopes: + - comma + - punctuation.separator.delimiter +- source: bool + scopes: + - storage.type.primitive + - storage.type.built-in.primitive +- source: ' a' + scopes: + - variable.parameter +- source: ',' + scopes: + - comma + - punctuation.separator.delimiter +- source: bool + scopes: + - storage.type.primitive + - storage.type.built-in.primitive +- source: ' a' + scopes: + - variable.parameter +- source: ',' + scopes: + - comma + - punctuation.separator.delimiter +- source: bool + scopes: + - storage.type.primitive + - storage.type.built-in.primitive +- source: ' a' + scopes: + - variable.parameter +- source: ',' + scopes: + - comma + - punctuation.separator.delimiter +- source: bool + scopes: + - storage.type.primitive + - storage.type.built-in.primitive +- source: ' a' + scopes: + - variable.parameter + scopesEnd: + - meta.function.definition.parameters +- source: ) + scopes: + - punctuation.section.parameters.end.bracket.round +- source: '{' + scopes: + - punctuation.section.block.begin.bracket.curly.function.definition + scopesEnd: + - meta.head.function.definition +- source: ' a a' + scopesBegin: + - meta.body.function.definition +- source: ; + scopes: + - punctuation.terminator.statement +- source: a + scopes: + - entity.name.function.call +- source: ( + scopes: + - punctuation.section.arguments.begin.bracket.round.function.call +- source: a +- source: ',' + scopes: + - comma + - punctuation.separator.delimiter +- source: ' a' +- source: ',' + scopes: + - comma + - punctuation.separator.delimiter +- source: ' a' +- source: ',' + scopes: + - comma + - punctuation.separator.delimiter +- source: ' a' +- source: ',' + scopes: + - comma + - punctuation.separator.delimiter +- source: ' a' +- source: ',' + scopes: + - comma + - punctuation.separator.delimiter +- source: ' a' +- source: ',' + scopes: + - comma + - punctuation.separator.delimiter +- source: ' a' +- source: ',' + scopes: + - comma + - punctuation.separator.delimiter +- source: ' a' +- source: ',' + scopes: + - comma + - punctuation.separator.delimiter +- source: ' a' +- source: ) + scopes: + - punctuation.section.arguments.end.bracket.round.function.call +- source: ; + scopes: + - punctuation.terminator.statement +- source: a + scopes: + - variable.other.object.access +- source: '->' + scopes: + - punctuation.separator.pointer-access +- source: a + scopes: + - entity.name.function.member +- source: ( + scopes: + - punctuation.section.arguments.begin.bracket.round.function.member +- source: '&' + scopes: + - keyword.operator +- source: a +- source: ) + scopes: + - punctuation.section.arguments.end.bracket.round.function.member +- source: ; + scopes: + - punctuation.terminator.statement +- source: for + scopes: + - keyword.control.for +- source: ( + scopesBegin: + - meta.parens + scopes: + - punctuation.section.parens.begin.bracket.round +- source: auto + scopes: + - storage.type.primitive + - storage.type.built-in.primitive +- source: ' a : a' +- source: ) + scopes: + - punctuation.section.parens.end.bracket.round + scopesEnd: + - meta.parens +- source: '{' + scopesBegin: + - meta.block + scopes: + - punctuation.section.block.begin.bracket.curly +- source: auto + scopes: + - storage.type.primitive + - storage.type.built-in.primitive +- source: '&' + scopes: + - keyword.operator +- source: 'a ' +- source: = + scopes: + - keyword.operator.assignment +- source: a + scopes: + - variable.other.object.access +- source: . + scopes: + - punctuation.separator.dot-access +- source: a + scopes: + - variable.other.property +- source: ; + scopes: + - punctuation.terminator.statement +- source: auto + scopes: + - storage.type.primitive + - storage.type.built-in.primitive +- source: ' a ' +- source: = + scopes: + - keyword.operator.assignment +- source: a + scopes: + - variable.other.object.access +- source: . + scopes: + - punctuation.separator.dot-access +- source: a + scopes: + - variable.other.property +- source: ; + scopes: + - punctuation.terminator.statement +- source: if + scopes: + - keyword.control.if +- source: ( + scopesBegin: + - meta.parens.block + scopes: + - punctuation.section.parens.begin.bracket.round +- source: 'a ' +- source: '&&' + scopes: + - keyword.operator.logical +- source: ' a' +- source: ) + scopes: + - punctuation.section.parens.end.bracket.round + scopesEnd: + - meta.parens.block +- source: '{' + scopes: + - punctuation.section.block.begin.bracket.curly +- source: switch + scopesBegin: + - meta.block.switch + - meta.head.switch + scopes: + - keyword.control.switch +- source: ( + scopesBegin: + - meta.conditional.switch + scopes: + - punctuation.section.parens.begin.bracket.round.conditional.switch +- source: a +- source: ) + scopes: + - punctuation.section.parens.end.bracket.round.conditional.switch + scopesEnd: + - meta.conditional.switch +- source: '{' + scopes: + - punctuation.section.block.begin.bracket.curly.switch + scopesEnd: + - meta.head.switch +- source: case + scopesBegin: + - meta.body.switch + - meta.conditional.case + scopes: + - keyword.control.case +- source: ' a' +- source: ':' + scopes: + - colon + - punctuation.separator.case + scopesEnd: + - meta.conditional.case +- source: a + scopes: + - variable.other.object.access +- source: '->' + scopes: + - punctuation.separator.pointer-access +- source: a + scopes: + - entity.name.function.member +- source: ( + scopes: + - punctuation.section.arguments.begin.bracket.round.function.member +- source: a + scopes: + - variable.other.object.access +- source: '->' + scopes: + - punctuation.separator.pointer-access +- source: a + scopes: + - entity.name.function.member +- source: ( + scopes: + - punctuation.section.arguments.begin.bracket.round.function.member +- source: ) + scopesBegin: + - punctuation.section.arguments.end.bracket.round.function.member +- source: ) + scopesEnd: + - punctuation.section.arguments.end.bracket.round.function.member +- source: ; + scopes: + - punctuation.terminator.statement +- source: break + scopes: + - keyword.control.break +- source: ; + scopes: + - punctuation.terminator.statement +- source: case + scopesBegin: + - meta.conditional.case + scopes: + - keyword.control.case +- source: ' a' +- source: ':' + scopes: + - colon + - punctuation.separator.case + scopesEnd: + - meta.conditional.case +- source: a + scopes: + - variable.other.object.access +- source: '->' + scopes: + - punctuation.separator.pointer-access +- source: a + scopes: + - entity.name.function.member +- source: ( + scopes: + - punctuation.section.arguments.begin.bracket.round.function.member +- source: a + scopes: + - variable.other.object.access +- source: '->' + scopes: + - punctuation.separator.pointer-access +- source: a + scopes: + - entity.name.function.member +- source: ( + scopes: + - punctuation.section.arguments.begin.bracket.round.function.member +- source: ) + scopesBegin: + - punctuation.section.arguments.end.bracket.round.function.member +- source: ) + scopesEnd: + - punctuation.section.arguments.end.bracket.round.function.member +- source: ; + scopes: + - punctuation.terminator.statement +- source: break + scopes: + - keyword.control.break +- source: ; + scopes: + - punctuation.terminator.statement +- source: case + scopesBegin: + - meta.conditional.case + scopes: + - keyword.control.case +- source: ' a' +- source: ':' + scopes: + - colon + - punctuation.separator.case + scopesEnd: + - meta.conditional.case +- source: a + scopes: + - variable.other.object.access +- source: '->' + scopes: + - punctuation.separator.pointer-access +- source: a + scopes: + - entity.name.function.member +- source: ( + scopes: + - punctuation.section.arguments.begin.bracket.round.function.member +- source: a + scopes: + - variable.other.object.access +- source: '->' + scopes: + - punctuation.separator.pointer-access +- source: a + scopes: + - entity.name.function.member +- source: ( + scopes: + - punctuation.section.arguments.begin.bracket.round.function.member +- source: ) + scopesBegin: + - punctuation.section.arguments.end.bracket.round.function.member +- source: ) + scopesEnd: + - punctuation.section.arguments.end.bracket.round.function.member +- source: ; + scopes: + - punctuation.terminator.statement +- source: break + scopes: + - keyword.control.break +- source: ; + scopes: + - punctuation.terminator.statement +- source: case + scopesBegin: + - meta.conditional.case + scopes: + - keyword.control.case +- source: ' a' +- source: ':' + scopes: + - colon + - punctuation.separator.case + scopesEnd: + - meta.conditional.case +- source: a + scopes: + - variable.other.object.access +- source: '->' + scopes: + - punctuation.separator.pointer-access +- source: a + scopes: + - entity.name.function.member +- source: ( + scopes: + - punctuation.section.arguments.begin.bracket.round.function.member +- source: a + scopes: + - variable.other.object.access +- source: '->' + scopes: + - punctuation.separator.pointer-access +- source: a + scopes: + - entity.name.function.member +- source: ( + scopes: + - punctuation.section.arguments.begin.bracket.round.function.member +- source: ) + scopesBegin: + - punctuation.section.arguments.end.bracket.round.function.member +- source: ) + scopesEnd: + - punctuation.section.arguments.end.bracket.round.function.member +- source: ; + scopes: + - punctuation.terminator.statement +- source: break + scopes: + - keyword.control.break +- source: ; + scopes: + - punctuation.terminator.statement +- source: '}' + scopes: + - punctuation.section.block.end.bracket.curly.switch + scopesEnd: + - meta.block.switch + - meta.body.switch +- source: '}' + scopes: + - punctuation.section.block.end.bracket.curly +- source: a + scopes: + - entity.name.function.call +- source: ( + scopes: + - punctuation.section.arguments.begin.bracket.round.function.call +- source: a +- source: ',' + scopes: + - comma + - punctuation.separator.delimiter +- source: ' a' +- source: ',' + scopes: + - comma + - punctuation.separator.delimiter +- source: ' a' +- source: ',' + scopes: + - comma + - punctuation.separator.delimiter +- source: ' a' +- source: ',' + scopes: + - comma + - punctuation.separator.delimiter +- source: ' a' +- source: ',' + scopes: + - comma + - punctuation.separator.delimiter +- source: ' a' +- source: ',' + scopes: + - comma + - punctuation.separator.delimiter +- source: ' a' +- source: ',' + scopes: + - comma + - punctuation.separator.delimiter +- source: ' a' +- source: ',' + scopes: + - comma + - punctuation.separator.delimiter +- source: ' a' +- source: ) + scopes: + - punctuation.section.arguments.end.bracket.round.function.call +- source: ; + scopes: + - punctuation.terminator.statement +- source: '}' + scopes: + - punctuation.section.block.end.bracket.curly + scopesEnd: + - meta.block +- source: '}' + scopes: + - punctuation.section.block.end.bracket.curly.function.definition + scopesEnd: + - meta.function.definition + - meta.body.function.definition +- source: static + scopes: + - storage.modifier.specifier.static +- source: void + scopesBegin: + - meta.function.definition + scopes: + - meta.qualified_type + - storage.type.primitive + - storage.type.built-in.primitive +- source: a + scopesBegin: + - meta.head.function.definition + scopes: + - entity.name.function.definition +- source: ( + scopes: + - punctuation.section.parameters.begin.bracket.round +- source: ' a ' + scopesBegin: + - meta.function.definition.parameters +- source: ' a' + scopes: + - variable.parameter +- source: ',' + scopes: + - comma + - punctuation.separator.delimiter +- source: ' a ' +- source: ' a' + scopes: + - variable.parameter +- source: ',' + scopes: + - comma + - punctuation.separator.delimiter +- source: ' a ' +- source: a + scopes: + - variable.parameter +- source: ',' + scopes: + - comma + - punctuation.separator.delimiter +- source: ' a ' +- source: ' a' + scopes: + - variable.parameter + scopesEnd: + - meta.function.definition.parameters +- source: ) + scopes: + - punctuation.section.parameters.end.bracket.round +- source: '{' + scopes: + - punctuation.section.block.begin.bracket.curly.function.definition + scopesEnd: + - meta.head.function.definition +- source: ' a a' + scopesBegin: + - meta.body.function.definition +- source: ; + scopes: + - punctuation.terminator.statement +- source: ' a a ' +- source: = + scopes: + - keyword.operator.assignment +- source: '0' + scopes: + - constant.numeric.decimal +- source: ; + scopes: + - punctuation.terminator.statement +- source: a + scopes: + - variable.other.object.access +- source: '->' + scopes: + - punctuation.separator.pointer-access +- source: a + scopes: + - entity.name.function.member +- source: ( + scopes: + - punctuation.section.arguments.begin.bracket.round.function.member +- source: ) + scopes: + - punctuation.section.arguments.end.bracket.round.function.member +- source: '->' + scopes: + - punctuation.separator.pointer-access +- source: a + scopes: + - entity.name.function.member +- source: ( + scopes: + - punctuation.section.arguments.begin.bracket.round.function.member +- source: ) + scopes: + - punctuation.section.arguments.end.bracket.round.function.member +- source: ; + scopes: + - punctuation.terminator.statement +- source: a + scopes: + - entity.name.function.call +- source: ( + scopes: + - punctuation.section.arguments.begin.bracket.round.function.call +- source: a + scopes: + - variable.other.object.access +- source: '->' + scopes: + - punctuation.separator.pointer-access +- source: a + scopes: + - entity.name.function.member +- source: ( + scopes: + - punctuation.section.arguments.begin.bracket.round.function.member +- source: ) + scopes: + - punctuation.section.arguments.end.bracket.round.function.member +- source: ) + scopes: + - punctuation.section.arguments.end.bracket.round.function.call +- source: ; + scopes: + - punctuation.terminator.statement +- source: a + scopes: + - variable.other.object.access +- source: '->' + scopes: + - punctuation.separator.pointer-access +- source: a + scopes: + - entity.name.function.member +- source: ( + scopes: + - punctuation.section.arguments.begin.bracket.round.function.member +- source: a +- source: ) + scopes: + - punctuation.section.arguments.end.bracket.round.function.member +- source: ; + scopes: + - punctuation.terminator.statement +- source: a + scopes: + - variable.other.object.access +- source: '->' + scopes: + - punctuation.separator.pointer-access +- source: a + scopes: + - entity.name.function.member +- source: ( + scopes: + - punctuation.section.arguments.begin.bracket.round.function.member +- source: a +- source: ) + scopes: + - punctuation.section.arguments.end.bracket.round.function.member +- source: ; + scopes: + - punctuation.terminator.statement +- source: a + scopes: + - entity.name.function.call +- source: ( + scopes: + - punctuation.section.arguments.begin.bracket.round.function.call +- source: a +- source: ',' + scopes: + - comma + - punctuation.separator.delimiter +- source: ' a' +- source: ',' + scopes: + - comma + - punctuation.separator.delimiter +- source: ' a' +- source: ',' + scopes: + - comma + - punctuation.separator.delimiter +- source: ' a' +- source: ',' + scopes: + - comma + - punctuation.separator.delimiter +- source: ' a' +- source: ) + scopes: + - punctuation.section.arguments.end.bracket.round.function.call +- source: ; + scopes: + - punctuation.terminator.statement +- source: a + scopes: + - variable.other.object.access +- source: '->' + scopes: + - punctuation.separator.pointer-access +- source: a + scopes: + - entity.name.function.member +- source: ( + scopes: + - punctuation.section.arguments.begin.bracket.round.function.member +- source: '&' + scopes: + - keyword.operator +- source: a +- source: ) + scopes: + - punctuation.section.arguments.end.bracket.round.function.member +- source: ; + scopes: + - punctuation.terminator.statement +- source: for + scopes: + - keyword.control.for +- source: ( + scopesBegin: + - meta.parens + scopes: + - punctuation.section.parens.begin.bracket.round +- source: auto + scopes: + - storage.type.primitive + - storage.type.built-in.primitive +- source: ' a: a' +- source: ) + scopes: + - punctuation.section.parens.end.bracket.round + scopesEnd: + - meta.parens +- source: '{' + scopesBegin: + - meta.block + scopes: + - punctuation.section.block.begin.bracket.curly +- source: a + scopes: + - entity.name.function.call +- source: ( + scopes: + - punctuation.section.arguments.begin.bracket.round.function.call +- source: a + scopes: + - variable.other.object.access +- source: '->' + scopes: + - punctuation.separator.pointer-access +- source: a + scopes: + - entity.name.function.member +- source: ( + scopes: + - punctuation.section.arguments.begin.bracket.round.function.member +- source: ) + scopes: + - punctuation.section.arguments.end.bracket.round.function.member +- source: ',' + scopes: + - comma + - punctuation.separator.delimiter +- source: ' a' +- source: ',' + scopes: + - comma + - punctuation.separator.delimiter +- source: ' a' +- source: ',' + scopes: + - comma + - punctuation.separator.delimiter +- source: ' a' +- source: ) + scopes: + - punctuation.section.arguments.end.bracket.round.function.call +- source: ; + scopes: + - punctuation.terminator.statement +- source: '}' + scopes: + - punctuation.section.block.end.bracket.curly + scopesEnd: + - meta.block +- source: '}' + scopes: + - punctuation.section.block.end.bracket.curly.function.definition diff --git a/test/specs/vscode/misc001.cpp.yaml b/test/specs/vscode/misc001.cpp.yaml index 564ef437..4ce191de 100644 --- a/test/specs/vscode/misc001.cpp.yaml +++ b/test/specs/vscode/misc001.cpp.yaml @@ -145,13 +145,7 @@ - source: ( scopes: - punctuation.section.arguments.begin.bracket.round.function.call -- source: Blank -- source: '{' - scopes: - - punctuation.section.block.begin.bracket.curly -- source: '}' - scopes: - - punctuation.section.block.end.bracket.curly +- source: 'Blank{}' - source: ) scopes: - punctuation.section.arguments.end.bracket.round.function.call diff --git a/test/specs/vscode/test.cc.yaml b/test/specs/vscode/test.cc.yaml index 27aa050d..055e09c7 100644 --- a/test/specs/vscode/test.cc.yaml +++ b/test/specs/vscode/test.cc.yaml @@ -321,7 +321,7 @@ - source: new scopes: - keyword.operator.wordlike - - alias + - memory - keyword.operator.new - source: ' O' - source: )