coffee.jsf (9854B)
1 # JOE syntax highlight file for Coffeescript 2 3 # node = a.b.c /\s+/ seems to be allowed, foo 4 # need to recognize ... and .. 5 # include - as part of number? 6 7 # after term: it's a regex if 8 9 # suppress literals after . 10 11 =Idle 12 =Comment 13 =Constant 14 =Number +Constant 15 =Boolean +Constant 16 =String +Constant 17 =Regex +String 18 =Escape 19 =StringEscape +Escape 20 =StringVariable +StringEscape 21 =RegexEscape +StringEscape 22 =RegexVariable +RegexEscape 23 =Keyword 24 =Structure +Keyword 25 =Operator +Keyword 26 =Statement +Keyword 27 =Loop +Statement 28 =Conditional +Statement 29 =Label +DefinedIdent 30 =Ident 31 =Bad 32 33 :pre_idle Idle 34 * NULL noeat call=.coffee() 35 36 .subr coffee 37 38 :idle Idle 39 * idle 40 "(" idle call=.coffee(paren) 41 "[" idle call=.coffee(brack) 42 "{" idle call=.coffee(squiggly) 43 .ifdef paren 44 ")" idle return 45 .else 46 ")" stray recolor=-1 47 .endif 48 .ifdef brack 49 "]" idle return 50 .else 51 "]" stray recolor=-1 52 .endif 53 .ifdef squiggly_str 54 "}" string_end_subst noeat 55 .else 56 .ifdef squiggly_regex 57 "}" regex_end_subst noeat 58 .else 59 .ifdef squiggly 60 "}" idle return 61 .else 62 "}" stray recolor=-1 63 .endif 64 .endif 65 .endif 66 67 "#" comment recolor=-1 68 "0" zero recolor=-1 69 "1-9" decimal recolor=-1 70 "." decimal_point recolor=-1 71 "\"" maybe_string recolor=-1 72 "'" maybe_char recolor=-1 73 "/" slash recolor=-1 74 "@$\i" ident buffer 75 76 :stray Bad 77 * idle 78 79 :after_term Idle 80 * idle noeat 81 " \t" after_term_1 82 "/" slash_after_term_0 83 84 # "foo/x" is division? 85 # "foo/ x" is division. 86 87 :slash_after_term_0 Idle 88 * idle noeat 89 90 :after_term_1 Idle 91 * idle noeat 92 " \t" after_term_1 93 "/" slash_after_term_1 94 95 # "foo / x" is division 96 # "foo /x" is regex 97 98 :slash_after_term_1 Idle 99 * sregex noeat recolor=-2 100 "/" slashslash 101 " = " idle noeat 102 103 :comment Comment comment 104 * line_comment noeat 105 "#" maybe_block_comment 106 107 :maybe_block_comment Comment comment 108 * line_comment noeat 109 "#" maybe_block_comment_1 110 111 # This is weird... #### is a line comment, but ### is a block comment 112 113 :maybe_block_comment_1 Comment comment 114 * block_comment noeat 115 "#" line_comment 116 117 :line_comment Comment comment 118 * line_comment 119 "BFHNTX" line_comment noeat call=comment_todo.comment_todo() 120 "\n" idle 121 122 :block_comment Comment comment 123 * block_comment 124 "BFHNTX" block_comment noeat call=comment_todo.comment_todo() 125 "#" block_comment_1 126 127 :block_comment_1 Comment comment 128 * block_comment noeat 129 "#" block_comment_2 130 131 :block_comment_2 Comment comment 132 * block_comment noeat 133 "#" idle 134 135 # Check for regex 136 137 :slash Constant 138 * sregex noeat recolor=-2 139 "/" slashslash 140 141 :slashslash Constant 142 * after_term noeat 143 "/" regex recolor=-3 144 145 # Regex like this ///foo/// 146 147 :regex Regex 148 * regex 149 "\\" regex_escape recolor=-1 150 "#" regex_maybe_subst recolor=-1 151 "/" regexslash 152 153 :regex_maybe_subst RegexVariable 154 * regex noeat recolor=-1 155 "{" regex call=.coffee(squiggly_regex) 156 157 :regex_end_subst RegexVariable 158 * idle return 159 160 :regexslash Regex 161 * regex noeat 162 "/" regexslashslash 163 164 :regexslashslash Regex 165 * regex noeat 166 "/" after_term 167 168 :regex_escape RegexEscape 169 * regex 170 "x" regex_hex2 171 "u" regex_hex4 172 173 :regex_uni RegexEscape 174 * regex_uni 175 "}" regex 176 177 :regex_hex4 RegexEscape 178 * regex noeat 179 "{" regex_uni 180 "0-9a-fA-F" regex_hex3 181 182 :regex_hex3 RegexEscape 183 * regex noeat 184 "0-9a-fA-F" regex_hex2 185 186 :regex_hex2 RegexEscape 187 * regex noeat 188 "0-9a-fA-F" regex_hex1 189 190 :regex_hex1 RegexEscape 191 * regex noeat 192 "0-9a-fA-F" regex 193 194 # Regex like this: /foo/ 195 196 :sregex Regex 197 * sregex 198 "\\" sregex_escape recolor=-1 199 "#" sregex_maybe_subst recolor=-1 200 "/" after_term 201 202 :sregex_maybe_subst RegexVariable 203 * sregex noeat recolor=-1 204 "{" sregex call=.coffee(squiggly_regex) 205 206 :sregex_escape RegexEscape 207 * sregex 208 "x" sregex_hex2 209 "u" sregex_hex4 210 211 :sregex_uni RegexEscape 212 * sregex_uni 213 "}" sregex 214 215 :sregex_hex4 RegexEscape 216 * sregex noeat 217 "{" sregex_uni 218 "0-9a-fA-F" sregex_hex3 219 220 :sregex_hex3 RegexEscape 221 * sregex noeat 222 "0-9a-fA-F" sregex_hex2 223 224 :sregex_hex2 RegexEscape 225 * sregex noeat 226 "0-9a-fA-F" sregex_hex1 227 228 :sregex_hex1 RegexEscape 229 * sregex noeat 230 "0-9a-fA-F" sregex 231 232 # Numbers 233 234 :bad_number Bad 235 * after_term noeat 236 "0-9" bad_number 237 238 :zero Number 239 * after_term noeat 240 "b" binary 241 "o" octal 242 "x" hex 243 "." maybe_float 244 "eE" epart 245 "0-9" decimal recolor=-1 246 247 :decimal_point Number 248 * after_term noeat recolor=-2 249 "." decimal_point_1 recolor=-2 250 "\i" not_ident recolor=-2 251 "0-9" float 252 253 :not_ident Idle 254 * after_term noeat 255 "\c" not_ident 256 257 :decimal_point_1 Number 258 * idle noeat 259 "." idle 260 261 :octal Number 262 * after_term noeat 263 "0-7_" octal 264 "89" bad_number recolor=-1 265 266 :binary Number 267 * after_term noeat 268 "01_" binary 269 "2-9" bad_number recolor=-1 270 271 :hex Number 272 * after_term noeat 273 "0-9A-Fa-f_" hex 274 275 :decimal Number 276 * after_term noeat 277 "0-9_" decimal 278 "eE" epart 279 "." maybe_float 280 281 :maybe_float Number 282 * after_term noeat recolor=-2 283 "." decimal_point_1 recolor=-2 284 "eE" epart 285 "0-9_" float 286 287 :float Number 288 * after_term noeat 289 "eE" epart 290 "0-9_" float 291 292 :epart Number 293 * after_term noeat 294 "0-9+\-" enum 295 296 :enum Number 297 * after_term noeat 298 "0-9_" enum 299 300 # strings like "hello" 301 302 :maybe_string String string 303 * string noeat 304 "\"" maybe_string_1 305 306 :maybe_string_1 String string 307 * after_term noeat 308 "\"" stringstring 309 310 :string String string 311 * string 312 "\"" after_term 313 "#" string_maybe_subst recolor=-1 314 "\\" string_escape recolor=-1 315 316 :string_maybe_subst StringVariable string 317 * string noeat recolor=-1 318 "{" string call=.coffee(squiggly_str) 319 320 :string_end_subst StringVariable string 321 * idle return 322 323 :string_escape StringEscape string 324 * string 325 "x" string_hex2 326 "u" string_hex4 327 328 :string_uni StringEscape string 329 * string_uni 330 "}" string 331 332 :string_hex4 StringEscape string 333 * string noeat 334 "{" string_uni 335 "0-9a-fA-F" string_hex3 336 337 :string_hex3 StringEscape string 338 * string noeat 339 "0-9a-fA-F" string_hex2 340 341 :string_hex2 StringEscape string 342 * string noeat 343 "0-9a-fA-F" string_hex1 344 345 :string_hex1 StringEscape string 346 * string noeat 347 "0-9a-fA-F" string 348 349 # Strings like """ foo """ 350 351 :stringstring String string 352 * stringstring 353 "\"" stringstring_1 354 "#" stringstring_maybe_subst recolor=-1 355 "\\" stringstring_escape recolor=-1 356 357 :stringstring_1 String string 358 * stringstring noeat 359 "\"" stringstring_2 360 361 :stringstring_2 String string 362 * stringstring noeat 363 "\"" after_term 364 365 :stringstring_maybe_subst StringVariable string 366 * stringstring noeat recolor=-1 367 "{" stringstring call=.coffee(squiggly_str) 368 369 :stringstring_escape StringEscape string 370 * stringstring 371 "x" stringstring_hex2 372 "u" stringstring_hex4 373 374 :stringstring_uni StringEscape string 375 * stringstring_uni 376 "}" stringstring 377 378 :stringstring_hex4 StringEscape string 379 * stringstring noeat 380 "{" stringstring_uni 381 "0-9a-fA-F" stringstring_hex3 382 383 :stringstring_hex3 StringEscape string 384 * stringstring noeat 385 "0-9a-fA-F" stringstring_hex2 386 387 :stringstring_hex2 StringEscape string 388 * stringstring noeat 389 "0-9a-fA-F" stringstring_hex1 390 391 :stringstring_hex1 StringEscape string 392 * stringstring noeat 393 "0-9a-fA-F" stringstring 394 395 # string constants like 'h' 396 397 :maybe_char String string 398 * char noeat 399 "'" maybe_char_1 400 401 :maybe_char_1 String string 402 * after_term noeat 403 "'" charchar 404 405 :char String string 406 * char 407 "'" after_term 408 "\\" char_escape recolor=-1 409 410 :char_escape StringEscape string 411 * char noeat 412 "x" char_hex2 413 "u" char_hex4 414 415 :char_uni StringEscape string 416 * char_uni 417 "}" char_done 418 419 :char_hex4 StringEscape string 420 * char noeat 421 "{" char_uni 422 "0-9a-fA-F" char_hex3 423 424 :char_hex3 StringEscape string 425 * char noeat 426 "0-9a-fA-F" char_hex2 427 428 :char_hex2 StringEscape string 429 * char noeat 430 "0-9a-fA-F" char_hex1 431 432 :char_hex1 StringEscape string 433 * char noeat 434 "0-9a-fA-F" char 435 436 # strings like this '''foo''' 437 438 :charchar String string 439 * charchar 440 "'" charchar_1 441 "\\" charchar_escape recolor=-1 442 443 :charchar_1 String string 444 * charchar noeat 445 "'" charchar_2 446 447 :charchar_2 String string 448 * charchar noeat 449 "'" after_term 450 451 :charchar_escape StringEscape string 452 * charchar noeat 453 "x" charchar_hex2 454 "u" charchar_hex4 455 456 :charchar_uni StringEscape string 457 * charchar_uni 458 "}" charchar_done 459 460 :charchar_hex4 StringEscape string 461 * charchar noeat 462 "{" charchar_uni 463 "0-9a-fA-F" charchar_hex3 464 465 :charchar_hex3 StringEscape string 466 * charchar noeat 467 "0-9a-fA-F" charchar_hex2 468 469 :charchar_hex2 StringEscape string 470 * charchar noeat 471 "0-9a-fA-F" charchar_hex1 472 473 :charchar_hex1 StringEscape string 474 * charchar noeat 475 "0-9a-fA-F" charchar 476 477 478 # Identifiers 479 480 :ident Ident 481 * after_term noeat strings 482 "and" operator 483 "break" loop 484 "by" kw 485 "catch" kw 486 "class" struct 487 "continue" loop 488 "delete" kw 489 "debugger" stmt 490 "do" loop 491 "else" cond 492 "extends" kw 493 "false" bool 494 "finally" kw 495 "for" loop 496 "if" cond 497 "in" operator 498 "instanceof" kw 499 "is" operator 500 "isnt" operator 501 "loop" loop 502 "new" kw 503 "no" bool 504 "not" operator 505 "null" lit 506 "off" bool 507 "of" operator 508 "on" bool 509 "or" operator 510 "return" stmt 511 "super" kw 512 "switch" cond 513 "then" kw 514 "this" lit 515 "throw" stmt 516 "true" bool 517 "try" kw 518 "typeof" kw 519 "undefined" lit 520 "unless" cond 521 "until" loop 522 "when" kw 523 "while" loop 524 "yes" lit 525 "yield" stmt 526 "case" label 527 "default" label 528 "function" forbid 529 "var" forbid 530 "void" forbid 531 "with" forbid 532 "const" forbid 533 "let" forbid 534 "enum" forbid 535 "export" forbid 536 "import" forbid 537 "native" forbid 538 "implements" forbid 539 "interface" forbid 540 "package" forbid 541 "private" forbid 542 "protected" forbid 543 "public" forbid 544 "static" forbid 545 "arguments" forbid 546 "eval" forbid 547 done 548 "$\c" ident 549 550 :kw Keyword 551 * idle noeat 552 553 :forbid Keyword 554 * idle noeat 555 556 :lit Constant 557 * after_term noeat 558 559 :bool Boolean 560 * after_term noeat 561 562 :stmt Statement 563 * idle noeat 564 565 :loop Loop 566 * idle noeat 567 568 :cond Conditional 569 * idle noeat 570 571 :struct Structure 572 * idle noeat 573 574 :operator Operator 575 * idle noeat 576 577 :label Label 578 * idle noeat 579 580 .end