forked from wavded/gedit-coffeescript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
coffee_script.lang
225 lines (194 loc) · 9.31 KB
/
coffee_script.lang
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
<?xml version="1.0" encoding="UTF-8"?>
<!--
Author: Marc Harter <[email protected]>
Copyright (C) 2004 Marc Harter <[email protected]>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
-->
<language id="coffee" _name="CoffeeScript" version="2.0" _section="Scripts">
<metadata>
<property name="mimetypes">application/coffeescript;text/coffeescript;application/cakefile;text/cakefile;</property>
<property name="globs">*.coffee;*.Cakefile</property>
<property name="line-comment-start">#</property>
<property name="block-comment-start">###</property>
<property name="block-comment-end">###</property>
</metadata>
<styles>
<style id="comment" _name="Comment" map-to="def:comment"/>
<style id="error" _name="Error" map-to="def:error"/>
<style id="string" _name="String" map-to="def:string"/>
<style id="global" _name="Global Value" map-to="def:special-constant"/>
<style id="constant" _name="Constant" map-to="def:special-constant"/>
<style id="boolean" _name="Boolean value" map-to="def:boolean"/>
<style id="statement" _name="Statement" map-to="def:statement"/>
<style id="loop" _name="Loop" map-to="def:keyword"/>
<style id="conditional" _name="Conditional" map-to="def:keyword"/>
<style id="exception" _name="Exception" map-to="def:error"/>
<style id="operator" _name="Operator" map-to="def:keyword"/>
<style id="keyword" _name="Keyword" map-to="def:keyword"/>
<style id="assessor" _name="Assessor" map-to="def:identifier"/>
<style id="regexp" _name="RegExp" map-to="def:special-char"/>
<style id="function" _name="Function" map-to="def:function"/>
<style id="constructors" _name="Constructors" map-to="def:type"/>
</styles>
<definitions>
<context id="coffee">
<include>
<!-- Comments -->
<context id="block-comment" style-ref="comment">
<start>^[ \t]*###([^#]|$)</start>
<end>^.*###([^#]|$)</end>
<include>
<context ref="def:in-comment"/>
</include>
</context>
<context id="line-comment" style-ref="comment">
<start>#</start>
<end>$</end>
<include>
<context ref="def:line-continue"/>
<context ref="def:in-comment"/>
</include>
</context>
<context id="regexp" style-ref="regexp">
<match>(?<!\d)\s*/(?![\s/*+{}?]).*/[igmy]*</match>
</context>
<!-- Strings -->
<context id="string-heredocs-single" style-ref="string">
<start>'''</start>
<end>'''</end>
<include>
<context ref="def:line-continue"/>
<context ref="def:escape"/>
</include>
</context>
<context id="string-heredocs-double" style-ref="string">
<start>"""</start>
<end>"""</end>
<include>
<context ref="def:line-continue"/>
<context ref="def:escape"/>
<context id="interpolation-heredocs-double" style-ref="assessor" extend-parent="false">
<match>\#{[^}]+}</match>
</context>
</include>
</context>
<context id="string-double" style-ref="string">
<start>"</start>
<end>"</end>
<include>
<context id="interpolation-string-double" style-ref="assessor" extend-parent="false">
<match>\#{[^}]+}</match>
</context>
</include>
</context>
<context id="string-single" style-ref="string">
<start>'</start>
<end>'</end>
<include>
<context ref="def:line-continue"/>
<context ref="def:escape"/>
</include>
</context>
<context id="string-javascript" style-ref="string">
<start>`</start>
<end>`</end>
<include>
<context ref="def:line-continue"/>
<context ref="def:escape"/>
</include>
</context>
<!-- Numbers -->
<context ref="def:float"/>
<context ref="def:decimal"/>
<context ref="def:octal"/>
<context ref="def:hexadecimal"/>
<!-- Constants -->
<context id="global" style-ref="global">
<keyword>undefined</keyword>
<keyword>null</keyword>
</context>
<context id="constant" style-ref="constant">
<match>\b[A-Z0-9_]+\b</match>
</context>
<context id="boolean" style-ref="boolean">
<keyword>false</keyword>
<keyword>true</keyword>
<keyword>yes</keyword>
<keyword>no</keyword>
<keyword>on</keyword>
<keyword>off</keyword>
</context>
<context id="statement" style-ref="statement">
<keyword>return</keyword>
<keyword>break</keyword>
<keyword>continue</keyword>
<keyword>throw</keyword>
</context>
<context id="loop" style-ref="loop">
<keyword>for</keyword>
<keyword>while</keyword>
<keyword>until</keyword>
<keyword>loop</keyword>
</context>
<context id="conditional" style-ref="conditional">
<keyword>if</keyword>
<keyword>else</keyword>
<keyword>unless</keyword>
<keyword>switch</keyword>
<keyword>when</keyword>
<keyword>then</keyword>
<keyword>and</keyword>
<keyword>or</keyword>
<keyword>in</keyword>
<keyword>of</keyword>
<keyword>by</keyword>
<keyword>is</keyword>
<keyword>isnt</keyword>
<keyword>not</keyword>
</context>
<context id="operator" style-ref="operator">
<match>(-[\-=>]?|\+[+=]?|[*&|\/%=<>^~:!?]+)([ \t]*)</match>
</context>
<!-- Keywords -->
<context id="keywords" style-ref="keyword">
<keyword>instanceof</keyword>
<keyword>typeof</keyword>
<keyword>delete</keyword>
<keyword>new</keyword>
<keyword>where</keyword>
<keyword>class</keyword>
<keyword>extends</keyword>
<keyword>super</keyword>
<keyword>try</keyword>
<keyword>catch</keyword>
<keyword>finally</keyword>
</context>
<context id="exception" style-ref="exception">
<keyword>try</keyword>
<keyword>catch</keyword>
<keyword>finally</keyword>
</context>
<context id="assessor" style-ref="assessor">
<match>(@([a-zA-Z\$_](\w|\$)*)|this)</match>
</context>
<context id="functions" style-ref="function">
<keyword>\b[A-Za-z0-9_]+\b(?=\s*?(=|:)\s*?(\(|-\>|=\>))</keyword>
</context>
<context id="constructors" style-ref="constructors">
<match>\b[A-Z][A-Za-z0-9_]+\b(?!\.)</match>
</context>
</include>
</context>
</definitions>
</language>