@@ -12,6 +12,8 @@ variables:
1212 propertyAccessPreIdentifier : \??\.\s*
1313 identifier : ' [_$[:alpha:]][_$[:alnum:]]*'
1414 constantIdentifier : ' [[:upper:]][_$[:digit:][:upper:]]*'
15+ propertyIdentifier : ' \#?{{identifier}}'
16+ constantPropertyIdentifier : ' \#?{{constantIdentifier}}'
1517 quotedStrings : (\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`)
1618 nonIdentifierPropertyName : ' {{quotedStrings}}|(\[([^\[\]]|\[[^\[\]]*\])+\])'
1719 label : ({{identifier}})\s*(:)
@@ -32,6 +34,7 @@ variables:
3234 anyNumber : ({{hexNumber}})|({{binaryNumber}})|({{octalNumber}})|({{decimalNumber}})
3335 # any use of property name needs to ignore line breaks in regular expression because of decimal number regex (maintained for readability)
3436 propertyName : ({{anyNumber}}|({{identifier}})|{{nonIdentifierPropertyName}})
37+ propertyNameWithPrivate : ({{anyNumber}}|({{propertyIdentifier}})|{{nonIdentifierPropertyName}})
3538 constantVar : ({{constantIdentifier}})(?![_$[:alnum:]])
3639 constructsAndModifiers : ' (?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b'
3740 endOfStatement : ' ;|(?:^\s*{{constructsAndModifiers}})'
@@ -615,10 +618,10 @@ repository:
615618
616619 field-declaration :
617620 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*)?(=|:|;|,|\}|$))
619622 beginCaptures :
620623 ' 1 ' : { name: storage.modifier.ts }
621- end : (?x)(?=\}|;|,|$|(^(?!\s*{{propertyName }}\s*(?:(?:(\?)|(\!))\s*)?(=|:|;|,|$))))|(?<=\})
624+ end : (?x)(?=\}|;|,|$|(^(?!\s*{{propertyNameWithPrivate }}\s*(?:(?:(\?)|(\!))\s*)?(=|:|;|,|$))))|(?<=\})
622625 patterns :
623626 - include : ' #variable-initializer'
624627 - include : ' #type-annotation'
@@ -629,13 +632,13 @@ repository:
629632 # function assignment |
630633 # typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) =>
631634 - match : |-
632- (?x)({{identifier }})(?:(\?)|(\!))?(?=\s*{{functionLikeAssignmentOrType}})
635+ (?x)({{propertyIdentifier }})(?:(\?)|(\!))?(?=\s*{{functionLikeAssignmentOrType}})
633636 captures:
634637 '1': { name: meta.definition.property.ts entity.name.function.ts }
635638 '2': { name: keyword.operator.optional.ts }
636639 '3': { name: keyword.operator.definiteassignment.ts }
637640 - name : meta.definition.property.ts variable.object.property.ts
638- match : ' {{identifier }}'
641+ match : ' {{propertyIdentifier }}'
639642 - name : keyword.operator.optional.ts
640643 match : \?
641644 - name : keyword.operator.definiteassignment.ts
@@ -1454,16 +1457,16 @@ repository:
14541457
14551458 # function call and new expression
14561459 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}})
14591462 patterns :
14601463 - name : meta.function-call.ts
1461- begin : (?=(({{identifier}}\s*{{propertyAccessPreIdentifier}})* |({{propertyAccessPreIdentifier}})?)({{identifier }}))
1464+ begin : (?=(({{identifier}})( \s*{{propertyAccessPreIdentifier}}({{propertyIdentifier}}))*) |({{propertyAccessPreIdentifier}}{{propertyIdentifier }}))
14621465 end : (?={{functionCallLookup}})
14631466 patterns :
14641467 - include : ' #support-function-call-identifiers'
14651468 - name : entity.name.function.ts
1466- match : ({{identifier }})
1469+ match : ({{propertyIdentifier }})
14671470 - include : ' #comment'
14681471 - name : meta.function-call.ts punctuation.accessor.optional.ts
14691472 match : \?\.
@@ -2089,13 +2092,13 @@ repository:
20892092 '2': { name: punctuation.accessor.optional.ts }
20902093 '3': { name: entity.name.function.ts }
20912094 # const properties
2092- - match : ' {{propertyAccess}}\s*{{constantVar}} '
2095+ - match : ' {{propertyAccess}}\s*({{constantPropertyIdentifier}})(?![_$[:alnum:]]) '
20932096 captures :
20942097 ' 1 ' : { name: punctuation.accessor.ts }
20952098 ' 2 ' : { name: punctuation.accessor.optional.ts }
20962099 ' 3 ' : { name: variable.other.constant.property.ts }
20972100 # properties
2098- - match : ' {{propertyAccess}}\s*({{identifier }})'
2101+ - match : ' {{propertyAccess}}\s*({{propertyIdentifier }})'
20992102 captures :
21002103 ' 1 ' : { name: punctuation.accessor.ts }
21012104 ' 2 ' : { name: punctuation.accessor.optional.ts }
@@ -2115,9 +2118,9 @@ repository:
21152118 # object properties
21162119 - match : |-
21172120 (?x){{propertyAccess}}\s*(?:
2118- ({{constantIdentifier }}) |
2119- ({{identifier }})
2120- )(?=\s*{{propertyAccessPreIdentifier}}{{identifier }})
2121+ ({{constantPropertyIdentifier }}) |
2122+ ({{propertyIdentifier }})
2123+ )(?=\s*{{propertyAccessPreIdentifier}}{{propertyIdentifier }})
21212124 captures:
21222125 '1': { name: punctuation.accessor.ts }
21232126 '2': { name: punctuation.accessor.optional.ts }
@@ -2128,7 +2131,7 @@ repository:
21282131 (?x)(?:
21292132 ({{constantIdentifier}}) |
21302133 ({{identifier}})
2131- )(?=\s*{{propertyAccessPreIdentifier}}{{identifier }})
2134+ )(?=\s*{{propertyAccessPreIdentifier}}{{propertyIdentifier }})
21322135 captures:
21332136 '1': { name: variable.other.constant.object.ts }
21342137 '2': { name: variable.other.object.ts }
0 commit comments