@@ -24,7 +24,8 @@ syntax sync fromstart
24
24
" syntax case ignore
25
25
syntax case match
26
26
27
- syntax match jsNoise / [:,;]/
27
+ syntax match jsNoise / [:;]/
28
+ syntax match jsNoise / ,/ skipwhite skipempty nextgroup =@jsExpression
28
29
syntax match jsDot / \. / skipwhite skipempty nextgroup =jsObjectProp,jsFuncCall,jsPrototype,jsTaggedTemplate
29
30
syntax match jsObjectProp contained / \<\K\k */
30
31
syntax match jsFuncCall / \<\K\k *\z e\s *(/
@@ -33,7 +34,8 @@ syntax match jsParensError /[)}\]]/
33
34
" Program Keywords
34
35
syntax keyword jsStorageClass const var let skipwhite skipempty nextgroup =jsDestructuringBlock,jsDestructuringArray,jsVariableDef
35
36
syntax match jsVariableDef contained / \<\K\k */ skipwhite skipempty nextgroup =jsFlowDefinition
36
- syntax keyword jsOperatorKeyword delete instanceof typeof void new in of skipwhite skipempty nextgroup =@jsExpression
37
+ syntax keyword jsOperatorKeyword delete instanceof typeof void new in skipwhite skipempty nextgroup =@jsExpression
38
+ syntax keyword jsOf of skipwhite skipempty nextgroup =@jsExpression
37
39
syntax match jsOperator " [-!|&+<>=%/*~^]" skipwhite skipempty nextgroup =@jsExpression
38
40
syntax match jsOperator / ::/ skipwhite skipempty nextgroup =@jsExpression
39
41
syntax keyword jsBooleanTrue true
@@ -99,7 +101,8 @@ syntax keyword jsStatement contained break continue skipwhite skipempty next
99
101
syntax keyword jsConditional if skipwhite skipempty nextgroup =jsParenIfElse
100
102
syntax keyword jsConditional else skipwhite skipempty nextgroup =jsCommentIfElse,jsIfElseBlock
101
103
syntax keyword jsConditional switch skipwhite skipempty nextgroup =jsParenSwitch
102
- syntax keyword jsRepeat while for skipwhite skipempty nextgroup =jsParenRepeat,jsForAwait
104
+ syntax keyword jsWhile while skipwhite skipempty nextgroup =jsParenWhile
105
+ syntax keyword jsFor for skipwhite skipempty nextgroup =jsParenFor,jsForAwait
103
106
syntax keyword jsDo do skipwhite skipempty nextgroup =jsRepeatBlock
104
107
syntax region jsSwitchCase contained matchgroup =jsLabel start =/ \<\% (case\| default\)\> / end =/ :\@ =/ contains =@jsExpression,jsLabel skipwhite skipempty nextgroup =jsSwitchColon keepend
105
108
syntax keyword jsTry try skipwhite skipempty nextgroup =jsTryCatchBlock
@@ -135,19 +138,20 @@ syntax keyword jsHtmlEvents onblur onclick oncontextmenu ondblclick onfocus
135
138
" Code blocks
136
139
syntax region jsBracket matchgroup =jsBrackets start =/ \[ / end =/ \] / contains =@jsExpression,jsSpreadExpression extend fold
137
140
syntax region jsParen matchgroup =jsParens start =/ (/ end =/ )/ contains =@jsExpression extend fold nextgroup =jsFlowDefinition
138
- syntax region jsParenDecorator contained matchgroup =jsParensDecorator start =/ (/ end =/ )/ contains =@jsAll extend fold
139
- syntax region jsParenIfElse contained matchgroup =jsParensIfElse start =/ (/ end =/ )/ contains =@jsAll skipwhite skipempty nextgroup =jsCommentIfElse,jsIfElseBlock,jsReturn extend fold
140
- syntax region jsParenRepeat contained matchgroup =jsParensRepeat start =/ (/ end =/ )/ contains =@jsAll skipwhite skipempty nextgroup =jsCommentRepeat,jsRepeatBlock,jsReturn extend fold
141
- syntax region jsParenSwitch contained matchgroup =jsParensSwitch start =/ (/ end =/ )/ contains =@jsAll skipwhite skipempty nextgroup =jsSwitchBlock extend fold
141
+ syntax region jsParenDecorator contained matchgroup =jsParensDecorator start =/ (/ end =/ )/ contains =@jsExpression extend fold
142
+ syntax region jsParenIfElse contained matchgroup =jsParensIfElse start =/ (/ end =/ )/ contains =@jsExpression skipwhite skipempty nextgroup =jsCommentIfElse,jsIfElseBlock,jsReturn extend fold
143
+ syntax region jsParenWhile contained matchgroup =jsParensWhile start =/ (/ end =/ )/ contains =@jsExpression skipwhite skipempty nextgroup =jsCommentRepeat,jsRepeatBlock,jsReturn extend fold
144
+ syntax region jsParenFor contained matchgroup =jsParensFor start =/ (/ end =/ )/ contains =@jsExpression,jsStorageClass,jsOf skipwhite skipempty nextgroup =jsCommentRepeat,jsRepeatBlock,jsReturn extend fold
145
+ syntax region jsParenSwitch contained matchgroup =jsParensSwitch start =/ (/ end =/ )/ contains =@jsExpression skipwhite skipempty nextgroup =jsSwitchBlock extend fold
142
146
syntax region jsParenCatch contained matchgroup =jsParensCatch start =/ (/ end =/ )/ skipwhite skipempty nextgroup =jsTryCatchBlock extend fold
143
147
syntax region jsFuncArgs contained matchgroup =jsFuncParens start =/ (/ end =/ )/ contains =jsFuncArgCommas,jsComment,jsFuncArgExpression,jsDestructuringBlock,jsDestructuringArray,jsRestExpression,jsFlowArgumentDef skipwhite skipempty nextgroup =jsCommentFunction,jsFuncBlock,jsFlowReturn extend fold
144
148
syntax region jsClassBlock contained matchgroup =jsClassBraces start =/ {/ end =/ }/ contains =jsClassFuncName,jsClassMethodType,jsArrowFunction,jsArrowFuncArgs,jsComment,jsGenerator,jsDecorator,jsClassProperty,jsClassPropertyComputed,jsClassStringKey,jsAsyncKeyword,jsNoise extend fold
145
- syntax region jsFuncBlock contained matchgroup =jsFuncBraces start =/ {/ end =/ }/ contains =@jsAll,jsBlock extend fold
146
- syntax region jsIfElseBlock contained matchgroup =jsIfElseBraces start =/ {/ end =/ }/ contains =@jsAll,jsBlock extend fold
147
- syntax region jsTryCatchBlock contained matchgroup =jsTryCatchBraces start =/ {/ end =/ }/ contains =@jsAll,jsBlock skipwhite skipempty nextgroup =jsCatch,jsFinally extend fold
148
- syntax region jsFinallyBlock contained matchgroup =jsFinallyBraces start =/ {/ end =/ }/ contains =@jsAll,jsBlock extend fold
149
- syntax region jsSwitchBlock contained matchgroup =jsSwitchBraces start =/ {/ end =/ }/ contains =@jsAll,jsBlock, jsSwitchCase extend fold
150
- syntax region jsRepeatBlock contained matchgroup =jsRepeatBraces start =/ {/ end =/ }/ contains =@jsAll,jsBlock extend fold
149
+ syntax region jsFuncBlock contained matchgroup =jsFuncBraces start =/ {/ end =/ }/ contains =@jsAll extend fold
150
+ syntax region jsIfElseBlock contained matchgroup =jsIfElseBraces start =/ {/ end =/ }/ contains =@jsAll extend fold
151
+ syntax region jsTryCatchBlock contained matchgroup =jsTryCatchBraces start =/ {/ end =/ }/ contains =@jsAll skipwhite skipempty nextgroup =jsCatch,jsFinally extend fold
152
+ syntax region jsFinallyBlock contained matchgroup =jsFinallyBraces start =/ {/ end =/ }/ contains =@jsAll extend fold
153
+ syntax region jsSwitchBlock contained matchgroup =jsSwitchBraces start =/ {/ end =/ }/ contains =@jsAll,jsSwitchCase extend fold
154
+ syntax region jsRepeatBlock contained matchgroup =jsRepeatBraces start =/ {/ end =/ }/ contains =@jsAll extend fold
151
155
syntax region jsDestructuringBlock contained matchgroup =jsDestructuringBraces start =/ {/ end =/ }/ contains =jsDestructuringProperty,jsDestructuringAssignment,jsDestructuringNoise,jsDestructuringPropertyComputed,jsSpreadExpression,jsComment nextgroup =jsFlowDefinition extend fold
152
156
syntax region jsDestructuringArray contained matchgroup =jsDestructuringBraces start =/ \[ / end =/ \] / contains =jsDestructuringPropertyValue,jsDestructuringNoise,jsDestructuringProperty,jsSpreadExpression,jsDestructuringBlock,jsDestructuringArray,jsComment nextgroup =jsFlowDefinition extend fold
153
157
syntax region jsObject contained matchgroup =jsObjectBraces start =/ {/ end =/ }/ contains =jsObjectKey,jsObjectKeyString,jsObjectKeyComputed,jsObjectShorthandProp,jsObjectSeparator,jsObjectFuncName,jsObjectMethodType,jsGenerator,jsComment,jsObjectStringKey,jsSpreadExpression,jsDecorator,jsAsyncKeyword,jsTemplateString extend fold
@@ -165,7 +169,7 @@ syntax match jsFuncName contained /\<\K\k*/ skipwhite skipempty ne
165
169
syntax region jsFuncArgExpression contained matchgroup =jsFuncArgOperator start =/ =/ end =/ [,)]\@ =/ contains =@jsExpression extend
166
170
syntax match jsFuncArgCommas contained ' ,'
167
171
syntax keyword jsArguments contained arguments
168
- syntax keyword jsForAwait contained await skipwhite skipempty nextgroup =jsParenRepeat
172
+ syntax keyword jsForAwait contained await skipwhite skipempty nextgroup =jsParenFor
169
173
170
174
" Matches a single keyword argument with no parens
171
175
syntax match jsArrowFuncArgs / \<\K\k *\z e\s *=>/ skipwhite contains =jsFuncArgs skipwhite skipempty nextgroup =jsArrowFunction extend
@@ -233,7 +237,7 @@ if exists("javascript_plugin_flow")
233
237
endif
234
238
235
239
syntax cluster jsExpression contains =jsBracket,jsParen,jsObject,jsTernaryIf,jsTaggedTemplate,jsTemplateString,jsString,jsRegexpString,jsNumber,jsFloat,jsOperator,jsOperatorKeyword,jsBooleanTrue,jsBooleanFalse,jsNull,jsFunction,jsArrowFunction,jsGlobalObjects,jsExceptions,jsFutureKeys,jsDomErrNo,jsDomNodeConsts,jsHtmlEvents,jsFuncCall,jsUndefined,jsNan,jsPrototype,jsBuiltins,jsNoise,jsClassDefinition,jsArrowFunction,jsArrowFuncArgs,jsParensError,jsComment,jsArguments,jsThis,jsSuper,jsDo,jsForAwait,jsAsyncKeyword,jsStatement,jsDot
236
- syntax cluster jsAll contains =@jsExpression,jsStorageClass,jsConditional,jsRepeat, jsReturn,jsException,jsTry,jsNoise,jsBlockLabel
240
+ syntax cluster jsAll contains =@jsExpression,jsStorageClass,jsConditional,jsWhile,jsFor, jsReturn,jsException,jsTry,jsNoise,jsBlockLabel,jsBlock
237
241
238
242
" Define the default highlighting.
239
243
" For version 5.7 and earlier: only when not done already
@@ -248,6 +252,8 @@ if version >= 508 || !exists("did_javascript_syn_inits")
248
252
HiLink jsComment Comment
249
253
HiLink jsEnvComment PreProc
250
254
HiLink jsParensIfElse jsParens
255
+ HiLink jsParensWhile jsParensRepeat
256
+ HiLink jsParensFor jsParensRepeat
251
257
HiLink jsParensRepeat jsParens
252
258
HiLink jsParensSwitch jsParens
253
259
HiLink jsParensCatch jsParens
@@ -273,6 +279,8 @@ if version >= 508 || !exists("did_javascript_syn_inits")
273
279
HiLink jsBranch Conditional
274
280
HiLink jsLabel Label
275
281
HiLink jsReturn Statement
282
+ HiLink jsWhile jsRepeat
283
+ HiLink jsFor jsRepeat
276
284
HiLink jsRepeat Repeat
277
285
HiLink jsDo Repeat
278
286
HiLink jsStatement Statement
0 commit comments