1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
if !has_key(g:polyglot_is_disabled, 'typescript')
finish
endif
"Import
syntax keyword typescriptImport from as
syntax keyword typescriptImport import
\ nextgroup=typescriptImportType
\ skipwhite
syntax keyword typescriptImportType type
\ contained
syntax keyword typescriptExport export
\ nextgroup=typescriptExportType
\ skipwhite
syntax match typescriptExportType /\<type\s*{\@=/
\ contained skipwhite skipempty skipnl
syntax keyword typescriptModule namespace module
"this
"JavaScript Prototype
syntax keyword typescriptPrototype prototype
\ nextgroup=@afterIdentifier
syntax keyword typescriptCastKeyword as
\ nextgroup=@typescriptType
\ skipwhite
"Program Keywords
syntax keyword typescriptIdentifier arguments this super
\ nextgroup=@afterIdentifier
syntax keyword typescriptVariable let var
\ nextgroup=@typescriptVariableDeclarations
\ skipwhite skipempty
syntax keyword typescriptVariable const
\ nextgroup=typescriptEnum,@typescriptVariableDeclarations
\ skipwhite skipempty
syntax region typescriptEnum matchgroup=typescriptEnumKeyword start=/enum / end=/\ze{/
\ nextgroup=typescriptBlock
\ skipwhite
syntax keyword typescriptKeywordOp
\ contained in instanceof nextgroup=@typescriptValue
syntax keyword typescriptOperator delete new typeof void
\ nextgroup=@typescriptValue
\ skipwhite skipempty
syntax keyword typescriptForOperator contained in of
syntax keyword typescriptBoolean true false nextgroup=@typescriptSymbols skipwhite skipempty
syntax keyword typescriptNull null undefined nextgroup=@typescriptSymbols skipwhite skipempty
syntax keyword typescriptMessage alert confirm prompt status
\ nextgroup=typescriptDotNotation,typescriptFuncCallArg
syntax keyword typescriptGlobal self top parent
\ nextgroup=@afterIdentifier
"Statement Keywords
syntax keyword typescriptConditional if else switch
\ nextgroup=typescriptConditionalParen
\ skipwhite skipempty skipnl
syntax keyword typescriptConditionalElse else
syntax keyword typescriptRepeat do while for nextgroup=typescriptLoopParen skipwhite skipempty
syntax keyword typescriptRepeat for nextgroup=typescriptLoopParen,typescriptAsyncFor skipwhite skipempty
syntax keyword typescriptBranch break continue containedin=typescriptBlock
syntax keyword typescriptCase case nextgroup=@typescriptPrimitive skipwhite containedin=typescriptBlock
syntax keyword typescriptDefault default containedin=typescriptBlock nextgroup=@typescriptValue,typescriptClassKeyword,typescriptInterfaceKeyword skipwhite oneline
syntax keyword typescriptStatementKeyword with
syntax keyword typescriptStatementKeyword yield skipwhite nextgroup=@typescriptValue containedin=typescriptBlock
syntax keyword typescriptStatementKeyword return skipwhite contained nextgroup=@typescriptValue containedin=typescriptBlock
syntax keyword typescriptTry try
syntax keyword typescriptExceptions catch throw finally
syntax keyword typescriptDebugger debugger
syntax keyword typescriptAsyncFor await nextgroup=typescriptLoopParen skipwhite skipempty contained
syntax region typescriptLoopParen contained matchgroup=typescriptParens
\ start=/(/ end=/)/
\ contains=typescriptVariable,typescriptForOperator,typescriptEndColons,@typescriptValue,@typescriptComments
\ nextgroup=typescriptBlock
\ skipwhite skipempty
syntax region typescriptConditionalParen contained matchgroup=typescriptParens
\ start=/(/ end=/)/
\ contains=@typescriptValue,@typescriptComments
\ nextgroup=typescriptBlock
\ skipwhite skipempty
syntax match typescriptEndColons /[;,]/ contained
syntax keyword typescriptAmbientDeclaration declare nextgroup=@typescriptAmbients
\ skipwhite skipempty
syntax cluster typescriptAmbients contains=
\ typescriptVariable,
\ typescriptFuncKeyword,
\ typescriptClassKeyword,
\ typescriptAbstract,
\ typescriptEnumKeyword,typescriptEnum,
\ typescriptModule
|