Skip to content

Commit ad57425

Browse files
committed
Fixes the yaml to fix #363
1 parent 1e6da30 commit ad57425

File tree

4 files changed

+301
-131
lines changed

4 files changed

+301
-131
lines changed

TypeScript.YAML-tmLanguage

Lines changed: 111 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -49,25 +49,27 @@ repository:
4949
- name: meta.var-single-variable.expr.ts
5050
# function assignment |
5151
# typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) =>
52-
begin: (?x)([_$[:alpha:]][_$[:alnum:]]*)(?=\s*
53-
(=\s*(
54-
(async\s+) |
55-
(function\s*[(<]) |
56-
(function\s+) |
57-
([_$[:alpha:]][_$[:alnum:]]*\s*=>) |
58-
((<([^<>]|\<[^<>]+\>)+>\s*)?\(([^()]|\([^()]*\))*\)(\s*:\s*(.)*)?\s*=>))
59-
) |
60-
(:\s*(
61-
(<) |
62-
([(]\s*(
63-
([)]) |
64-
(\.\.\.) |
65-
([_$[:alnum:]]+\s*(
66-
([:,?=])|
67-
([)]\s*=>)
68-
))
69-
)))
70-
))
52+
begin: |-
53+
(?x)([_$[:alpha:]][_$[:alnum:]]*)(?=\s*
54+
(=\s*(
55+
(async\s+) |
56+
(function\s*[(<]) |
57+
(function\s+) |
58+
([_$[:alpha:]][_$[:alnum:]]*\s*=>) |
59+
((<([^<>]|\<[^<>]+\>)+>\s*)?\(([^()]|\([^()]*\))*\)(\s*:\s*(.)*)?\s*=>))
60+
) |
61+
(:\s*(
62+
(<) |
63+
([(]\s*(
64+
([)]) |
65+
(\.\.\.) |
66+
([_$[:alnum:]]+\s*(
67+
([:,?=])|
68+
([)]\s*=>)
69+
))
70+
)))
71+
)
72+
)
7173
beginCaptures:
7274
'1': { name: meta.definition.variable.ts entity.name.function.ts }
7375
end: (?=$|[;,=}]|(\s+(of|in)\s+))
@@ -409,8 +411,9 @@ repository:
409411
patterns:
410412
- include: '#comment'
411413
- comment: (default|*|name) as alias
412-
match: '(?x) (?: \b(default)\b | (\*) | ([_$[:alpha:]][_$[:alnum:]]*)) \s+
413-
(as) \s+ (?: (\b default \b | \*) | ([_$[:alpha:]][_$[:alnum:]]*))'
414+
match: |-
415+
(?x) (?: \b(default)\b | (\*) | ([_$[:alpha:]][_$[:alnum:]]*)) \s+
416+
(as) \s+ (?: (\b default \b | \*) | ([_$[:alpha:]][_$[:alnum:]]*))
414417
captures:
415418
'1': { name: keyword.control.default.ts }
416419
'2': { name: constant.language.import-export-all.ts }
@@ -428,7 +431,7 @@ repository:
428431

429432
class-or-interface-declaration:
430433
name: meta.class.ts
431-
begin: '(?<!\.|\$)\b(?:(export)\s+)?\b(?:(abstract)\s+)?\b(?:(class)|(interface))\b'
434+
begin: (?<!\.|\$)\b(?:(export)\s+)?\b(?:(abstract)\s+)?\b(?:(class)|(interface))\b
432435
beginCaptures:
433436
'1': { name: keyword.control.export.ts }
434437
'2': { name: storage.modifier.ts }
@@ -447,7 +450,7 @@ repository:
447450
- include: '#class-or-interface-body'
448451

449452
class-or-interface-heritage:
450-
begin: '(?<!\.|\$)(?:\b(extends|implements)\b)(?!\$)'
453+
begin: (?<!\.|\$)(?:\b(extends|implements)\b)(?!\$)
451454
beginCaptures:
452455
'1': { name: storage.modifier.ts }
453456
end: (?=\{)
@@ -534,25 +537,27 @@ repository:
534537
- name: meta.definition.property.ts entity.name.function.ts
535538
# function assignment |
536539
# typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) =>
537-
match: (?x)([_$[:alpha:]][_$[:alnum:]]*)(?=(\?\s*)?\s*
538-
(=\s*(
539-
(async\s+) |
540-
(function\s*[(<]) |
541-
(function\s+) |
542-
([_$[:alpha:]][_$[:alnum:]]*\s*=>) |
543-
((<([^<>]|\<[^<>]+\>)+>\s*)?\(([^()]|\([^()]*\))*\)(\s*:\s*(.)*)?\s*=>))
544-
) |
545-
(:\s*(
546-
(<) |
547-
([(]\s*(
548-
([)]) |
549-
(\.\.\.) |
550-
([_$[:alnum:]]+\s*(
551-
([:,?=])|
552-
([)]\s*=>)
553-
))
554-
)))
555-
))
540+
match: |-
541+
(?x)([_$[:alpha:]][_$[:alnum:]]*)(?=(\?\s*)?\s*
542+
(=\s*(
543+
(async\s+) |
544+
(function\s*[(<]) |
545+
(function\s+) |
546+
([_$[:alpha:]][_$[:alnum:]]*\s*=>) |
547+
((<([^<>]|\<[^<>]+\>)+>\s*)?\(([^()]|\([^()]*\))*\)(\s*:\s*(.)*)?\s*=>))
548+
) |
549+
(:\s*(
550+
(<) |
551+
([(]\s*(
552+
([)]) |
553+
(\.\.\.) |
554+
([_$[:alnum:]]+\s*(
555+
([:,?=])|
556+
([)]\s*=>)
557+
))
558+
)))
559+
)
560+
)
556561
- name: meta.definition.property.ts variable.object.property.ts
557562
match: '[_$[:alpha:]][_$[:alnum:]]*'
558563
- name: keyword.operator.optional.ts
@@ -725,25 +730,27 @@ repository:
725730
patterns:
726731
# function assignment |
727732
# typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) =>
728-
- match: (?x)(?:\s*\b(readonly)\s+)?(?:\s*\b(public|private|protected)\s+)?(\.\.\.)?\s*(?<!=|:)([_$[:alpha:]][_$[:alnum:]]*)\s*(\??)(?=\s*
729-
(=\s*(
730-
(async\s+) |
731-
(function\s*[(<]) |
732-
(function\s+) |
733-
([_$[:alpha:]][_$[:alnum:]]*\s*=>) |
734-
((<([^<>]|\<[^<>]+\>)+>\s*)?\(([^()]|\([^()]*\))*\)(\s*:\s*(.)*)?\s*=>))
735-
) |
736-
(:\s*(
737-
(<) |
738-
([(]\s*(
739-
([)]) |
740-
(\.\.\.) |
741-
([_$[:alnum:]]+\s*(
742-
([:,?=])|
743-
([)]\s*=>)
744-
))
745-
)))
746-
))
733+
- match: |-
734+
(?x)(?:\s*\b(readonly)\s+)?(?:\s*\b(public|private|protected)\s+)?(\.\.\.)?\s*(?<!=|:)([_$[:alpha:]][_$[:alnum:]]*)\s*(\??)(?=\s*
735+
(=\s*(
736+
(async\s+) |
737+
(function\s*[(<]) |
738+
(function\s+) |
739+
([_$[:alpha:]][_$[:alnum:]]*\s*=>) |
740+
((<([^<>]|\<[^<>]+\>)+>\s*)?\(([^()]|\([^()]*\))*\)(\s*:\s*(.)*)?\s*=>))
741+
) |
742+
(:\s*(
743+
(<) |
744+
([(]\s*(
745+
([)]) |
746+
(\.\.\.) |
747+
([_$[:alnum:]]+\s*(
748+
([:,?=])|
749+
([)]\s*=>)
750+
))
751+
)))
752+
)
753+
)
747754
captures:
748755
'1': { name: storage.modifier.ts }
749756
'2': { name: storage.modifier.ts }
@@ -832,7 +839,7 @@ repository:
832839

833840
return-type:
834841
name: meta.return.type.ts
835-
begin: '(?<=\))\s*(:)'
842+
begin: (?<=\))\s*(:)
836843
beginCaptures:
837844
'1': { name: keyword.operator.type.annotation.ts }
838845
end: (?<!:)((?=$)|(?=\{|;|//|\}))
@@ -902,22 +909,22 @@ repository:
902909

903910
type-primitive:
904911
name: support.type.primitive.ts
905-
match: '(?<!\.|\$)\b(string|number|boolean|symbol|any|void|never)\b(?!\$)'
912+
match: (?<!\.|\$)\b(string|number|boolean|symbol|any|void|never)\b(?!\$)
906913

907914
type-builtin-literals:
908915
name: support.type.builtin.ts
909-
match: '(?<!\.|\$)\b(this|true|false|undefined|null)\b(?!\$)'
916+
match: (?<!\.|\$)\b(this|true|false|undefined|null)\b(?!\$)
910917

911918
# Parenthesis can contain either types and function parameters
912919
# (number | string) or (param: number, param2: string)
913920
# and it can be nested, for example
914921
# (number | (param: number, param2: string) => void)
915922
type-paren-or-function-parameters:
916923
name: meta.type.paren.cover.ts
917-
begin: '\('
924+
begin: \(
918925
beginCaptures:
919926
'0': { name: meta.brace.round.ts }
920-
end: '\)'
927+
end: \)
921928
endCaptures:
922929
'0': { name: meta.brace.round.ts }
923930
patterns:
@@ -946,18 +953,19 @@ repository:
946953
- include: '#function-parameters'
947954
# () | (... | (param: | (param, | (param? | (param= | (param) =>
948955
- name: meta.type.function.ts
949-
begin: '(?x)(
950-
(?=
951-
[(]\s*(
952-
([)]) |
953-
(\.\.\.) |
954-
([_$[:alnum:]]+\s*(
955-
([:,?=])|
956-
([)]\s*=>)
957-
))
956+
begin: |-
957+
(?x)(
958+
(?=
959+
[(]\s*(
960+
([)]) |
961+
(\.\.\.) |
962+
([_$[:alnum:]]+\s*(
963+
([:,?=])|
964+
([)]\s*=>)
965+
))
966+
)
958967
)
959968
)
960-
)'
961969
end: (?<=\))
962970
patterns:
963971
- include: '#function-parameters'
@@ -1023,7 +1031,7 @@ repository:
10231031
patterns:
10241032
- include: '#comment'
10251033
- name: storage.modifier.ts
1026-
match: '(?<!\.|\$)\b(extends)\b(?!\$)'
1034+
match: (?<!\.|\$)\b(extends)\b(?!\$)
10271035
- include: '#type'
10281036
- include: '#punctuation-comma'
10291037

@@ -1062,7 +1070,7 @@ repository:
10621070

10631071
switch-block:
10641072
name: switch-block.expr.ts
1065-
begin: '{'
1073+
begin: \{
10661074
beginCaptures:
10671075
'0': { name: punctuation.definition.block.ts }
10681076
end: (?=\})
@@ -1072,7 +1080,7 @@ repository:
10721080

10731081
case-clause:
10741082
name: case-clause.expr.ts
1075-
begin: '(?<!\.|\$)\b(case|default(?=:))\b(?!\$)'
1083+
begin: (?<!\.|\$)\b(case|default(?=:))\b(?!\$)
10761084
beginCaptures:
10771085
'1': { name: keyword.control.switch.ts }
10781086
end: ':'
@@ -1084,7 +1092,7 @@ repository:
10841092
switch-statement:
10851093
name: switch-statement.expr.ts
10861094
begin: (?<!\.|\$)(?=\bswitch\s*\()
1087-
end: '}'
1095+
end: \}
10881096
endCaptures:
10891097
'0': {name: punctuation.definition.block.ts}
10901098
patterns:
@@ -1097,16 +1105,18 @@ repository:
10971105
match: (?<!\.|\$)\b(arguments)\b(?!\$)
10981106
# builtins
10991107
- name: support.class.builtin.ts
1100-
match: (?x)(?<!\.|\$)\b(Array|ArrayBuffer|Atomics|Boolean|DataView|Date|Float32Array|Float64Array|Function|Generator
1101-
|GeneratorFunction|Int8Array|Int16Array|Int32Array|Intl|Map|Number|Object|Promise|Proxy
1102-
|Reflect|RegExp|Set|SharedArrayBuffer|SIMD|String|Symbol|TypedArray
1103-
|Uint8Array|Uint16Array|Uint32Array|Uint8ClampedArray|WeakMap|WeakSet)\b(?!\$)
1108+
match: |-
1109+
(?x)(?<!\.|\$)\b(Array|ArrayBuffer|Atomics|Boolean|DataView|Date|Float32Array|Float64Array|Function|Generator
1110+
|GeneratorFunction|Int8Array|Int16Array|Int32Array|Intl|Map|Number|Object|Promise|Proxy
1111+
|Reflect|RegExp|Set|SharedArrayBuffer|SIMD|String|Symbol|TypedArray
1112+
|Uint8Array|Uint16Array|Uint32Array|Uint8ClampedArray|WeakMap|WeakSet)\b(?!\$)
11041113
- name: support.class.error.ts
11051114
match: (?<!\.|\$)\b((Eval|Internal|Range|Reference|Syntax|Type|URI)?Error)\b(?!\$)
11061115
# known builtin function calls
11071116
- name: support.function.ts
1108-
match: (?x)(?<!\.|\$)\b(clear(Interval|Timeout)|decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|escape|eval|
1109-
isFinite|isNaN|parseFloat|parseInt|require|set(Interval|Timeout)|super|unescape|uneval)(?=\s*\()
1117+
match: |-
1118+
(?x)(?<!\.|\$)\b(clear(Interval|Timeout)|decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|escape|eval|
1119+
isFinite|isNaN|parseFloat|parseInt|require|set(Interval|Timeout)|super|unescape|uneval)(?=\s*\()
11101120
# Math
11111121
- match: |-
11121122
(?x)(?<!\.|\$)\b(Math)(?:\s*(\.)\s*(?:
@@ -1397,10 +1407,11 @@ repository:
13971407
'2': { name: constant.other.object.property.ts }
13981408
'3': { name: variable.other.object.property.ts }
13991409
# function and method assignment
1400-
- match: (?x)(?:(\.)\s*)?([_$[:alpha:]][_$[:alnum:]]*)(?=\s*=\s*(
1401-
(async\s+)|(function\s*[(<])|(function\s+)|
1402-
([_$[:alpha:]][_$[:alnum:]]*\s*=>)|
1403-
((<([^<>]|\<[^<>]+\>)+>\s*)?\(([^()]|\([^()]*\))*\)(\s*:\s*(.)*)?\s*=>)))
1410+
- match: |-
1411+
(?x)(?:(\.)\s*)?([_$[:alpha:]][_$[:alnum:]]*)(?=\s*=\s*(
1412+
(async\s+)|(function\s*[(<])|(function\s+)|
1413+
([_$[:alpha:]][_$[:alnum:]]*\s*=>)|
1414+
((<([^<>]|\<[^<>]+\>)+>\s*)?\(([^()]|\([^()]*\))*\)(\s*:\s*(.)*)?\s*=>)))
14041415
captures:
14051416
'1': { name: punctuation.accessor.ts }
14061417
'2': { name: entity.name.function.ts }
@@ -1436,21 +1447,21 @@ repository:
14361447
# If '<' is preceeded by 'return', 'throw', 'yield', or 'await', it's most likely a type assertion
14371448
# If '=', '(', ',', ':', or '>' are followed by a '<', it is also likely a type assertion as otherwise it would be a syntax error
14381449
# '<=' and '<<=' are cannot be type assertions, as they are assignment operators.
1439-
begin: '(?:(?<=return|throw|yield|await|default|[=(,:>*]))\s*(<)(?!<?\=)'
1450+
begin: (?:(?<=return|throw|yield|await|default|[=(,:>*]))\s*(<)(?!<?\=)
14401451
beginCaptures:
14411452
'1': { name: meta.brace.angle.ts }
1442-
end: '>'
1453+
end: \>
14431454
endCaptures:
14441455
'0': { name: meta.brace.angle.ts }
14451456
patterns:
14461457
- include: '#type'
14471458

14481459
new-expr:
14491460
name: new.expr.ts
1450-
begin: '(?<!\.|\$)\b(new)\b(?!\$)'
1461+
begin: (?<!\.|\$)\b(new)\b(?!\$)
14511462
beginCaptures:
14521463
'1': { name: keyword.operator.new.ts }
1453-
end: '(?<=\))|(?=[;),]|$|((?<!\.|\$)\bnew\b(?!\$)))'
1464+
end: (?<=\))|(?=[;),]|$|((?<!\.|\$)\bnew\b(?!\$)))
14541465
patterns:
14551466
- include: '#paren-expression'
14561467
- include: '#class-or-interface-declaration'
@@ -1474,10 +1485,11 @@ repository:
14741485
- include: '#array-literal'
14751486
- include: '#expression'
14761487
- name: meta.object.member.ts
1477-
begin: (?x)(?:([_$[:alpha:]][_$[:alnum:]]*)\s*(:)(?=\s*(
1478-
(async\s+)|(function\s*[(<])|(function\s+)|
1479-
([_$[:alpha:]][_$[:alnum:]]*\s*=>)|
1480-
((<([^<>]|\<[^<>]+\>)+>\s*)?\(([^()]|\([^()]*\))*\)(\s*:\s*(.)*)?\s*=>))))
1488+
begin: |-
1489+
(?x)(?:([_$[:alpha:]][_$[:alnum:]]*)\s*(:)(?=\s*(
1490+
(async\s+)|(function\s*[(<])|(function\s+)|
1491+
([_$[:alpha:]][_$[:alnum:]]*\s*=>)|
1492+
((<([^<>]|\<[^<>]+\>)+>\s*)?\(([^()]|\([^()]*\))*\)(\s*:\s*(.)*)?\s*=>))))
14811493
beginCaptures:
14821494
'0': { name: meta.object-literal.key.ts }
14831495
'1': { name: entity.name.function.ts }
@@ -1912,7 +1924,7 @@ repository:
19121924
- name: entity.other.attribute-name.directive.ts
19131925
match: 'path|types|no-default-lib|name'
19141926
- name: keyword.operator.assignment.ts
1915-
match: =
1927+
match: '='
19161928
- include: '#string'
19171929

19181930
docblock:

0 commit comments

Comments
 (0)