Skip to content

Commit

Permalink
improve array assignment matching
Browse files Browse the repository at this point in the history
  • Loading branch information
jeff-hykin committed Jul 12, 2024
1 parent 23e25d8 commit 071dd6e
Show file tree
Hide file tree
Showing 18 changed files with 1,494 additions and 99 deletions.
2 changes: 1 addition & 1 deletion autogenerated/cpp.embedded.macro.tmLanguage.json

Large diffs are not rendered by default.

288 changes: 273 additions & 15 deletions autogenerated/cpp.tmLanguage.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions autogenerated/cpp_scopes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,7 @@ variable.other.unknown.$1.cpp
variable.other.unknown.$10.cpp
variable.other.unknown.$19.cpp
variable.other.unknown.$2.cpp
variable.other.unknown.$24.cpp
variable.other.unknown.$28.cpp
variable.other.unknown.$3.cpp
variable.other.unknown.$4.cpp
Expand Down
11 changes: 10 additions & 1 deletion language_examples/#059.spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -141,16 +141,23 @@
scopes:
- punctuation.section.block.begin.bracket.curly.lambda
- source: auto
scopesBegin:
- meta.assignment
scopes:
- meta.qualified-type
- storage.type.primitive
- storage.type.built-in.primitive
- source: pipe
scopesBegin:
- meta.assignment
scopes:
- variable.lower-case
- variable.other.unknown.pipe
- variable.other.assignment
- source: '='
scopes:
- keyword.operator.assignment
scopesEnd:
- meta.assignment
- source: m_pipe
scopes:
- variable.snake-case
Expand All @@ -167,6 +174,8 @@
- source: )
scopes:
- punctuation.section.arguments.end.bracket.round.function.member
scopesEnd:
- meta.assignment
- source: ;
scopes:
- punctuation.terminator.statement
Expand Down
6 changes: 4 additions & 2 deletions language_examples/#071.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ int a[] = {1,2,3};
function_declaration(int *, usertype user_value);

int main() {
int a;
int* a;
int b;
usertype user_value;
usertype user_value[] = {1,2,3};
usertype* user_value[] = {1,2,3};
usertype* user_value[1];
usertype user_value{'A'};
scoped::templated<type> value;
compound<typename templated::type *>::type value;
Expand Down
114 changes: 114 additions & 0 deletions language_examples/#071.spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
- punctuation.terminator.statement
- source: int
scopes:
- meta.qualified-type
- storage.type.primitive
- storage.type.built-in.primitive
- source: a
Expand Down Expand Up @@ -391,6 +392,7 @@
- punctuation.terminator.statement
- source: int
scopes:
- meta.qualified-type
- storage.type.primitive
- storage.type.built-in.primitive
- source: a
Expand Down Expand Up @@ -495,6 +497,9 @@
- meta.qualified-type
- storage.type.primitive
- storage.type.built-in.primitive
- source: '*'
scopes:
- storage.modifier.pointer
- source: a
scopes:
- meta.declaration
Expand Down Expand Up @@ -522,19 +527,127 @@
- source: ;
scopes:
- punctuation.terminator.statement
- source: usertype
scopes:
- meta.qualified-type
- entity.name.type
- source: user_value
scopes:
- variable.snake-case
- variable.other.assignment
- source: '['
scopes:
- punctuation.definition.begin.bracket.square.array.type
- source: ']'
scopes:
- punctuation.definition.end.bracket.square.array.type
- source: '='
scopes:
- keyword.operator.assignment
- source: '{'
scopesBegin:
- meta.block
scopes:
- punctuation.section.block.begin.bracket.curly
- source: '1'
scopes:
- constant.numeric.decimal
- source: ','
scopes:
- punctuation.separator.delimiter.comma
- source: '2'
scopes:
- constant.numeric.decimal
- source: ','
scopes:
- punctuation.separator.delimiter.comma
- source: '3'
scopes:
- constant.numeric.decimal
- source: '}'
scopes:
- punctuation.section.block.end.bracket.curly
scopesEnd:
- meta.block
- source: ;
scopes:
- punctuation.terminator.statement
- source: usertype
scopes:
- meta.qualified-type
- entity.name.type
- source: '*'
scopes:
- storage.modifier.pointer
- source: user_value
scopes:
- variable.snake-case
- variable.other.assignment
- source: '['
scopes:
- punctuation.definition.begin.bracket.square.array.type
- source: ']'
scopes:
- punctuation.definition.end.bracket.square.array.type
- source: '='
scopes:
- keyword.operator.assignment
- source: '{'
scopesBegin:
- meta.block
scopes:
- punctuation.section.block.begin.bracket.curly
- source: '1'
scopes:
- constant.numeric.decimal
- source: ','
scopes:
- punctuation.separator.delimiter.comma
- source: '2'
scopes:
- constant.numeric.decimal
- source: ','
scopes:
- punctuation.separator.delimiter.comma
- source: '3'
scopes:
- constant.numeric.decimal
- source: '}'
scopes:
- punctuation.section.block.end.bracket.curly
scopesEnd:
- meta.block
- source: ;
scopes:
- punctuation.terminator.statement
- source: usertype
scopesBegin:
- meta.declaration
scopes:
- meta.qualified-type
- entity.name.type
- source: '*'
scopes:
- storage.modifier.pointer
- source: user_value
scopes:
- meta.declaration
- variable.snake-case
- variable.other.declare
- source: '['
scopesBegin:
- meta.bracket.square.access
scopes:
- punctuation.definition.begin.bracket.square
- source: '1'
scopes:
- constant.numeric.decimal
- source: ']'
scopes:
- punctuation.definition.end.bracket.square
scopesEnd:
- meta.declaration
- meta.bracket.square.access
- source: ;
scopes:
- punctuation.terminator.statement
Expand Down Expand Up @@ -667,6 +780,7 @@
- punctuation.terminator.statement
- source: int
scopes:
- meta.qualified-type
- storage.type.primitive
- storage.type.built-in.primitive
- source: a
Expand Down
12 changes: 9 additions & 3 deletions language_examples/#264.spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -200,18 +200,23 @@
scopes:
- punctuation.terminator.statement
- source: static
scopesBegin:
- meta.declaration
scopes:
- storage.modifier.specifier.static
- source: int
scopes:
- meta.qualified-type
- storage.type.primitive
- storage.type.built-in.primitive
- source: perm
scopesBegin:
- meta.bracket.square.access
scopes:
- variable.other.object
- meta.declaration
- variable.lower-case
- variable.other.declare
- source: '['
scopesBegin:
- meta.bracket.square.access
scopes:
- punctuation.definition.begin.bracket.square
- source: 'N'
Expand All @@ -228,6 +233,7 @@
scopes:
- punctuation.definition.end.bracket.square
scopesEnd:
- meta.declaration
- meta.bracket.square.access
- source: ;
scopes:
Expand Down
37 changes: 37 additions & 0 deletions language_examples/declares.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#include <iostream>
#include <cstdlib>
#include "Stress_ball.h"

using namespace std;

int main()
{
srand(time(NULL));

cout << "Default constructor test:\n";
Stress_ball arr_test;
Stress_ball arr_test[5];
for(int i = 0; i < 5; i++){
arr_test[i] = Stress_ball();
cout << i << ": " << arr_test[i] << endl;
}

cout << "\nTwo arg constructor test:\n";
Stress_ball test2(Stress_ball_colors::red, Stress_ball_sizes::small);
cout << test2 << endl;

Stress_ball test3(Stress_ball_colors::green, Stress_ball_sizes::large);
cout << test3 << endl;

cout << "\nCompare stress balls:\n";
for (int i = 0; i < 5; i++) {
if (arr_test[i] == test2) {
cout << "arr_test[" << i << "] equal test2\n";
} else if (arr_test[i] == test3) {
cout << "arr_test[" << i << "] equal test3\n";
} else {
cout << "arr_test[" << i << "] not equal test2 nor test3\n";
}
}

}
Loading

0 comments on commit 071dd6e

Please sign in to comment.