on 448bfaf help sign in
bat/assets/syntaxes/02_Extra/LiveScript.sublime-syntax
400 lines 15 kB history raw
1%YAML 1.2
2---
3# http://www.sublimetext.com/docs/3/syntax.html
4name: LiveScript
5comment: "LiveScript Syntax: version 1"
6file_extensions:
7 - ls
8 - Slakefile
9 - ls.erb
10first_line_match: ^#!.*\bls
11scope: source.livescript
12contexts:
13 main:
14 - match: |-
15 (?x)
16 !?[~-]{1,2}>\*?
17 |<[~-]{1,2}!?
18 |\(\s* (?= instanceof[\s)]|and[\s)]|or[\s)]|is[\s)]|isnt[\s)]|in[\s)]|import[\s)]|import\ all[\s)] |\.|[-+/*%^&<>=|][\b\s)\w$]|\*\*|\%\%)
19 | (?<=[\s(]instanceof|[\s(]and|[\s(]or|[\s(]is|[\s(]isnt|[\s(]in|[\s(]import|[\s(]import\ all|[\s(]do|\.|\*\*|\%\%|[\b\s(\w$][-+/*%^&<>=|]) \s*\)
20 scope: storage.type.function.livescript
21 - match: \/\*
22 captures:
23 0: punctuation.definition.comment.livescript
24 push:
25 - meta_scope: comment.block.livescript
26 - match: \*\/
27 captures:
28 0: punctuation.definition.comment.livescript
29 pop: true
30 - match: '@\w*'
31 scope: storage.type.annotation.livescriptscript
32 - match: '(#)(?!\{).*$\n?'
33 scope: comment.line.number-sign.livescript
34 captures:
35 1: punctuation.definition.comment.livescript
36 - match: '((?:!|~|!~|~!)?function\*?)\s+([$\w\-]*[$\w]+)'
37 captures:
38 1: storage.type.function.livescript
39 2: entity.name.function.livescript
40 - match: (new)\s+(\w+(?:\.\w*)*)
41 captures:
42 1: keyword.operator.new.livescript
43 2: entity.name.type.instance.livescript
44 - match: \b(package|private|protected|public|interface|enum|static)(?!-)\b
45 scope: keyword.illegal.livescript
46 - match: "'''"
47 captures:
48 0: punctuation.definition.string.begin.livescript
49 push:
50 - meta_scope: string.quoted.heredoc.livescript
51 - match: "'''"
52 captures:
53 0: punctuation.definition.string.end.livescript
54 pop: true
55 - match: '"""'
56 captures:
57 0: punctuation.definition.string.begin.livescript
58 push:
59 - meta_scope: string.quoted.double.heredoc.livescript
60 - match: '"""'
61 captures:
62 0: punctuation.definition.string.end.livescript
63 pop: true
64 - match: \\.
65 scope: constant.character.escape.livescript
66 - include: interpolated_livescript
67 - match: "``"
68 captures:
69 0: punctuation.definition.string.begin.livescript
70 push:
71 - meta_scope: string.quoted.script.livescript
72 - match: "``"
73 captures:
74 0: punctuation.definition.string.end.livescript
75 pop: true
76 - match: '\\(x[0-9A-Fa-f]{2}|[0-2][0-7]{0,2}|3[0-6][0-7]|37[0-7]?|[4-7][0-7]?|.)'
77 scope: constant.character.escape.livescript
78 - match: '<\['
79 push:
80 - meta_scope: string.array-literal.livescript
81 - match: '\]>'
82 pop: true
83 - match: '/{2}(?![\s=/*+{}?]).*?[^\\]/[igmy]{0,4}(?![a-zA-Z0-9])/{2}'
84 scope: string.regexp.livescript
85 - match: '/{2}\n'
86 push:
87 - meta_scope: string.regexp.livescript
88 - match: "/{2}[imgy]{0,4}"
89 pop: true
90 - include: embedded_spaced_comment
91 - include: interpolated_livescript
92 - match: "/{2}"
93 push:
94 - meta_scope: string.regexp.livescript
95 - match: "/{2}[imgy]{0,4}"
96 pop: true
97 - match: '\\(x[0-9A-Fa-f]{2}|[0-2][0-7]{0,2}|3[0-6][0-7]|37[0-7]?|[4-7][0-7]?|.)'
98 scope: constant.character.escape.livescript
99 - include: interpolated_livescript
100 - match: '/(?![\s=/*+{}?]).*?[^\\]/[igmy]{0,4}(?![a-zA-Z0-9])'
101 scope: string.regexp.livescript
102 - match: |-
103 (?x)
104 \b(?<![\.\$\-@])(
105 instanceof|new|delete|typeof|and|or|is|isnt|not
106 )(?!\-|\s*:)\b
107 scope: keyword.operator.livescript
108 - match: <\||\|>
109 scope: keyword.operator.livescript
110 - match: "=>"
111 scope: keyword.control.livescript
112 - match: |-
113 (?x)
114 \b(?<![\.\$\-@])(?:
115 return|break|continue|throw
116 |try|if|while|for|for\s+own|switch|unless|until
117 |catch|finally|else|nobreak|case|default|fallthrough|when|otherwise|then
118 |yield
119 )(?!\-|\s*:)\b
120 scope: keyword.control.livescript
121 - match: |-
122 (?x)
123 and=|or=|%|&|\^|\*|\/|(?<![a-zA-Z$_])(\-)?\-(?!\-?>)|\+\+|\+|
124 ~(?!~?>)|==|=|!=|<=|>=|<<=|>>=|
125 >>>=|<>|<(?!\[)|(?<!\])>|(?<!\w)!(?!([~\-]+)?>)|&&|\.\.(\.)?|\s\.\s|\?|\|\||\:|\*=|(?<!\()/=|%=|\+=|\-=|\.=|&=
126 |\^=
127 scope: keyword.operator.livescript
128 - match: |-
129 (?x)
130 \b(?<![\.\$\-@])(?:
131 function
132 )(?!\-|\s*:)\b
133 scope: storage.type.function.livescript
134 - match: |-
135 (?x)
136 \b(?<![\.\$\-@])(?:
137 this|throw|then|try|typeof!?|til|to
138 |continue|const|case|catch|class
139 |in|instanceof|import|import\s+all|implements|if|is
140 |default|delete|debugger|do
141 |for|for\s+own|finally|function|from|fallthrough
142 |super|switch
143 |else|nobreak|extends|export|eval
144 |and|arguments
145 |new|not
146 |unless|until
147 |while|with|when
148 |of|or|otherwise
149 |let|var|loop
150 |match
151 |by|yield
152 )(?!\-|\s*:)\b
153 scope: keyword.other.livescript
154 - match: '([a-zA-Z\$_](?:[\w$.-])*)\s*(?!\::)((:)|(=(?!>)))\s*(?!(\s*!?\s*\(.*\))?\s*(!?[~-]{1,2}>\*?))'
155 captures:
156 1: variable.assignment.livescript
157 3: punctuation.separator.key-value, keyword.operator.livescript
158 4: keyword.operator.livescript
159 - match: '(?<=\s|^)([\[\{])(?=.*?[\]\}]\s+[:=])'
160 captures:
161 0: keyword.operator.livescript
162 push:
163 - meta_scope: meta.variable.assignment.destructured.livescript
164 - match: '([\]\}]\s*[:=])'
165 captures:
166 0: keyword.operator.livescript
167 pop: true
168 - include: variable_name
169 - include: instance_variable
170 - include: single_quoted_string
171 - include: double_quoted_string
172 - include: numeric
173 - match: |-
174 (?x)
175 (\s*)
176 (?=[a-zA-Z\$_])
177 ([a-zA-Z\$_]([\w$.:-])*)\s*
178 (?=[:=](\s*!?\s*\(.*\))?\s*(!?[~-]{1,2}>\*?))
179 scope: meta.function.livescript
180 captures:
181 2: entity.name.function.livescript
182 3: entity.name.function.livescript
183 4: variable.parameter.function.livescript
184 5: storage.type.function.livescript
185 - match: \b(?<!\.)(true|on|yes)(?!\s*:)\b
186 scope: constant.language.boolean.true.livescript
187 - match: \b(?<!\.)(false|off|no)(?!\s*:)\b
188 scope: constant.language.boolean.false.livescript
189 - match: \b(?<!\.)(null|void)(?!\s*:)\b
190 scope: constant.language.null.livescript
191 - match: \b(?<!\.)(super|this|extends)(?!\s*:)\b
192 scope: variable.language.livescript
193 - match: '(class\b)\s+(@?[a-zA-Z$_][\w$.-]*)?(?:\s+(extends)\s+(@?[a-zA-Z$_][\w$.-]*))?'
194 scope: meta.class.livescript
195 captures:
196 1: storage.type.class.livescript
197 2: entity.name.type.class.livescript
198 3: keyword.control.inheritance.livescript
199 4: entity.other.inherited-class.livescript
200 - match: \b(debugger|\\)\b
201 scope: keyword.other.livescript
202 - match: |-
203 (?x)\b(
204 Array|ArrayBuffer|Blob|Boolean|Date|document|event|Function|
205 Int(8|16|32|64)Array|Math|Map|Number|
206 Object|Proxy|RegExp|Set|String|WeakMap|
207 window|Uint(8|16|32|64)Array|XMLHttpRequest
208 )\b
209 scope: support.class.livescript
210 - match: \b(console)\b
211 scope: entity.name.type.object.livescript
212 - match: \b(Infinity|NaN|undefined)\b
213 scope: constant.language.livescript
214 - match: \;
215 scope: punctuation.terminator.statement.livescript
216 - match: ',[ |\t]*'
217 scope: meta.delimiter.object.comma.livescript
218 - match: \.
219 scope: meta.delimiter.method.period.livescript
220 - match: '\{|\}'
221 scope: meta.brace.curly.livescript
222 - match: \(|\)
223 scope: meta.brace.round.livescript
224 - match: '\[|\]\s*'
225 scope: meta.brace.square.livescript
226 - include: instance_variable
227 - include: backslash_string
228 - include: single_quoted_string
229 - include: double_quoted_string
230 - include: numeric
231 - match: '()(@|@@|[$\w\-]*[$\w]+)\s*(`)'
232 captures:
233 1: keyword.operator.livescript
234 2: meta.function-call.livescript
235 3: keyword.operator.livescript
236 - match: "`"
237 scope: keyword.operator.livescript
238 - match: '()(@|@@|[$\w\-]*[$\w]+)(?:(\??\!)|[(])'
239 captures:
240 1: keyword.operator.livescript
241 2: meta.function-call.livescript
242 3: keyword.operator.livescript
243 - match: '(@|@@|[$\w\-]*[$\w]+)(\?)? (?!\s*(((by|of|and|or|with|when|unless|if|is|isnt|else|nobreak|for|from|not in|in|catch|til|to|then|import|extends|implements|instanceof)\b)|[=:.*\/+\-%\^<>][ =)]|[`}%*)]|/(?!.*?/)|&&|[.][^.]|=>|\/ +|\||\|\||\-\-|\+\+|\|>|<|\||$|\n|\#|/\*))'
244 captures:
245 1: meta.function-call.livescript
246 2: keyword.operator.livescript
247 - match: \| _
248 scope: keyword.control.livescript
249 - match: '\|(?![.])'
250 scope: keyword.control.livescript
251 - match: \|
252 scope: keyword.operator.livescript
253 - match: ((?<=console\.)(debug|warn|info|log|error|time(End|-end)|assert))\b
254 scope: support.function.console.livescript
255 - match: |-
256 (?x)\b(
257 decodeURI(Component)?|encodeURI(Component)?|eval|parse(Float|Int)|require
258 )\b
259 scope: support.function.livescript
260 - match: |-
261 (?x)(?<![.-])\b(
262 map|filter|reject|partition|find|each|head|tail|last|initial|empty|
263 values|keys|length|cons|append|join|reverse|fold(l|r)?1?|unfoldr|
264 and(List|-list)|or(List|-list)|any|all|unique|sum|product|mean|compact|
265 concat(Map|-map)?|maximum|minimum|scan(l|r)?1?|replicate|slice|apply|
266 split(At|-at)?|take(While|-while)?|drop(While|-while)?|span|first|
267 break(It|-it)|list(ToObj|-to-obj)|obj(ToFunc|-to-func)|
268 pairs(ToObj|-to-obj)|obj(ToPairs|-to-pairs|ToLists|-to-lists)|
269 zip(All|-all)?(With|-with)?|compose|curry|partial|flip|fix|
270 sort(With|-with|By|-by)?|group(By|-by)|break(List|-list|Str|-str)|
271 difference|intersection|union|average|flatten|chars|unchars|repeat|
272 lines|unlines|words|unwords|max|min|negate|abs|signum|quot|rem|div|mod|
273 recip|pi|tau|exp|sqrt|ln|pow|sin|cos|tan|asin|acos|atan|atan2|truncate|
274 round|ceiling|floor|is(It|-it)NaN|even|odd|gcd|lcm|disabled__id
275 )\b(?![.-])
276 comment: |
277 Generated by DOM query from http://gkz.github.com/prelude-ls/:
278 [].slice
279 .call(document.querySelectorAll(".nav-pills li a"))
280 .map(function(_) {return _.innerText})
281 .filter(function(_) {return _.trim() !== '})
282 .slice(2)
283 .join("|")
284 scope: support.function.prelude.livescript
285 - match: '(?x)(?<![.-])\b(that|it|e|_)\b'
286 scope: support.function.semireserved.livescript
287 - match: |-
288 (?x)((?<=(\.|\]|\)))(
289 apply|call|concat|every|filter|for(Each|-each)|
290 from|has(Own|-own)(Property|-property)|index(Of|-of)|
291 is(Prototype|-prototype)(Of|-of)|join|last(Index|-index)(Of|-of)|
292 map|of|pop|property(Is|-is)(Enumerable|-enumerable)|push|
293 reduce(Right|-right)?|reverse|shift|slice|some|sort|
294 splice|to(Locale|-locale)?(String|-string)|unshift|valueOf
295 ))\b(?!-)
296 scope: support.function.method.array.livescript
297 - match: |-
298 (?x)((?<=Array\.)(
299 isArray
300 ))\b
301 scope: support.function.static.array.livescript
302 - match: |-
303 (?x)((?<=Object\.)(
304 create|define(Propert|-propert)(ies|y)|freeze|
305 get(Own|-own)(Property|-property)(Descriptors?|Names)|
306 get(Property|-property)(Descriptor|Names)|getPrototypeOf|
307 is((Extensible|-extensible)|(Frozen|-frozen)|(Sealed|-sealed))?|
308 keys|prevent(Extensions|-extensions)|seal
309 ))\b
310 scope: support.function.static.object.livescript
311 - match: |-
312 (?x)((?<=Math\.)(
313 abs|acos|acosh|asin|asinh|atan|atan2|atanh|ceil|cos|cosh|exp|expm1|floor|
314 hypot|log|log10|log1p|log2|max|min|pow|random|round|sign|sin|sinh|sqrt|
315 tan|tanh|trunc
316 ))\b
317 scope: support.function.static.math.livescript
318 - match: |-
319 (?x)((?<=Number\.)(
320 is(Finite|Integer|NaN)|to(Integer|-integer)
321 ))\b
322 scope: support.function.static.number.livescript
323 - match: '[\$\w][\w-]*'
324 scope: variable.other.livescript
325 backslash_string:
326 - match: '\\([\\)\s,\};\]])?'
327 captures:
328 0: string.quoted.single.livescript
329 push:
330 - meta_content_scope: string.quoted.single.livescript
331 - match: '([\\)\s,\};\]])'
332 captures:
333 0: punctuation.definition.string.end.livescript
334 pop: true
335 constructor_variable:
336 - match: '([a-zA-Z$_][\w$-]*)(@{2})([a-zA-Z$_][\w$-]*)?'
337 scope: variable.other.readwrite.constructor.livescript
338 double_quoted_string:
339 - match: '"'
340 captures:
341 0: punctuation.definition.string.begin.livescript
342 push:
343 - meta_scope: string.quoted.double.livescript
344 - match: '"'
345 captures:
346 0: punctuation.definition.string.end.livescript
347 pop: true
348 - match: '\\(x[0-9A-Fa-f]{2}|[0-2][0-7]{0,2}|3[0-6][0-7]|37[0-7]?|[4-7][0-7]?|.)'
349 scope: constant.character.escape.livescript
350 - include: interpolated_livescript
351 embedded_comment:
352 - match: (?<!\\)(#).*$\n
353 scope: comment.line.number-sign.livescript
354 captures:
355 1: punctuation.definition.comment.livescript
356 embedded_spaced_comment:
357 - match: (?<!\\)(#\s).*$\n
358 scope: comment.line.number-sign.livescript
359 captures:
360 1: punctuation.definition.comment.livescript
361 instance_variable:
362 - match: '(?<![$\w\-])(@)'
363 scope: variable.other.readwrite.instance.livescript
364 interpolated_livescript:
365 - match: '\#\{'
366 captures:
367 0: punctuation.section.embedded.livescript
368 push:
369 - meta_scope: source.livescript.embedded.source
370 - match: '\}'
371 captures:
372 0: punctuation.section.embedded.livescript
373 pop: true
374 - include: main
375 - match: '\#'
376 push:
377 - meta_scope: source.livescript.embedded.source.simple
378 - match: ""
379 pop: true
380 - include: main
381 numeric:
382 - match: '(?<![\$@a-zA-Z_])(([0-9]+r[0-9_]+)|((16r|0[xX])[0-9a-fA-F_]+)|([0-9]+(\.[0-9]+[0-9_]*)?(e[+\-]?[0-9_]+)?)[_a-zA-Z0-9]*)'
383 scope: constant.numeric.livescript
384 single_quoted_string:
385 - match: "'"
386 captures:
387 0: punctuation.definition.string.begin.livescript
388 push:
389 - meta_scope: string.quoted.single.livescript
390 - match: "'"
391 captures:
392 0: punctuation.definition.string.end.livescript
393 pop: true
394 - match: '\\(x[0-9A-Fa-f]{2}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)'
395 scope: constant.character.escape.livescript
396 variable_name:
397 - match: '([a-zA-Z\$_][\w$-]*(\.\w+)*)(?!\-)'
398 scope: variable.assignment.livescript
399 captures:
400 1: variable.assignment.livescript