Skip to content

Commit 05d5219

Browse files
committed
Merge branch 'Fix/#130'
2 parents 285ed9a + 413e79e commit 05d5219

File tree

5 files changed

+71
-13
lines changed

5 files changed

+71
-13
lines changed

cpp/generate.rb

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,11 +1018,18 @@ def blockFinderFor( name:"", tag_as:"", start_pattern:nil, needs_semicolon: true
10181018
)
10191019
member_context = [
10201020
mid_member = newPattern(
1021-
tag_as: "variable.other.object.property",
10221021
match: lookBehindFor(dot_or_arrow_operator).maybe(
10231022
@spaces
10241023
).then(
1025-
partial_member.without_numbered_capture_groups
1024+
# this is duplicated from partial_member until #181 is resolved
1025+
the_this_keyword.or(
1026+
newPattern(
1027+
match: variable_name_without_bounds.or(lookBehindFor(/\]|\)/)).maybe(@spaces),
1028+
tag_as: "variable.other.object.property",
1029+
)
1030+
).then(
1031+
member_operator
1032+
)
10261033
)
10271034
),
10281035
partial_member,

syntaxes/cpp.tmLanguage.json

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1930,8 +1930,21 @@
19301930
"5": {
19311931
"patterns": [
19321932
{
1933-
"match": "(?<=(?:\\.\\*|\\.|->|->\\*))\\s*(?-mix:(?:(?:(?<!\\w)this(?!\\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])))*|(?<=\\]|\\)))\\s*))(?:(?:(?:\\.\\*|\\.))|(?:(?:->\\*|->))))",
1934-
"name": "variable.other.object.property.cpp"
1933+
"match": "(?<=(?:\\.\\*|\\.|->|->\\*))\\s*(?:((?<!\\w)this(?!\\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])))*|(?<=\\]|\\)))\\s*))(?:((?:\\.\\*|\\.))|((?:->\\*|->)))",
1934+
"captures": {
1935+
"1": {
1936+
"name": "variable.language.this.cpp"
1937+
},
1938+
"2": {
1939+
"name": "variable.other.object.property.cpp"
1940+
},
1941+
"3": {
1942+
"name": "punctuation.separator.dot-access.cpp"
1943+
},
1944+
"4": {
1945+
"name": "punctuation.separator.pointer-access.cpp"
1946+
}
1947+
}
19351948
},
19361949
{
19371950
"match": "(?:((?<!\\w)this(?!\\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])))*|(?<=\\]|\\)))\\s*))(?:((?:\\.\\*|\\.))|((?:->\\*|->)))",
@@ -1982,8 +1995,21 @@
19821995
"5": {
19831996
"patterns": [
19841997
{
1985-
"match": "(?<=(?:\\.\\*|\\.|->|->\\*))\\s*(?-mix:(?:(?:(?<!\\w)this(?!\\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])))*|(?<=\\]|\\)))\\s*))(?:(?:(?:\\.\\*|\\.))|(?:(?:->\\*|->))))",
1986-
"name": "variable.other.object.property.cpp"
1998+
"match": "(?<=(?:\\.\\*|\\.|->|->\\*))\\s*(?:((?<!\\w)this(?!\\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])))*|(?<=\\]|\\)))\\s*))(?:((?:\\.\\*|\\.))|((?:->\\*|->)))",
1999+
"captures": {
2000+
"1": {
2001+
"name": "variable.language.this.cpp"
2002+
},
2003+
"2": {
2004+
"name": "variable.other.object.property.cpp"
2005+
},
2006+
"3": {
2007+
"name": "punctuation.separator.dot-access.cpp"
2008+
},
2009+
"4": {
2010+
"name": "punctuation.separator.pointer-access.cpp"
2011+
}
2012+
}
19872013
},
19882014
{
19892015
"match": "(?:((?<!\\w)this(?!\\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])))*|(?<=\\]|\\)))\\s*))(?:((?:\\.\\*|\\.))|((?:->\\*|->)))",

syntaxes/cpp.tmLanguage.yaml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,8 +1028,16 @@
10281028
name: punctuation.separator.pointer-access.cpp
10291029
'5':
10301030
patterns:
1031-
- match: "(?<=(?:\\.\\*|\\.|->|->\\*))\\s*(?-mix:(?:(?:(?<!\\w)this(?!\\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])))*|(?<=\\]|\\)))\\s*))(?:(?:(?:\\.\\*|\\.))|(?:(?:->\\*|->))))"
1032-
name: variable.other.object.property.cpp
1031+
- match: "(?<=(?:\\.\\*|\\.|->|->\\*))\\s*(?:((?<!\\w)this(?!\\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])))*|(?<=\\]|\\)))\\s*))(?:((?:\\.\\*|\\.))|((?:->\\*|->)))"
1032+
captures:
1033+
'1':
1034+
name: variable.language.this.cpp
1035+
'2':
1036+
name: variable.other.object.property.cpp
1037+
'3':
1038+
name: punctuation.separator.dot-access.cpp
1039+
'4':
1040+
name: punctuation.separator.pointer-access.cpp
10331041
- match: "(?:((?<!\\w)this(?!\\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])))*|(?<=\\]|\\)))\\s*))(?:((?:\\.\\*|\\.))|((?:->\\*|->)))"
10341042
captures:
10351043
'1':
@@ -1058,8 +1066,16 @@
10581066
name: punctuation.separator.pointer-access.cpp
10591067
'5':
10601068
patterns:
1061-
- match: "(?<=(?:\\.\\*|\\.|->|->\\*))\\s*(?-mix:(?:(?:(?<!\\w)this(?!\\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])))*|(?<=\\]|\\)))\\s*))(?:(?:(?:\\.\\*|\\.))|(?:(?:->\\*|->))))"
1062-
name: variable.other.object.property.cpp
1069+
- match: "(?<=(?:\\.\\*|\\.|->|->\\*))\\s*(?:((?<!\\w)this(?!\\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])))*|(?<=\\]|\\)))\\s*))(?:((?:\\.\\*|\\.))|((?:->\\*|->)))"
1070+
captures:
1071+
'1':
1072+
name: variable.language.this.cpp
1073+
'2':
1074+
name: variable.other.object.property.cpp
1075+
'3':
1076+
name: punctuation.separator.dot-access.cpp
1077+
'4':
1078+
name: punctuation.separator.pointer-access.cpp
10631079
- match: "(?:((?<!\\w)this(?!\\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])))*|(?<=\\]|\\)))\\s*))(?:((?:\\.\\*|\\.))|((?:->\\*|->)))"
10641080
captures:
10651081
'1':

test/specs/issues/059.cpp.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,12 @@
9393
- source: '->'
9494
scopes:
9595
- punctuation.separator.pointer-access.cpp
96-
- source: wakeup.
96+
- source: wakeup
9797
scopes:
9898
- variable.other.object.property.cpp
99+
- source: '.'
100+
scopes:
101+
- punctuation.separator.dot-access.cpp
99102
- source: connect
100103
scopes:
101104
- entity.name.function.member.cpp

test/specs/issues/130.cpp.yaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,12 @@
2727
- source: '->'
2828
scopes:
2929
- punctuation.separator.pointer-access.cpp
30-
- source: b->
30+
- source: b
3131
scopes:
3232
- variable.other.object.property.cpp
33+
- source: '->'
34+
scopes:
35+
- punctuation.separator.pointer-access.cpp
3336
- source: c
3437
scopes:
3538
- variable.other.property.cpp
@@ -48,9 +51,12 @@
4851
- source: .
4952
scopes:
5053
- punctuation.separator.dot-access.cpp
51-
- source: b.
54+
- source: b
5255
scopes:
5356
- variable.other.object.property.cpp
57+
- source: .
58+
scopes:
59+
- punctuation.separator.dot-access.cpp
5460
- source: c
5561
scopes:
5662
- variable.other.property.cpp

0 commit comments

Comments
 (0)