Skip to content

Commit d889de5

Browse files
aeschlidbaeumer
authored andcommitted
[typescript] update grammar
1 parent 3785324 commit d889de5

4 files changed

Lines changed: 330 additions & 225 deletions

File tree

extensions/javascript/syntaxes/JavaScript.tmLanguage.json

Lines changed: 108 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
"name": "storage.type.js"
7575
}
7676
},
77-
"end": "(?=$|;|}|(\\s+(of|in)\\s+))",
77+
"end": "(?=$|^|;|}|(\\s+(of|in)\\s+))",
7878
"patterns": [
7979
{
8080
"include": "#destructuring-variable"
@@ -103,7 +103,7 @@
103103
"name": "meta.definition.variable.js entity.name.function.js"
104104
}
105105
},
106-
"end": "(?=$|[;,=}]|(\\s+(of|in)\\s+))",
106+
"end": "(?=$|^|[;,=}]|(\\s+(of|in)\\s+))",
107107
"patterns": [
108108
{
109109
"include": "#var-single-variable-type-annotation"
@@ -118,7 +118,7 @@
118118
"name": "meta.definition.variable.js variable.other.constant.js"
119119
}
120120
},
121-
"end": "(?=$|[;,=}]|(\\s+(of|in)\\s+))",
121+
"end": "(?=$|^|[;,=}]|(\\s+(of|in)\\s+))",
122122
"patterns": [
123123
{
124124
"include": "#var-single-variable-type-annotation"
@@ -133,7 +133,7 @@
133133
"name": "meta.definition.variable.js variable.other.readwrite.js"
134134
}
135135
},
136-
"end": "(?=$|[;,=}]|(\\s+(of|in)\\s+))",
136+
"end": "(?=$|^|[;,=}]|(\\s+(of|in)\\s+))",
137137
"patterns": [
138138
{
139139
"include": "#var-single-variable-type-annotation"
@@ -160,7 +160,7 @@
160160
{
161161
"name": "meta.object-binding-pattern-variable.js",
162162
"begin": "(?<!=|:|of|in)\\s*(?=\\{)",
163-
"end": "(?=$|[;,=}]|(\\s+(of|in)\\s+))",
163+
"end": "(?=$|^|[;,=}]|(\\s+(of|in)\\s+))",
164164
"patterns": [
165165
{
166166
"include": "#object-binding-pattern"
@@ -176,7 +176,7 @@
176176
{
177177
"name": "meta.array-binding-pattern-variable.js",
178178
"begin": "(?<!=|:|of|in)\\s*(?=\\[)",
179-
"end": "(?=$|[;,=}]|(\\s+(of|in)\\s+))",
179+
"end": "(?=$|^|[;,=}]|(\\s+(of|in)\\s+))",
180180
"patterns": [
181181
{
182182
"include": "#array-binding-pattern"
@@ -1141,14 +1141,14 @@
11411141
"name": "storage.modifier.js"
11421142
}
11431143
},
1144-
"end": "(?=\\}|;|,|$)|(?<=\\})",
1144+
"end": "(?=\\}|;|,|$|(^(?!(([_$[:alpha:]][_$[:alnum:]]*)|(\\'[^']*\\')|(\\\"[^\"]*\\\")|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])+\\]))\\s*(\\?\\s*)?(=|:))))|(?<=\\})",
11451145
"patterns": [
11461146
{
11471147
"include": "#variable-initializer"
11481148
},
11491149
{
11501150
"begin": "(?=((?:[_$[:alpha:]][_$[:alnum:]]*)|(?:\\'[^']*\\')|(?:\\\"[^\"]*\\\")|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])+\\]))\\s*(\\?\\s*)?(=|:))",
1151-
"end": "(?=[};,=]|$)|(?<=\\})",
1151+
"end": "(?=[};,=]|$|(^(?!(([_$[:alpha:]][_$[:alnum:]]*)|(\\'[^']*\\')|(\\\"[^\"]*\\\")|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])+\\]))\\s*(\\?\\s*)?(=|:))))|(?<=\\})",
11521152
"patterns": [
11531153
{
11541154
"include": "#type-annotation"
@@ -1179,50 +1179,93 @@
11791179
]
11801180
},
11811181
"method-declaration": {
1182-
"name": "meta.method.declaration.js",
1183-
"begin": "(?<!\\.|\\$)(?:\\b(public|private|protected)\\s+)?(?:\\b(abstract)\\s+)?(?:\\b(async)\\s+)?(?:\\b(get|set)\\s+)?(?:(?:\\b(?:(new)|(constructor))\\b(?!\\$|\\.|:))|(?:(\\*)\\s*)?(?=((([_$[:alpha:]][_$[:alnum:]]*)|(\\'[^']*\\')|(\\\"[^\"]*\\\")|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])+\\]))\\s*(\\??))?\\s*[\\(\\<]))",
1184-
"beginCaptures": {
1185-
"1": {
1186-
"name": "storage.modifier.js"
1187-
},
1188-
"2": {
1189-
"name": "storage.modifier.js"
1190-
},
1191-
"3": {
1192-
"name": "storage.modifier.async.js"
1193-
},
1194-
"4": {
1195-
"name": "storage.type.property.js"
1196-
},
1197-
"5": {
1198-
"name": "keyword.operator.new.js"
1199-
},
1200-
"6": {
1201-
"name": "storage.type.js"
1202-
},
1203-
"7": {
1204-
"name": "keyword.generator.asterisk.js"
1205-
}
1206-
},
1207-
"end": "(?=\\}|;|,|$)|(?<=\\})",
12081182
"patterns": [
12091183
{
1210-
"include": "#method-declaration-name"
1211-
},
1212-
{
1213-
"include": "#comment"
1214-
},
1215-
{
1216-
"include": "#type-parameters"
1217-
},
1218-
{
1219-
"include": "#function-parameters"
1220-
},
1221-
{
1222-
"include": "#return-type"
1184+
"name": "meta.method.declaration.js",
1185+
"begin": "(?<!\\.|\\$)(?:\\b(public|private|protected)\\s+)?(?:\\b(abstract)\\s+)?(?:\\b(async)\\s+)?(?:\\b(get|set)\\s+)(?:(\\*)\\s*)?(?=((([_$[:alpha:]][_$[:alnum:]]*)|(\\'[^']*\\')|(\\\"[^\"]*\\\")|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])+\\]))\\s*(\\??))\\s*[\\(\\<])",
1186+
"beginCaptures": {
1187+
"1": {
1188+
"name": "storage.modifier.js"
1189+
},
1190+
"2": {
1191+
"name": "storage.modifier.js"
1192+
},
1193+
"3": {
1194+
"name": "storage.modifier.async.js"
1195+
},
1196+
"4": {
1197+
"name": "storage.type.property.js"
1198+
},
1199+
"5": {
1200+
"name": "keyword.generator.asterisk.js"
1201+
}
1202+
},
1203+
"end": "(?=\\}|;|,|$)|(?<=\\})",
1204+
"patterns": [
1205+
{
1206+
"include": "#method-declaration-name"
1207+
},
1208+
{
1209+
"include": "#comment"
1210+
},
1211+
{
1212+
"include": "#type-parameters"
1213+
},
1214+
{
1215+
"include": "#function-parameters"
1216+
},
1217+
{
1218+
"include": "#return-type"
1219+
},
1220+
{
1221+
"include": "#decl-block"
1222+
}
1223+
]
12231224
},
12241225
{
1225-
"include": "#decl-block"
1226+
"name": "meta.method.declaration.js",
1227+
"begin": "(?<!\\.|\\$)(?:\\b(public|private|protected)\\s+)?(?:\\b(abstract)\\s+)?(?:\\b(async)\\s+)?(?:(?:\\b(?:(new)|(constructor))\\b(?!\\$|\\.|:))|(?:(\\*)\\s*)?(?=((([_$[:alpha:]][_$[:alnum:]]*)|(\\'[^']*\\')|(\\\"[^\"]*\\\")|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])+\\]))\\s*(\\??))?\\s*[\\(\\<]))",
1228+
"beginCaptures": {
1229+
"1": {
1230+
"name": "storage.modifier.js"
1231+
},
1232+
"2": {
1233+
"name": "storage.modifier.js"
1234+
},
1235+
"3": {
1236+
"name": "storage.modifier.async.js"
1237+
},
1238+
"4": {
1239+
"name": "keyword.operator.new.js"
1240+
},
1241+
"5": {
1242+
"name": "storage.type.js"
1243+
},
1244+
"6": {
1245+
"name": "keyword.generator.asterisk.js"
1246+
}
1247+
},
1248+
"end": "(?=\\}|;|,|$)|(?<=\\})",
1249+
"patterns": [
1250+
{
1251+
"include": "#method-declaration-name"
1252+
},
1253+
{
1254+
"include": "#comment"
1255+
},
1256+
{
1257+
"include": "#type-parameters"
1258+
},
1259+
{
1260+
"include": "#function-parameters"
1261+
},
1262+
{
1263+
"include": "#return-type"
1264+
},
1265+
{
1266+
"include": "#decl-block"
1267+
}
1268+
]
12261269
}
12271270
]
12281271
},
@@ -1248,7 +1291,7 @@
12481291
},
12491292
"object-literal-method-declaration": {
12501293
"name": "meta.method.declaration.js",
1251-
"begin": "(?<!\\.|\\$)(?:\\b(async)\\s+)?(?:\\b(get|set)\\s+)?(?:(\\*)\\s*)?(?=((([_$[:alpha:]][_$[:alnum:]]*)|(\\'[^']*\\')|(\\\"[^\"]*\\\")|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])+\\]))\\s*(\\??))?\\s*[\\(\\<])",
1294+
"begin": "(?<!\\.|\\$)(?:\\b(async)\\s+)?(?:\\b(get|set)\\s+)?(?:(\\*)\\s*)?(?=((([_$[:alpha:]][_$[:alnum:]]*)|(\\'[^']*\\')|(\\\"[^\"]*\\\")|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])+\\]))\\s*(\\??))\\s*[\\(\\<])",
12521295
"beginCaptures": {
12531296
"1": {
12541297
"name": "storage.modifier.async.js"
@@ -1286,7 +1329,7 @@
12861329
]
12871330
},
12881331
"object-literal-method-overload-declaration": {
1289-
"begin": "(?<!\\.|\\$)(?:\\b(async)\\s+)?(?:\\b(get|set)\\s+)?(?:(\\*)\\s*)?(?=((([_$[:alpha:]][_$[:alnum:]]*)|(\\'[^']*\\')|(\\\"[^\"]*\\\")|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])+\\]))\\s*(\\??))?\\s*[\\(\\<])",
1332+
"begin": "(?<!\\.|\\$)(?:\\b(async)\\s+)?(?:\\b(get|set)\\s+)?(?:(\\*)\\s*)?(?=((([_$[:alpha:]][_$[:alnum:]]*)|(\\'[^']*\\')|(\\\"[^\"]*\\\")|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])+\\]))\\s*(\\??))\\s*[\\(\\<])",
12901333
"beginCaptures": {
12911334
"1": {
12921335
"name": "storage.modifier.async.js"
@@ -1386,7 +1429,7 @@
13861429
"name": "meta.definition.function.js entity.name.function.js"
13871430
}
13881431
},
1389-
"end": "(?=$|;)|(?<=\\})",
1432+
"end": "(?=$|^|;)|(?<=\\})",
13901433
"patterns": [
13911434
{
13921435
"include": "#comment"
@@ -1710,7 +1753,7 @@
17101753
"name": "keyword.operator.type.annotation.js"
17111754
}
17121755
},
1713-
"end": "(?<![:|&])((?=$)|(?=[{};,]|//))",
1756+
"end": "(?<![:|&])(?=$|^|[{};,]|//)",
17141757
"patterns": [
17151758
{
17161759
"include": "#comment"
@@ -1744,7 +1787,7 @@
17441787
"name": "keyword.operator.type.annotation.js"
17451788
}
17461789
},
1747-
"end": "(?=$|[,);\\}\\]]|//)|(?==[^>])|(?<=[\\}>\\]\\)]|[_$[:alpha:]])\\s*(?=\\{)",
1790+
"end": "(?=$|^|[,);\\}\\]]|//)|(?==[^>])|(?<=[\\}>\\]\\)]|[_$[:alpha:]])\\s*(?=\\{)",
17481791
"patterns": [
17491792
{
17501793
"include": "#comment"
@@ -2019,7 +2062,7 @@
20192062
"name": "punctuation.definition.typeparameters.begin.js"
20202063
}
20212064
},
2022-
"end": "(?=$)|(>)",
2065+
"end": "(>)",
20232066
"endCaptures": {
20242067
"1": {
20252068
"name": "punctuation.definition.typeparameters.end.js"
@@ -2054,7 +2097,7 @@
20542097
"name": "keyword.operator.assignment.js"
20552098
}
20562099
},
2057-
"end": "(?=$|[,);}\\]])",
2100+
"end": "(?=$|^|[,);}\\]])",
20582101
"patterns": [
20592102
{
20602103
"include": "#expression"
@@ -2693,7 +2736,7 @@
26932736
"name": "keyword.control.as.js"
26942737
}
26952738
},
2696-
"end": "(?=$|[;,:})\\]])",
2739+
"end": "(?=$|^|[;,:})\\]])",
26972740
"patterns": [
26982741
{
26992742
"include": "#type"
@@ -2778,7 +2821,7 @@
27782821
},
27792822
{
27802823
"name": "meta.arrow.js",
2781-
"begin": "(?x) (?:\n (?<!\\.|\\$)(\\basync)\n)? ((?<![})\\]])\\s*\n (?=\n # sure shot arrow functions even if => is on new line\n (\n [(]\\s*\n (\n ([)]\\s*:) | # ():\n ((\\.\\.\\.\\s*)?[_$[:alpha:]][_$[:alnum:]]*\\s*:) # [(]param: | [(]...param:\n )\n ) |\n (\n [<]\\s*[_$[:alpha:]][_$[:alnum:]]*\\s+extends\\s*[^=>] # < typeparam extends \n ) |\n # arrow function possible to detect only with => on same line\n (\n (<([^<>=]|=[^<]|\\<([^=<>]|=[^<])+\\>)+>\\s*)? # typeparameters\n \\(([^()]|\\([^()]*\\))*\\) # parameteres\n (\\s*:\\s*(.)*)? # return type\n \\s*=> # arrow operator\n )\n )\n)",
2824+
"begin": "(?x) (?:\n (?<!\\.|\\$)(\\basync)\n)? ((?<![})!\\]])\\s*\n (?=\n # sure shot arrow functions even if => is on new line\n (\n [(]\\s*\n (\n ([)]\\s*:) | # ():\n ((\\.\\.\\.\\s*)?[_$[:alpha:]][_$[:alnum:]]*\\s*:) # [(]param: | [(]...param:\n )\n ) |\n (\n [<]\\s*[_$[:alpha:]][_$[:alnum:]]*\\s+extends\\s*[^=>] # < typeparam extends \n ) |\n # arrow function possible to detect only with => on same line\n (\n (<([^<>=]|=[^<]|\\<([^=<>]|=[^<])+\\>)+>\\s*)? # typeparameters\n \\(([^()]|\\([^()]*\\))*\\) # parameteres\n (\\s*:\\s*(.)*)? # return type\n \\s*=> # arrow operator\n )\n )\n)",
27822825
"beginCaptures": {
27832826
"1": {
27842827
"name": "storage.modifier.async.js"
@@ -3358,25 +3401,17 @@
33583401
}
33593402
},
33603403
{
3361-
"begin": "(^[ \\t]+)?(?=//)",
3404+
"begin": "(^[ \\t]+)?(//)",
33623405
"beginCaptures": {
33633406
"1": {
33643407
"name": "punctuation.whitespace.comment.leading.js"
3408+
},
3409+
"2": {
3410+
"name": "comment.line.double-slash.js punctuation.definition.comment.js"
33653411
}
33663412
},
3367-
"end": "(?=$)",
3368-
"patterns": [
3369-
{
3370-
"name": "comment.line.double-slash.js",
3371-
"begin": "//",
3372-
"beginCaptures": {
3373-
"0": {
3374-
"name": "punctuation.definition.comment.js"
3375-
}
3376-
},
3377-
"end": "(?=$)"
3378-
}
3379-
]
3413+
"end": "(?=^)",
3414+
"contentName": "comment.line.double-slash.tsx"
33803415
}
33813416
]
33823417
},
@@ -3388,7 +3423,7 @@
33883423
"name": "punctuation.definition.comment.js"
33893424
}
33903425
},
3391-
"end": "(?=$)",
3426+
"end": "(?=^)",
33923427
"patterns": [
33933428
{
33943429
"name": "meta.tag.js",
@@ -4188,5 +4223,5 @@
41884223
]
41894224
}
41904225
},
4191-
"version": "https://github.com/Microsoft/TypeScript-TmLanguage/commit/cb1af7953db224204607cbe22d3a45aa0f77a4c1"
4226+
"version": "https://github.com/Microsoft/TypeScript-TmLanguage/commit/8c967fe7553297bfad672b7417d78e357c8fe724"
41924227
}

extensions/javascript/test/colorize-results/test_jsx.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@
529529
},
530530
{
531531
"c": " Prevent following the link.",
532-
"t": "source.js meta.var.expr.js meta.objectliteral.js meta.object.member.js meta.function.expression.js meta.block.js comment.line.double-slash.js",
532+
"t": "source.js meta.var.expr.js meta.objectliteral.js meta.object.member.js meta.function.expression.js meta.block.js comment.line.double-slash.tsx",
533533
"r": {
534534
"dark_plus": "comment: #608B4E",
535535
"light_plus": "comment: #008000",
@@ -628,7 +628,7 @@
628628
},
629629
{
630630
"c": " Invert the chosen default.",
631-
"t": "source.js meta.var.expr.js meta.objectliteral.js meta.object.member.js meta.function.expression.js meta.block.js comment.line.double-slash.js",
631+
"t": "source.js meta.var.expr.js meta.objectliteral.js meta.object.member.js meta.function.expression.js meta.block.js comment.line.double-slash.tsx",
632632
"r": {
633633
"dark_plus": "comment: #608B4E",
634634
"light_plus": "comment: #008000",
@@ -661,7 +661,7 @@
661661
},
662662
{
663663
"c": " This will trigger an intelligent re-render of the component.",
664-
"t": "source.js meta.var.expr.js meta.objectliteral.js meta.object.member.js meta.function.expression.js meta.block.js comment.line.double-slash.js",
664+
"t": "source.js meta.var.expr.js meta.objectliteral.js meta.object.member.js meta.function.expression.js meta.block.js comment.line.double-slash.tsx",
665665
"r": {
666666
"dark_plus": "comment: #608B4E",
667667
"light_plus": "comment: #008000",
@@ -1046,7 +1046,7 @@
10461046
},
10471047
{
10481048
"c": " Default to the default message.",
1049-
"t": "source.js meta.var.expr.js meta.objectliteral.js meta.object.member.js meta.function.expression.js meta.block.js comment.line.double-slash.js",
1049+
"t": "source.js meta.var.expr.js meta.objectliteral.js meta.object.member.js meta.function.expression.js meta.block.js comment.line.double-slash.tsx",
10501050
"r": {
10511051
"dark_plus": "comment: #608B4E",
10521052
"light_plus": "comment: #008000",
@@ -1222,7 +1222,7 @@
12221222
},
12231223
{
12241224
"c": " If toggled, show the alternate message.",
1225-
"t": "source.js meta.var.expr.js meta.objectliteral.js meta.object.member.js meta.function.expression.js meta.block.js comment.line.double-slash.js",
1225+
"t": "source.js meta.var.expr.js meta.objectliteral.js meta.object.member.js meta.function.expression.js meta.block.js comment.line.double-slash.tsx",
12261226
"r": {
12271227
"dark_plus": "comment: #608B4E",
12281228
"light_plus": "comment: #008000",

0 commit comments

Comments
 (0)