File: coffee.jsf

package info (click to toggle)
joe 4.4-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 6,800 kB
  • ctags: 3,201
  • sloc: ansic: 49,924; sh: 4,279; makefile: 171; csh: 26
file content (531 lines) | stat: -rw-r--r-- 8,386 bytes parent folder | download | duplicates (2)
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
# JOE syntax highlight file for Coffeescript

# node = a.b.c /\s+/ seems to be allowed, foo
# need to recognize ... and ..
# include - as part of number?

# after term: it's a regex if

# suppress literals after .

=Idle
=Comment	green
=Constant	cyan
=Escape		bold cyan
=Operator	bold
=Keyword	bold
=Bad		bold red

:pre_idle Idle
	*		NULL		noeat call=.coffee()

.subr coffee

:idle Idle
	*		idle
	"("		idle		call=.coffee(paren)
	"["		idle		call=.coffee(brack)
	"{"		idle		call=.coffee(squiggly)
.ifdef paren
	")"		idle		return
.else
	")"		stray		recolor=-1
.endif
.ifdef brack
	"]"		idle		return
.else
	"]"		stray		recolor=-1
.endif
.ifdef squiggly
	"}"		idle		return
.else
	"}"		stray		recolor=-1
.endif
	"#"		comment		recolor=-1
	"0"		zero		recolor=-1
	"1-9"		decimal		recolor=-1
	"."		decimal_point	recolor=-1
	"\""		maybe_string	recolor=-1
	"'"		maybe_char	recolor=-1
	"/"		slash		recolor=-1
	"@$\i"		ident		buffer

:stray Bad
	*		idle

:after_term Idle
	*		idle		noeat
	" \t"		after_term_1
	"/"		slash_after_term_0

# "foo/x" is division?
# "foo/ x" is division.

:slash_after_term_0 Idle
	*		idle		noeat

:after_term_1 Idle
	*		idle		noeat
	" \t"		after_term_1
	"/"		slash_after_term_1

# "foo / x"  is division
# "foo /x"   is regex

:slash_after_term_1 Idle
	*		sregex		noeat
	"/"		slashslash
	" =	"	idle		noeat

:comment Comment
	*		line_comment	noeat
	"#"		maybe_block_comment

:maybe_block_comment Comment
	*		line_comment	noeat
	"#"		maybe_block_comment_1

# This is weird... #### is a line comment, but ### is a block comment

:maybe_block_comment_1 Comment
	*		block_comment	noeat
	"#"		line_comment

:line_comment Comment
	*		line_comment
	"\n"		idle

:block_comment Comment
	*		block_comment
	"#"		block_comment_1

:block_comment_1 Comment
	*		block_comment	noeat
	"#"		block_comment_2

:block_comment_2 Comment
	*		block_comment	noeat
	"#"		idle

# Check for regex

:slash Constant
	*		sregex		noeat
	"/"		slashslash

:slashslash Constant
	*		after_term		noeat
	"/"		regex

# Regex like this ///foo///

:regex Constant
	*		regex
	"\\"		regex_escape	recolor=-1
	"#"		regex_maybe_subst
	"/"		regexslash

:regex_maybe_subst Constant
	*		regex	noeat
	"{"		regex		recolor=-2 call=.coffee(squiggly)

:regexslash Constant
	*		regex		noeat
	"/"		regexslashslash

:regexslashslash Constant
	*		regex		noeat
	"/"		after_term

:regex_escape Escape
	*		regex
	"x"		regex_hex2
	"u"		regex_hex4

:regex_uni Escape
	*		regex_uni
	"}"		regex

:regex_hex4 Escape
	*		regex		noeat
	"{"		regex_uni
	"0-9a-fA-F"	regex_hex3

:regex_hex3 Escape
	*		regex		noeat
	"0-9a-fA-F"	regex_hex2

:regex_hex2 Escape
	*		regex		noeat
	"0-9a-fA-F"	regex_hex1

:regex_hex1 Escape
	*		regex		noeat
	"0-9a-fA-F"	regex

# Regex like this: /foo/

:sregex Constant
	*		sregex
	"\\"		sregex_escape	recolor=-1
	"#"		sregex_maybe_subst
	"/"		after_term

:sregex_maybe_subst Constant
	*		sregex	noeat
	"{"		sregex	call=.coffee(squiggly) recolor=-2

:sregex_escape Escape
	*		sregex
	"x"		sregex_hex2
	"u"		sregex_hex4

:sregex_uni Escape
	*		sregex_uni
	"}"		sregex

:sregex_hex4 Escape
	*		sregex		noeat
	"{"		sregex_uni
	"0-9a-fA-F"	sregex_hex3

:sregex_hex3 Escape
	*		sregex		noeat
	"0-9a-fA-F"	sregex_hex2

:sregex_hex2 Escape
	*		sregex		noeat
	"0-9a-fA-F"	sregex_hex1

:sregex_hex1 Escape
	*		sregex		noeat
	"0-9a-fA-F"	sregex

# Numbers

:bad_number Bad
	*		after_term	noeat
	"0-9"		bad_number

:zero Constant
	*		after_term	noeat
	"b"		binary
	"o"		octal
	"x"		hex
	"."		maybe_float
	"eE"		epart
	"0-9"		decimal	recolor=-1

:decimal_point Constant
	*		after_term	noeat	recolor=-2
	"."		decimal_point_1	recolor=-2
	"\i"		not_ident	recolor=-2
	"0-9"		float

:not_ident Idle
	*		after_term	noeat
	"\c"		not_ident

:decimal_point_1 Idle
	*		idle		noeat
	"."		idle

:octal Constant
	*		after_term	noeat
	"0-7_"		octal
	"89"		bad_number	recolor=-1

:binary Constant
	*		after_term	noeat
	"01_"		binary
	"2-9"		bad_number	recolor=-1

:hex Constant
	*		after_term	noeat
	"0-9A-Fa-f_"	hex

:decimal Constant
	*		after_term	noeat
	"0-9_"		decimal
	"eE"		epart
	"."		maybe_float

:maybe_float Constant
	*		after_term	noeat recolor=-2
	"."		decimal_point_1	recolor=-2
	"eE"		epart
	"0-9_"		float

:float Constant
	*		after_term	noeat
	"eE"		epart
	"0-9_"		float

:epart Constant
	*		after_term	noeat
	"0-9+\-"	enum

:enum Constant
	*		after_term	noeat
	"0-9_"		enum

# strings like "hello"

:maybe_string Constant
	*		string		noeat
	"\""		maybe_string_1

:maybe_string_1 Constant
	*		after_term	noeat
	"\""		stringstring

:string	Constant
	*		string
	"\""		after_term
	"#"		string_maybe_subst
	"\\"		string_escape	recolor=-1

:string_maybe_subst Constant
	*		string	noeat
	"{"		string	call=.coffee(squiggly)	recolor=-2

:string_escape Escape
	*		string
	"x"		string_hex2
	"u"		string_hex4

:string_uni Escape
	*		string_uni
	"}"		string

:string_hex4 Escape
	*		string		noeat
	"{"		string_uni
	"0-9a-fA-F"	string_hex3

:string_hex3 Escape
	*		string		noeat
	"0-9a-fA-F"	string_hex2

:string_hex2 Escape
	*		string		noeat
	"0-9a-fA-F"	string_hex1

:string_hex1 Escape
	*		string		noeat
	"0-9a-fA-F"	string

# Strings like """ foo """

:stringstring	Constant
	*		stringstring
	"\""		stringstring_1
	"#"		stringstring_maybe_subst
	"\\"		stringstring_escape	recolor=-1

:stringstring_1	Constant
	*		stringstring	noeat
	"\""		stringstring_2

:stringstring_2 Constant
	*		stringstring	noeat
	"\""		after_term

:stringstring_maybe_subst Constant
	*		stringstring	noeat
	"{"		stringstring	call=.coffee(squiggly)	recolor=-2

:stringstring_escape Escape
	*		stringstring
	"x"		stringstring_hex2
	"u"		stringstring_hex4

:stringstring_uni Escape
	*		stringstring_uni
	"}"		stringstring

:stringstring_hex4 Escape
	*		stringstring		noeat
	"{"		stringstring_uni
	"0-9a-fA-F"	stringstring_hex3

:stringstring_hex3 Escape
	*		stringstring		noeat
	"0-9a-fA-F"	stringstring_hex2

:stringstring_hex2 Escape
	*		stringstring		noeat
	"0-9a-fA-F"	stringstring_hex1

:stringstring_hex1 Escape
	*		stringstring		noeat
	"0-9a-fA-F"	stringstring

# character constants like 'h'

:maybe_char	Constant
	*		char	noeat
	"'"	maybe_char_1

:maybe_char_1	Constant
	*	after_term	noeat
	"'"	charchar

:char	Constant
	*		char
	"'"		after_term
	"\\"		char_escape	recolor=-1

:char_escape Escape
	*		char		noeat
	"x"		char_hex2
	"u"		char_hex4

:char_uni Escape
	*		char_uni
	"}"		char_done

:char_hex4 Escape
	*		char		noeat
	"{"		char_uni
	"0-9a-fA-F"	char_hex3

:char_hex3 Escape
	*		char		noeat
	"0-9a-fA-F"	char_hex2

:char_hex2 Escape
	*		char		noeat
	"0-9a-fA-F"	char_hex1

:char_hex1 Escape
	*		char		noeat
	"0-9a-fA-F"	char

# strings like this '''foo'''

:charchar Constant
	*		charchar
	"'"		charchar_1
	"\\"		charchar_escape	recolor=-1

:charchar_1 Constant
	*		charchar		noeat
	"'"		charchar_2

:charchar_2 Constant
	*		charchar		noeat
	"'"		after_term

:charchar_escape Escape
	*		charchar		noeat
	"x"		charchar_hex2
	"u"		charchar_hex4

:charchar_uni Escape
	*		charchar_uni
	"}"		charchar_done

:charchar_hex4 Escape
	*		charchar		noeat
	"{"		charchar_uni
	"0-9a-fA-F"	charchar_hex3

:charchar_hex3 Escape
	*		charchar		noeat
	"0-9a-fA-F"	charchar_hex2

:charchar_hex2 Escape
	*		charchar		noeat
	"0-9a-fA-F"	charchar_hex1

:charchar_hex1 Escape
	*		charchar		noeat
	"0-9a-fA-F"	charchar


# Identifiers

:ident Idle
	*		after_term	noeat strings
	"and"		operator
	"break"		kw
	"by"		kw
	"catch"		kw
	"class"		kw
	"continue"	kw
	"delete"	kw
	"debugger"	kw
	"do"		kw
	"else"		kw
	"extends"	kw
	"false"		lit
	"finally"	kw
	"for"		kw
	"if"		kw
	"in"		kw
	"instanceof"	kw
	"is"		kw
	"isnt"		kw
	"loop"		kw
	"new"		kw
	"no"		lit
	"not"		operator
	"null"		lit
	"off"		lit
	"of"		kw
	"on"		lit
	"or"		operator
	"return"	kw
	"super"		kw
	"switch"	kw
	"then"		kw
	"this"		lit
	"throw"		kw
	"true"		lit
	"try"		kw
	"typeof"	kw
	"undefined"	lit
	"unless"	kw
	"until"		kw
	"when"		kw
	"while"		kw
	"yes"		lit
	"yield"		kw
	"case"		forbid
	"default"	forbid
	"function"	forbid
	"var"		forbid
	"void"		forbid
	"with"		forbid
	"const"		forbid
	"let"		forbid
	"enum"		forbid
	"export"	forbid
	"import"	forbid
	"native"	forbid
	"implements"	forbid
	"interface"	forbid
	"package"	forbid
	"private"	forbid
	"protected"	forbid
	"public"	forbid
	"static"	forbid
	"arguments"	forbid
	"eval"		forbid
done
	"$\c"	ident

:kw Keyword
	*		idle			noeat

:forbid Keyword
	*		idle			noeat

:lit Constant
	*		after_term		noeat

:operator Operator
	*		idle			noeat

.end