@@ -12,6 +12,8 @@ variables:
12
12
propertyAccessPreIdentifier : \??\.\s*
13
13
identifier : ' [_$[:alpha:]][_$[:alnum:]]*'
14
14
constantIdentifier : ' [[:upper:]][_$[:digit:][:upper:]]*'
15
+ propertyIdentifier : ' \#?{{identifier}}'
16
+ constantPropertyIdentifier : ' \#?{{constantIdentifier}}'
15
17
quotedStrings : (\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)
16
18
nonIdentifierPropertyName : ' {{quotedStrings}}|(\[([^\[\]]|\[[^\[\]]*\])+\])'
17
19
label : ({{identifier}})\s*(:)
@@ -32,6 +34,7 @@ variables:
32
34
anyNumber : ({{hexNumber}})|({{binaryNumber}})|({{octalNumber}})|({{decimalNumber}})
33
35
# any use of property name needs to ignore line breaks in regular expression because of decimal number regex (maintained for readability)
34
36
propertyName : ({{anyNumber}}|({{identifier}})|{{nonIdentifierPropertyName}})
37
+ propertyNameWithPrivate : ({{anyNumber}}|({{propertyIdentifier}})|{{nonIdentifierPropertyName}})
35
38
constantVar : ({{constantIdentifier}})(?![_$[:alnum:]])
36
39
constructsAndModifiers : ' (?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b'
37
40
endOfStatement : ' ;|(?:^\s*{{constructsAndModifiers}})'
@@ -615,10 +618,10 @@ repository:
615
618
616
619
field-declaration :
617
620
name : meta.field.declaration.ts
618
- begin : (?x)(?<!\()(?:{{startOfIdentifier}}(readonly)\s+)?(?=\s*{{propertyName }}\s*(?:(?:(\?)|(\!))\s*)?(=|:|;|,|\}|$))
621
+ begin : (?x)(?<!\()(?:{{startOfIdentifier}}(readonly)\s+)?(?=\s*{{propertyNameWithPrivate }}\s*(?:(?:(\?)|(\!))\s*)?(=|:|;|,|\}|$))
619
622
beginCaptures :
620
623
' 1 ' : { name: storage.modifier.ts }
621
- end : (?x)(?=\}|;|,|$|(^(?!\s*{{propertyName }}\s*(?:(?:(\?)|(\!))\s*)?(=|:|;|,|$))))|(?<=\})
624
+ end : (?x)(?=\}|;|,|$|(^(?!\s*{{propertyNameWithPrivate }}\s*(?:(?:(\?)|(\!))\s*)?(=|:|;|,|$))))|(?<=\})
622
625
patterns :
623
626
- include : ' #variable-initializer'
624
627
- include : ' #type-annotation'
@@ -629,13 +632,13 @@ repository:
629
632
# function assignment |
630
633
# typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) =>
631
634
- match : |-
632
- (?x)({{identifier }})(?:(\?)|(\!))?(?=\s*{{functionLikeAssignmentOrType}})
635
+ (?x)({{propertyIdentifier }})(?:(\?)|(\!))?(?=\s*{{functionLikeAssignmentOrType}})
633
636
captures:
634
637
'1': { name: meta.definition.property.ts entity.name.function.ts }
635
638
'2': { name: keyword.operator.optional.ts }
636
639
'3': { name: keyword.operator.definiteassignment.ts }
637
640
- name : meta.definition.property.ts variable.object.property.ts
638
- match : ' {{identifier }}'
641
+ match : ' {{propertyIdentifier }}'
639
642
- name : keyword.operator.optional.ts
640
643
match : \?
641
644
- name : keyword.operator.definiteassignment.ts
@@ -1454,16 +1457,16 @@ repository:
1454
1457
1455
1458
# function call and new expression
1456
1459
function-call :
1457
- begin : (?=(((({{identifier}}\s*{{propertyAccessPreIdentifier}})* |({{propertyAccessPreIdentifier}})?)({{identifier }}))|(?<=[\)])){{functionCallLookup}})
1458
- end : (?<=\))(?!(((({{identifier}}\s*{{propertyAccessPreIdentifier}})* |({{propertyAccessPreIdentifier}})?)({{identifier }}))|(?<=[\)])){{functionCallLookup}})
1460
+ begin : (?=(((({{identifier}})( \s*{{propertyAccessPreIdentifier}}({{propertyIdentifier}}))*) |({{propertyAccessPreIdentifier}}{{propertyIdentifier }}))|(?<=[\)])){{functionCallLookup}})
1461
+ end : (?<=\))(?!(((({{identifier}})( \s*{{propertyAccessPreIdentifier}}({{propertyIdentifier}}))*) |({{propertyAccessPreIdentifier}}{{propertyIdentifier }}))|(?<=[\)])){{functionCallLookup}})
1459
1462
patterns :
1460
1463
- name : meta.function-call.ts
1461
- begin : (?=(({{identifier}}\s*{{propertyAccessPreIdentifier}})* |({{propertyAccessPreIdentifier}})?)({{identifier }}))
1464
+ begin : (?=(({{identifier}})( \s*{{propertyAccessPreIdentifier}}({{propertyIdentifier}}))*) |({{propertyAccessPreIdentifier}}{{propertyIdentifier }}))
1462
1465
end : (?={{functionCallLookup}})
1463
1466
patterns :
1464
1467
- include : ' #support-function-call-identifiers'
1465
1468
- name : entity.name.function.ts
1466
- match : ({{identifier }})
1469
+ match : ({{propertyIdentifier }})
1467
1470
- include : ' #comment'
1468
1471
- name : meta.function-call.ts punctuation.accessor.optional.ts
1469
1472
match : \?\.
@@ -2089,13 +2092,13 @@ repository:
2089
2092
'2': { name: punctuation.accessor.optional.ts }
2090
2093
'3': { name: entity.name.function.ts }
2091
2094
# const properties
2092
- - match : ' {{propertyAccess}}\s*{{constantVar}} '
2095
+ - match : ' {{propertyAccess}}\s*({{constantPropertyIdentifier}})(?![_$[:alnum:]]) '
2093
2096
captures :
2094
2097
' 1 ' : { name: punctuation.accessor.ts }
2095
2098
' 2 ' : { name: punctuation.accessor.optional.ts }
2096
2099
' 3 ' : { name: variable.other.constant.property.ts }
2097
2100
# properties
2098
- - match : ' {{propertyAccess}}\s*({{identifier }})'
2101
+ - match : ' {{propertyAccess}}\s*({{propertyIdentifier }})'
2099
2102
captures :
2100
2103
' 1 ' : { name: punctuation.accessor.ts }
2101
2104
' 2 ' : { name: punctuation.accessor.optional.ts }
@@ -2115,9 +2118,9 @@ repository:
2115
2118
# object properties
2116
2119
- match : |-
2117
2120
(?x){{propertyAccess}}\s*(?:
2118
- ({{constantIdentifier }}) |
2119
- ({{identifier }})
2120
- )(?=\s*{{propertyAccessPreIdentifier}}{{identifier }})
2121
+ ({{constantPropertyIdentifier }}) |
2122
+ ({{propertyIdentifier }})
2123
+ )(?=\s*{{propertyAccessPreIdentifier}}{{propertyIdentifier }})
2121
2124
captures:
2122
2125
'1': { name: punctuation.accessor.ts }
2123
2126
'2': { name: punctuation.accessor.optional.ts }
@@ -2128,7 +2131,7 @@ repository:
2128
2131
(?x)(?:
2129
2132
({{constantIdentifier}}) |
2130
2133
({{identifier}})
2131
- )(?=\s*{{propertyAccessPreIdentifier}}{{identifier }})
2134
+ )(?=\s*{{propertyAccessPreIdentifier}}{{propertyIdentifier }})
2132
2135
captures:
2133
2136
'1': { name: variable.other.constant.object.ts }
2134
2137
'2': { name: variable.other.object.ts }
0 commit comments