annotate rc/vim-syntax-coffee @ 419:587abe573053

Added PATH for pgdg 9.2. Sure has been ages last time I tried that :/
author Edho Arief <edho@myconan.net>
date Tue, 11 Dec 2012 16:15:34 -0500
parents fd0a889066a6
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
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
2 " Maintainer: Mick Koch <kchmck@gmail.com>
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
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
13
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
14 " Highlight long strings.
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
15 syn sync minlines=100
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
16
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
17 " CoffeeScript identifiers can have dollar signs.
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
18 setlocal isident+=$
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
19
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
20 " These are `matches` instead of `keywords` because vim's highlighting
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
21 " 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
22 " 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
23 " like with coffeeAssign and coffeeDot.
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
24 syn match coffeeStatement /\<\%(return\|break\|continue\|throw\)\>/ display
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
25 hi def link coffeeStatement Statement
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
26
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
27 syn match coffeeRepeat /\<\%(for\|while\|until\|loop\)\>/ display
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
28 hi def link coffeeRepeat Repeat
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
29
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
30 syn match coffeeConditional /\<\%(if\|else\|unless\|switch\|when\|then\)\>/
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
31 \ display
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
32 hi def link coffeeConditional Conditional
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
33
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
34 syn match coffeeException /\<\%(try\|catch\|finally\)\>/ display
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
35 hi def link coffeeException Exception
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
36
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
37 syn match coffeeKeyword /\<\%(new\|in\|of\|by\|and\|or\|not\|is\|isnt\|class\|extends\|super\|do\)\>/
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
38 \ display
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
39 " The `own` keyword is only a keyword after `for`.
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
40 syn match coffeeKeyword /\<for\s\+own\>/ contained containedin=coffeeRepeat
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
41 \ display
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
42 hi def link coffeeKeyword Keyword
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
43
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
44 syn match coffeeOperator /\<\%(instanceof\|typeof\|delete\)\>/ display
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
45 hi def link coffeeOperator Operator
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
46
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
47 " 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
48 syn match coffeeExtendedOp /\%(\S\s*\)\@<=[+\-*/%&|\^=!<>?.]\{-1,}\|[-=]>\|--\|++\|:/
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
49 \ display
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
50 syn match coffeeExtendedOp /\<\%(and\|or\)=/ display
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
51 hi def link coffeeExtendedOp coffeeOperator
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
52
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
53 " This is separate from `coffeeExtendedOp` to help differentiate commas from
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
54 " dots.
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
55 syn match coffeeSpecialOp /[,;]/ display
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
56 hi def link coffeeSpecialOp SpecialChar
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
57
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
58 syn match coffeeBoolean /\<\%(true\|on\|yes\|false\|off\|no\)\>/ display
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
59 hi def link coffeeBoolean Boolean
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
60
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
61 syn match coffeeGlobal /\<\%(null\|undefined\)\>/ display
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
62 hi def link coffeeGlobal Type
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
63
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
64 " A special variable
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
65 syn match coffeeSpecialVar /\<\%(this\|prototype\|arguments\)\>/ display
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
66 hi def link coffeeSpecialVar Special
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
67
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
68 " An @-variable
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
69 syn match coffeeSpecialIdent /@\%(\I\i*\)\?/ display
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
70 hi def link coffeeSpecialIdent Identifier
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
71
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
72 " A class-like name that starts with a capital letter
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
73 syn match coffeeObject /\<\u\w*\>/ display
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
74 hi def link coffeeObject Structure
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
75
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
76 " A constant-like name in SCREAMING_CAPS
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
77 syn match coffeeConstant /\<\u[A-Z0-9_]\+\>/ display
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
78 hi def link coffeeConstant Constant
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
79
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
80 " A variable name
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
81 syn cluster coffeeIdentifier contains=coffeeSpecialVar,coffeeSpecialIdent,
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
82 \ coffeeObject,coffeeConstant
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
83
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
84 " A non-interpolated string
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
85 syn cluster coffeeBasicString contains=@Spell,coffeeEscape
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
86 " An interpolated string
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
87 syn cluster coffeeInterpString contains=@coffeeBasicString,coffeeInterp
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
88
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
89 " Regular strings
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=@coffeeInterpString
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
92 syn region coffeeString start=/'/ skip=/\\\\\|\\'/ end=/'/
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
93 \ contains=@coffeeBasicString
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
94 hi def link coffeeString String
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
95
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
96 " A integer, including a leading plus or minus
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
97 syn match coffeeNumber /\i\@<![-+]\?\d\+\%([eE][+-]\?\d\+\)\?/ display
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
98 " A hex, binary, or octal number
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
99 syn match coffeeNumber /\<0[xX]\x\+\>/ display
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
100 syn match coffeeNumber /\<0[bB][01]\+\>/ display
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
101 syn match coffeeNumber /\<0[oO][0-7]\+\>/ display
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
102 hi def link coffeeNumber Number
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
103
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
104 " A floating-point number, including a leading plus or minus
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
105 syn match coffeeFloat /\i\@<![-+]\?\d*\.\@<!\.\d\+\%([eE][+-]\?\d\+\)\?/
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
106 \ display
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
107 hi def link coffeeFloat Float
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
108
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
109 " An error for reserved keywords
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
110 if !exists("coffee_no_reserved_words_error")
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
111 syn match coffeeReservedError /\<\%(case\|default\|function\|var\|void\|with\|const\|let\|enum\|export\|import\|native\|__hasProp\|__extends\|__slice\|__bind\|__indexOf\|implements\|interface\|let\|package\|private\|protected\|public\|static\|yield\)\>/
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
112 \ display
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
113 hi def link coffeeReservedError Error
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
114 endif
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
115
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
116 " A normal object assignment
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
117 syn match coffeeObjAssign /@\?\I\i*\s*\ze::\@!/ contains=@coffeeIdentifier display
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
118 hi def link coffeeObjAssign Identifier
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
119
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
120 syn keyword coffeeTodo TODO FIXME XXX contained
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
121 hi def link coffeeTodo Todo
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
122
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
123 syn match coffeeComment /#.*/ contains=@Spell,coffeeTodo
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
124 hi def link coffeeComment Comment
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
125
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
126 syn region coffeeBlockComment start=/####\@!/ end=/###/
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
127 \ contains=@Spell,coffeeTodo
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
128 hi def link coffeeBlockComment coffeeComment
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
129
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
130 " A comment in a heregex
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
131 syn region coffeeHeregexComment start=/#/ end=/\ze\/\/\/\|$/ contained
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
132 \ contains=@Spell,coffeeTodo
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
133 hi def link coffeeHeregexComment coffeeComment
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
134
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
135 " Embedded JavaScript
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
136 syn region coffeeEmbed matchgroup=coffeeEmbedDelim
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
137 \ start=/`/ skip=/\\\\\|\\`/ end=/`/
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
138 \ contains=@coffeeJS
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
139 hi def link coffeeEmbedDelim Delimiter
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
140
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
141 syn region coffeeInterp matchgroup=coffeeInterpDelim start=/#{/ end=/}/ contained
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
142 \ contains=@coffeeAll
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
143 hi def link coffeeInterpDelim PreProc
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
144
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
145 " A string escape sequence
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
146 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
147 hi def link coffeeEscape SpecialChar
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
148
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
149 " 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
150 " be followed by a number
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
151 syn region coffeeRegex start=/\%(\%()\|\i\@<!\d\)\s*\|\i\)\@<!\/=\@!\s\@!/
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
152 \ skip=/\[[^\]]\{-}\/[^\]]\{-}\]/
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
153 \ end=/\/[gimy]\{,4}\d\@!/
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
154 \ oneline contains=@coffeeBasicString
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
155 hi def link coffeeRegex String
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
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
158 syn region coffeeHeregex start=/\/\/\// end=/\/\/\/[gimy]\{,4}/
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
159 \ contains=@coffeeInterpString,coffeeHeregexComment
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
160 \ fold
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
161 hi def link coffeeHeregex coffeeRegex
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
162
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
163 " Heredoc strings
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
164 syn region coffeeHeredoc start=/"""/ end=/"""/ contains=@coffeeInterpString
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
165 \ fold
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
166 syn region coffeeHeredoc start=/'''/ end=/'''/ contains=@coffeeBasicString
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
167 \ fold
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
168 hi def link coffeeHeredoc String
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
169
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
170 " An error for trailing whitespace, as long as the line isn't just whitespace
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
171 if !exists("coffee_no_trailing_space_error")
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
172 syn match coffeeSpaceError /\S\@<=\s\+$/ display
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
173 hi def link coffeeSpaceError Error
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
174 endif
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
175
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
176 " An error for trailing semicolons, for help transitioning from JavaScript
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
177 if !exists("coffee_no_trailing_semicolon_error")
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
178 syn match coffeeSemicolonError /;$/ display
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
179 hi def link coffeeSemicolonError Error
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
180 endif
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.
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
183 syn match coffeeDotAccess /\.\@<!\.\s*\I\i*/he=s+1 contains=@coffeeIdentifier
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.
fd0a889066a6 Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
diff changeset
187 syn match coffeeProtoAccess /::\s*\I\i*/he=s+2 contains=@coffeeIdentifier
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