@@ -32,18 +32,24 @@ hi def link coffeeConditional Conditional
32
32
syn match coffeeException / \<\% (try\| catch\| finally\)\> / display
33
33
hi def link coffeeException Exception
34
34
35
- syn match coffeeKeyword / \<\% (new\| in\| of\| by\| and\| or\| not\| is\| isnt\| class\| extends\| super\| do\| yield\| debugger\| import\| export\| await\)\> /
35
+ syn match coffeeKeyword / \<\% (new\| in\| of\| by\| and\| or\| not\| is\| isnt\| class\| extends\| super\| do\| yield\| debugger\| import\| export\| default \| await\)\> /
36
36
\ display
37
37
" The `own` keyword is only a keyword after `for`.
38
38
syn match coffeeKeyword / \< for\s\+ own\> / contained containedin =coffeeRepeat
39
39
\ display
40
40
hi def link coffeeKeyword Keyword
41
41
42
- syn match coffeeOperator / \<\% (instanceof\| typeof\| delete\)\> / display
42
+
43
+ " syn match coffeeFunction /\s\?[-=]>/
44
+ syn match coffeeFunction / @\?\I .*\w\+\z e\s *=\s *.*[-=]>/ contains =@coffeeIdentifier display
45
+ hi def link coffeefunction Identifier
46
+
47
+ syn keyword coffeeOperator instanceof typeof delete length
48
+ \ display
43
49
hi def link coffeeOperator Operator
44
50
45
51
" The first case matches symbol operators only if they have an operand before.
46
- syn match coffeeExtendedOp / \% (\S\s *\)\@ <=[+\- */%&|\^ =!<>?.]\{ -1,}\| [-=]> \| --\| ++\| :/
52
+ syn match coffeeExtendedOp / \% (\S\s *\)\@ <=[+\- */%&|\^ =!<>?.,; ]\{ -1,}\| --\| ++\| :/
47
53
\ display
48
54
syn match coffeeExtendedOp / \<\% (and\| or\) =/ display
49
55
hi def link coffeeExtendedOp coffeeOperator
@@ -107,7 +113,7 @@ hi def link coffeeFloat Float
107
113
108
114
" An error for reserved keywords, taken from the RESERVED array:
109
115
" http://coffeescript.org/documentation/docs/lexer.html#section-67
110
- syn match coffeeReservedError / \<\% (case\| default \| function\| var\| void\| with\| const\| let\| enum\| native\| implements\| interface\| package\| private\| protected\| public\| static\)\> /
116
+ syn match coffeeReservedError / \<\% (case\| function\| var\| void\| with\| const\| let\| enum\| native\| implements\| interface\| package\| private\| protected\| public\| static\)\> /
111
117
\ display
112
118
hi def link coffeeReservedError Error
113
119
@@ -188,18 +194,22 @@ syn match coffeeProtoAccess /::\s*\%(\I\|\$\)\%(\i\|\$\)*/he=s+2 contains=@coffe
188
194
hi def link coffeeProtoAccess coffeeExtendedOp
189
195
190
196
" This is required for interpolations to work.
191
- syn region coffeeCurlies matchgroup =coffeeCurly start =/ {/ end =/ }/
197
+ syn region coffeeCurlies matchgroup =coffeeBraces start =/ {/ end =/ }/
192
198
\ contains= @c offeeAll
193
199
syn region coffeeBrackets matchgroup =coffeeBracket start =/ \[ / end =/ \] /
194
200
\ contains= @c offeeAll
195
- syn region coffeeParens matchgroup =coffeeParen start =/ (/ end =/ )/
201
+ syn region coffeeParens matchgroup =coffeeBlockParen start =/ (/ end =/ )/
196
202
\ contains= @c offeeAll
197
203
198
204
" These are highlighted the same as commas since they tend to go together.
199
- hi def link coffeeBlock coffeeSpecialOp
200
- hi def link coffeeBracket coffeeBlock
201
- hi def link coffeeCurly coffeeBlock
202
- hi def link coffeeParen coffeeBlock
205
+ hi ! def link coffeeParens Special
206
+ hi ! def link coffeeBlockParen Operator
207
+
208
+ hi ! def link coffeeCurlies Special
209
+ hi ! def link coffeeBraces Function
210
+
211
+ hi ! def link coffeeBrackets NONE
212
+ hi ! def link coffeeBracket Function
203
213
204
214
" This is used instead of TOP to keep things coffee-specific for good
205
215
" embedding. `contained` groups aren't included.
@@ -214,7 +224,7 @@ syn cluster coffeeAll contains=coffeeStatement,coffeeRepeat,coffeeConditional,
214
224
\ coffeeHeredoc,coffeeSpaceError,
215
225
\ coffeeSemicolonError,coffeeDotAccess,
216
226
\ coffeeProtoAccess,coffeeCurlies,coffeeBrackets,
217
- \ coffeeParens
227
+ \ coffeeParens,coffeeFunction
218
228
219
229
if ! exists (' b:current_syntax' )
220
230
let b: current_syntax = ' coffee'
0 commit comments