annotate vendor/vim-syntax/coffee.vim @ 655:82f5e43259eb

Add helper for easier doas
author nanaya <me@nanaya.pro>
date Mon, 31 May 2021 14:56:58 +0900
parents b305f2ce5f88
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
410
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
1 " Language: CoffeeScript
537
351bd965bc1f Update some syntax files.
edogawaconan <me@myconan.net>
parents: 508
diff changeset
2 " Maintainer: Mick Koch <mick@kochm.co>
410
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
3 " URL: http://github.com/kchmck/vim-coffee-script
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
4 " License: WTFPL
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
5
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
6 " Bail if our syntax is already loaded.
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
7 if exists('b:current_syntax') && b:current_syntax == 'coffee'
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
8 finish
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
9 endif
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
10
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
11 " Include JavaScript for coffeeEmbed.
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
12 syn include @coffeeJS syntax/javascript.vim
508
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents: 410
diff changeset
13 silent! unlet b:current_syntax
410
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
14
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
15 " Highlight long strings.
508
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents: 410
diff changeset
16 syntax sync fromstart
410
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
17
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
18 " These are `matches` instead of `keywords` because vim's highlighting
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
19 " priority for keywords is higher than matches. This causes keywords to be
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
20 " highlighted inside matches, even if a match says it shouldn't contain them --
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
21 " like with coffeeAssign and coffeeDot.
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
22 syn match coffeeStatement /\<\%(return\|break\|continue\|throw\)\>/ display
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
23 hi def link coffeeStatement Statement
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
24
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
25 syn match coffeeRepeat /\<\%(for\|while\|until\|loop\)\>/ display
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
26 hi def link coffeeRepeat Repeat
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
27
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
28 syn match coffeeConditional /\<\%(if\|else\|unless\|switch\|when\|then\)\>/
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
29 \ display
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
30 hi def link coffeeConditional Conditional
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
31
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
32 syn match coffeeException /\<\%(try\|catch\|finally\)\>/ display
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
33 hi def link coffeeException Exception
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
34
612
b305f2ce5f88 Update vendored files
nanaya <me@nanaya.pro>
parents: 595
diff changeset
35 syn match coffeeKeyword /\<\%(new\|in\|of\|from\|by\|and\|or\|not\|is\|isnt\|class\|extends\|super\|do\|yield\|debugger\|import\|export\|default\|await\)\>/
410
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
36 \ display
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
37 " The `own` keyword is only a keyword after `for`.
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
38 syn match coffeeKeyword /\<for\s\+own\>/ contained containedin=coffeeRepeat
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
39 \ display
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
40 hi def link coffeeKeyword Keyword
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
41
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
42 syn match coffeeOperator /\<\%(instanceof\|typeof\|delete\)\>/ display
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
43 hi def link coffeeOperator Operator
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
44
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
45 " The first case matches symbol operators only if they have an operand before.
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
46 syn match coffeeExtendedOp /\%(\S\s*\)\@<=[+\-*/%&|\^=!<>?.]\{-1,}\|[-=]>\|--\|++\|:/
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
47 \ display
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
48 syn match coffeeExtendedOp /\<\%(and\|or\)=/ display
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
49 hi def link coffeeExtendedOp coffeeOperator
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
50
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
51 " This is separate from `coffeeExtendedOp` to help differentiate commas from
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
52 " dots.
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
53 syn match coffeeSpecialOp /[,;]/ display
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
54 hi def link coffeeSpecialOp SpecialChar
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
55
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
56 syn match coffeeBoolean /\<\%(true\|on\|yes\|false\|off\|no\)\>/ display
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
57 hi def link coffeeBoolean Boolean
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
58
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
59 syn match coffeeGlobal /\<\%(null\|undefined\)\>/ display
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
60 hi def link coffeeGlobal Type
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
61
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
62 " A special variable
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
63 syn match coffeeSpecialVar /\<\%(this\|prototype\|arguments\)\>/ display
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
64 hi def link coffeeSpecialVar Special
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
65
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
66 " An @-variable
508
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents: 410
diff changeset
67 syn match coffeeSpecialIdent /@\%(\%(\I\|\$\)\%(\i\|\$\)*\)\?/ display
410
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
68 hi def link coffeeSpecialIdent Identifier
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
69
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
70 " A class-like name that starts with a capital letter
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
71 syn match coffeeObject /\<\u\w*\>/ display
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
72 hi def link coffeeObject Structure
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
73
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
74 " A constant-like name in SCREAMING_CAPS
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
75 syn match coffeeConstant /\<\u[A-Z0-9_]\+\>/ display
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
76 hi def link coffeeConstant Constant
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
77
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
78 " A variable name
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
79 syn cluster coffeeIdentifier contains=coffeeSpecialVar,coffeeSpecialIdent,
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
80 \ coffeeObject,coffeeConstant
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
81
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
82 " A non-interpolated string
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
83 syn cluster coffeeBasicString contains=@Spell,coffeeEscape
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
84 " An interpolated string
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
85 syn cluster coffeeInterpString contains=@coffeeBasicString,coffeeInterp
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
86
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
87 " Regular strings
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
88 syn region coffeeString start=/"/ skip=/\\\\\|\\"/ end=/"/
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
89 \ contains=@coffeeInterpString
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
90 syn region coffeeString start=/'/ skip=/\\\\\|\\'/ end=/'/
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
91 \ contains=@coffeeBasicString
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
92 hi def link coffeeString String
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
93
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
94 " A integer, including a leading plus or minus
562
6f57f959cc0b Update vim syntaxes.
nanaya <me@myconan.net>
parents: 537
diff changeset
95 syn match coffeeNumber /\%(\i\|\$\)\@<![-+]\?\d\+\%(e[+-]\?\d\+\)\?/ display
410
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
96 " A hex, binary, or octal number
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
97 syn match coffeeNumber /\<0[xX]\x\+\>/ display
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
98 syn match coffeeNumber /\<0[bB][01]\+\>/ display
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
99 syn match coffeeNumber /\<0[oO][0-7]\+\>/ display
508
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents: 410
diff changeset
100 syn match coffeeNumber /\<\%(Infinity\|NaN\)\>/ display
410
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
101 hi def link coffeeNumber Number
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
102
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
103 " A floating-point number, including a leading plus or minus
508
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents: 410
diff changeset
104 syn match coffeeFloat /\%(\i\|\$\)\@<![-+]\?\d*\.\@<!\.\d\+\%([eE][+-]\?\d\+\)\?/
410
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
105 \ display
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
106 hi def link coffeeFloat Float
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
107
508
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents: 410
diff changeset
108 " An error for reserved keywords, taken from the RESERVED array:
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents: 410
diff changeset
109 " http://coffeescript.org/documentation/docs/lexer.html#section-67
612
b305f2ce5f88 Update vendored files
nanaya <me@nanaya.pro>
parents: 595
diff changeset
110 syn match coffeeReservedError /\<\%(case\|function\|var\|void\|with\|const\|let\|enum\|native\|implements\|interface\|package\|private\|protected\|public\|static\)\>/
508
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents: 410
diff changeset
111 \ display
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents: 410
diff changeset
112 hi def link coffeeReservedError Error
410
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
113
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
114 " A normal object assignment
508
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents: 410
diff changeset
115 syn match coffeeObjAssign /@\?\%(\I\|\$\)\%(\i\|\$\)*\s*\ze::\@!/ contains=@coffeeIdentifier display
410
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
116 hi def link coffeeObjAssign Identifier
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
117
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
118 syn keyword coffeeTodo TODO FIXME XXX contained
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
119 hi def link coffeeTodo Todo
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
120
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
121 syn match coffeeComment /#.*/ contains=@Spell,coffeeTodo
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
122 hi def link coffeeComment Comment
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
123
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
124 syn region coffeeBlockComment start=/####\@!/ end=/###/
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
125 \ contains=@Spell,coffeeTodo
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
126 hi def link coffeeBlockComment coffeeComment
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
127
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
128 " A comment in a heregex
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
129 syn region coffeeHeregexComment start=/#/ end=/\ze\/\/\/\|$/ contained
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
130 \ contains=@Spell,coffeeTodo
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
131 hi def link coffeeHeregexComment coffeeComment
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
132
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
133 " Embedded JavaScript
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
134 syn region coffeeEmbed matchgroup=coffeeEmbedDelim
508
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents: 410
diff changeset
135 \ start=/`/ skip=/\\\\\|\\`/ end=/`/ keepend
410
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
136 \ contains=@coffeeJS
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
137 hi def link coffeeEmbedDelim Delimiter
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
138
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
139 syn region coffeeInterp matchgroup=coffeeInterpDelim start=/#{/ end=/}/ contained
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
140 \ contains=@coffeeAll
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
141 hi def link coffeeInterpDelim PreProc
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
142
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
143 " A string escape sequence
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
144 syn match coffeeEscape /\\\d\d\d\|\\x\x\{2\}\|\\u\x\{4\}\|\\./ contained display
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
145 hi def link coffeeEscape SpecialChar
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
146
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
147 " A regex -- must not follow a parenthesis, number, or identifier, and must not
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
148 " be followed by a number
508
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents: 410
diff changeset
149 syn region coffeeRegex start=#\%(\%()\|\%(\i\|\$\)\@<!\d\)\s*\|\i\)\@<!/=\@!\s\@!#
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents: 410
diff changeset
150 \ end=#/[gimy]\{,4}\d\@!#
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents: 410
diff changeset
151 \ oneline contains=@coffeeBasicString,coffeeRegexCharSet
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents: 410
diff changeset
152 syn region coffeeRegexCharSet start=/\[/ end=/]/ contained
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents: 410
diff changeset
153 \ contains=@coffeeBasicString
410
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
154 hi def link coffeeRegex String
508
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents: 410
diff changeset
155 hi def link coffeeRegexCharSet coffeeRegex
410
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
156
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
157 " A heregex
508
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents: 410
diff changeset
158 syn region coffeeHeregex start=#///# end=#///[gimy]\{,4}#
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents: 410
diff changeset
159 \ contains=@coffeeInterpString,coffeeHeregexComment,
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents: 410
diff changeset
160 \ coffeeHeregexCharSet
410
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
161 \ fold
508
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents: 410
diff changeset
162 syn region coffeeHeregexCharSet start=/\[/ end=/]/ contained
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents: 410
diff changeset
163 \ contains=@coffeeInterpString
410
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
164 hi def link coffeeHeregex coffeeRegex
508
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents: 410
diff changeset
165 hi def link coffeeHeregexCharSet coffeeHeregex
410
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
166
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
167 " Heredoc strings
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
168 syn region coffeeHeredoc start=/"""/ end=/"""/ contains=@coffeeInterpString
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
169 \ fold
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
170 syn region coffeeHeredoc start=/'''/ end=/'''/ contains=@coffeeBasicString
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
171 \ fold
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
172 hi def link coffeeHeredoc String
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
173
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
174 " An error for trailing whitespace, as long as the line isn't just whitespace
508
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents: 410
diff changeset
175 syn match coffeeSpaceError /\S\@<=\s\+$/ display
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents: 410
diff changeset
176 hi def link coffeeSpaceError Error
410
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
177
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
178 " An error for trailing semicolons, for help transitioning from JavaScript
508
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents: 410
diff changeset
179 syn match coffeeSemicolonError /;$/ display
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents: 410
diff changeset
180 hi def link coffeeSemicolonError Error
410
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
181
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
182 " Ignore reserved words in dot accesses.
508
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents: 410
diff changeset
183 syn match coffeeDotAccess /\.\@<!\.\s*\%(\I\|\$\)\%(\i\|\$\)*/he=s+1 contains=@coffeeIdentifier
410
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
184 hi def link coffeeDotAccess coffeeExtendedOp
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
185
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
186 " Ignore reserved words in prototype accesses.
508
bbcffc594d1e Vendor what should be vendored and add some more.
edogawaconan <me@myconan.net>
parents: 410
diff changeset
187 syn match coffeeProtoAccess /::\s*\%(\I\|\$\)\%(\i\|\$\)*/he=s+2 contains=@coffeeIdentifier
410
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
188 hi def link coffeeProtoAccess coffeeExtendedOp
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
189
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
190 " This is required for interpolations to work.
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
191 syn region coffeeCurlies matchgroup=coffeeCurly start=/{/ end=/}/
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
192 \ contains=@coffeeAll
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
193 syn region coffeeBrackets matchgroup=coffeeBracket start=/\[/ end=/\]/
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
194 \ contains=@coffeeAll
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
195 syn region coffeeParens matchgroup=coffeeParen start=/(/ end=/)/
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
196 \ contains=@coffeeAll
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
197
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
198 " These are highlighted the same as commas since they tend to go together.
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
199 hi def link coffeeBlock coffeeSpecialOp
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
200 hi def link coffeeBracket coffeeBlock
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
201 hi def link coffeeCurly coffeeBlock
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
202 hi def link coffeeParen coffeeBlock
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
203
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
204 " This is used instead of TOP to keep things coffee-specific for good
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
205 " embedding. `contained` groups aren't included.
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
206 syn cluster coffeeAll contains=coffeeStatement,coffeeRepeat,coffeeConditional,
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
207 \ coffeeException,coffeeKeyword,coffeeOperator,
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
208 \ coffeeExtendedOp,coffeeSpecialOp,coffeeBoolean,
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
209 \ coffeeGlobal,coffeeSpecialVar,coffeeSpecialIdent,
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
210 \ coffeeObject,coffeeConstant,coffeeString,
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
211 \ coffeeNumber,coffeeFloat,coffeeReservedError,
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
212 \ coffeeObjAssign,coffeeComment,coffeeBlockComment,
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
213 \ coffeeEmbed,coffeeRegex,coffeeHeregex,
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
214 \ coffeeHeredoc,coffeeSpaceError,
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
215 \ coffeeSemicolonError,coffeeDotAccess,
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
216 \ coffeeProtoAccess,coffeeCurlies,coffeeBrackets,
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
217 \ coffeeParens
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
218
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
219 if !exists('b:current_syntax')
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
220 let b:current_syntax = 'coffee'
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
221 endif