22---
33# http://www.sublimetext.com/docs/syntax.html
44name : CoffeeScript (Literate)
5- comment : CoffeeScript (Literate)
5+ scope : source.litcoffee
6+
67file_extensions :
78 - litcoffee
89 - litcoffee.erb
910 - coffee.md
10- scope : source.litcoffee
11+
1112contexts :
1213 main :
1314 - match : |-
@@ -20,16 +21,15 @@ contexts:
2021 (?! ([ ]{4}|\t))
2122 pop: true
2223 - include: block_raw
24+ # We could also use an empty end match and set
25+ # applyEndPatternLast, but then we must be sure that the begin
26+ # pattern will only match stuff matched by the sub-patterns.
2327 - match : |-
2428 (?x)^
2529 (?= [ ]{,3}>.
2630 | [#]{1,6}\s*+
2731 | [ ]{,3}(?<marker>[-*_])([ ]{,2}\k<marker>){2,}[ \t]*+$
2832 )
29- comment: |
30- We could also use an empty end match and set
31- applyEndPatternLast, but then we must be sure that the begin
32- pattern will only match stuff matched by the sub-patterns.
3333 push:
3434 - meta_scope: meta.block-level.markdown
3535 - match: |-
@@ -62,15 +62,15 @@ contexts:
6262 1 : punctuation.definition.list_item.markdown
6363 pop : true
6464 - include : list-paragraph
65+ # Markdown formatting is disabled inside block-level tags.
6566 - match : ' ^(?=<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del)\b)(?!.*?</\1>)'
66- comment : Markdown formatting is disabled inside block-level tags.
6767 push :
6868 - meta_scope : meta.disable-markdown
6969 - match : (?<=^</\1>$\n)
7070 pop : true
7171 - include : scope:text.html.basic
72+ # Same rule but for one line disables.
7273 - match : ' ^(?=<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del)\b)'
73- comment : Same rule but for one line disables.
7474 push :
7575 - meta_scope : meta.disable-markdown
7676 - match : $\n?
@@ -127,11 +127,10 @@ contexts:
127127 HTML grammar will not mark it up as invalid.
128128 scope : meta.other.valid-ampersand.markdown
129129 block_quote :
130+ # We terminate the block quote when seeing an empty line, a
131+ # separator or a line with leading > characters. The latter is
132+ # to “reset” the quote level for quoted lines.
130133 - match : ' \G[ ]{,3}(>)(?!$)[ ]?'
131- comment : |
132- We terminate the block quote when seeing an empty line, a
133- separator or a line with leading > characters. The latter is
134- to “reset” the quote level for quoted lines.
135134 captures :
136135 1 : punctuation.definition.blockquote.markdown
137136 push :
@@ -176,7 +175,7 @@ contexts:
176175 pop: true
177176 - include: inline
178177 block_raw :
179- - include : coffee_script
178+ - include : scope:source.coffee
180179 bold :
181180 - match : |-
182181 (?x)
@@ -245,165 +244,10 @@ contexts:
245244 - include: link-ref-literal
246245 - include: link-ref
247246 bracket :
247+ # Markdown will convert this for us. We match it so that the
248+ # HTML grammar will not mark it up as invalid.
248249 - match : ' <(?![a-z/?\$!])'
249- comment : |
250- Markdown will convert this for us. We match it so that the
251- HTML grammar will not mark it up as invalid.
252250 scope : meta.other.valid-bracket.markdown
253- coffee_script :
254- - match : ' (\([^()]*?\))\s*([=-]>)'
255- comment : ' match stuff like: a -> …'
256- scope : meta.inline.function.coffee
257- captures :
258- 1 : variable.parameter.function.coffee
259- 2 : storage.type.function.coffee
260- - match : (new)\s+((?!class)\w+(?:\.\w*)*)
261- scope : meta.class.instance.constructor
262- captures :
263- 1 : keyword.operator.new.coffee
264- 2 : entity.name.type.instance.coffee
265- - match : " '''"
266- captures :
267- 0 : punctuation.definition.string.begin.coffee
268- push :
269- - meta_scope : string.quoted.heredoc.coffee
270- - match : " '''"
271- captures :
272- 0 : punctuation.definition.string.end.coffee
273- pop : true
274- - match : ' """'
275- captures :
276- 0 : punctuation.definition.string.begin.coffee
277- push :
278- - meta_scope : string.quoted.double.heredoc.coffee
279- - match : ' """'
280- captures :
281- 0 : punctuation.definition.string.end.coffee
282- pop : true
283- - match : \\.
284- scope : constant.character.escape.coffee
285- - include : interpolated_coffee
286- - match : ' `'
287- captures :
288- 0 : punctuation.definition.string.begin.coffee
289- push :
290- - meta_scope : string.quoted.script.coffee
291- - match : ' `'
292- captures :
293- 0 : punctuation.definition.string.end.coffee
294- pop : true
295- - match : ' \\(x\h{2}|[0-2][0-7]{,2}|3[0-6][0-7]|37[0-7]?|[4-7][0-7]?|.)'
296- scope : constant.character.escape.coffee
297- - match : (?<!#)###(?!#)
298- captures :
299- 0 : punctuation.definition.comment.coffee
300- push :
301- - meta_scope : comment.block.coffee
302- - match : ' ###(?:[ \t]*\n)'
303- captures :
304- 0 : punctuation.definition.comment.coffee
305- pop : true
306- - match : ' @\w*'
307- scope : storage.type.annotation.coffeescript
308- - match : ' (#)(?!\{).*$\n?'
309- scope : comment.line.number-sign.coffee
310- captures :
311- 1 : punctuation.definition.comment.coffee
312- - match : ' /{3}'
313- push :
314- - meta_scope : string.regexp.coffee
315- - match : ' /{3}[imgy]{0,4}'
316- pop : true
317- - include : interpolated_coffee
318- - include : embedded_comment
319- - match : ' /(?![\s=/*+{}?])(\\.|.)*?/[igmy]{0,4}(?![a-zA-Z0-9])'
320- scope : string.regexp.coffee
321- - match : ' \b(?<![\.\$])(break|by|catch|continue|else|finally|for|in|of|if|return|switch|then|throw|try|unless|when|while|until|loop|do|(?<=for)\s+own)(?!\s*:)\b'
322- scope : keyword.control.coffee
323- - match : ' and=|or=|!|%|&|\^|\*|\/|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\?|\||\|\||\:|\*=|(?<!\()/=|%=|\+=|\-=|&=|\^=|\b(?<![\.\$])(instanceof|new|delete|typeof|and|or|is|isnt|not)\b'
324- scope : keyword.operator.coffee
325- - match : ' ([a-zA-Z\$_](\w|\$|\.)*\s*(?!\::)((:)|(=))(?!(\s*\(.*\))?\s*((=|-)>)))'
326- scope : variable.assignment.coffee
327- captures :
328- 1 : variable.assignment.coffee
329- 4 : punctuation.separator.key-value
330- 5 : keyword.operator.coffee
331- - match : ' (?<=\s|^)([\[\{])(?=.*?[\]\}]\s+[:=])'
332- captures :
333- 0 : keyword.operator.coffee
334- push :
335- - meta_scope : meta.variable.assignment.destructured.coffee
336- - match : ' ([\]\}]\s*[:=])'
337- captures :
338- 0 : keyword.operator.coffee
339- pop : true
340- - include : variable_name
341- - include : instance_variable
342- - include : single_quoted_string
343- - include : double_quoted_string
344- - include : numeric
345- - match : ' (\s*)(?=[a-zA-Z\$_])([a-zA-Z\$_](\w|\$|:|\.)*\s*(?=[:=](\s*\(.*\))?\s*((=|-)>)))'
346- scope : meta.function.coffee
347- captures :
348- 2 : entity.name.function.coffee
349- 3 : entity.name.function.coffee
350- 4 : variable.parameter.function.coffee
351- 5 : storage.type.function.coffee
352- - match : (=|-)>
353- scope : storage.type.function.coffee
354- - match : ' \b(?<!\.)(true|on|yes)(?!\s*[:=])\b'
355- scope : constant.language.boolean.true.coffee
356- - match : ' \b(?<!\.)(false|off|no)(?!\s*[:=])\b'
357- scope : constant.language.boolean.false.coffee
358- - match : ' \b(?<!\.)null(?!\s*[:=])\b'
359- scope : constant.language.null.coffee
360- - match : ' \b(?<!\.)(super|this|extends)(?!\s*[:=])\b'
361- scope : variable.language.coffee
362- - match : ' (class\b)\s+((?!extends)@?[a-zA-Z\$_][\w\.]*)?(?:\s*(extends)\s+(@?[a-zA-Z\$\._][\w\.]*))?'
363- scope : meta.class.coffee
364- captures :
365- 1 : storage.type.class.coffee
366- 2 : entity.name.type.class.coffee
367- 3 : keyword.control.inheritance.coffee
368- 4 : entity.other.inherited-class.coffee
369- - match : \b(debugger|\\)\b
370- scope : keyword.other.coffee
371- - match : \b(Infinity|NaN|undefined)\b
372- scope : constant.language.coffee
373- - match : \;
374- scope : punctuation.terminator.statement.coffee
375- - match : ' ,[ |\t]*'
376- scope : meta.delimiter.object.comma.coffee
377- - match : \.
378- scope : meta.delimiter.method.period.coffee
379- - match : ' \{|\}'
380- scope : meta.brace.curly.coffee
381- - match : \(|\)
382- scope : meta.brace.round.coffee
383- - match : ' \[|\]\s*'
384- scope : meta.brace.square.coffee
385- - include : instance_variable
386- - include : single_quoted_string
387- - include : double_quoted_string
388- - include : numeric
389- double_quoted_string :
390- - match : ' "'
391- captures :
392- 0 : punctuation.definition.string.begin.coffee
393- push :
394- - meta_scope : string.quoted.double.coffee
395- - match : ' "'
396- captures :
397- 0 : punctuation.definition.string.end.coffee
398- pop : true
399- - match : ' \\(x\h{2}|[0-2][0-7]{,2}|3[0-6][0-7]|37[0-7]?|[4-7][0-7]?|.)'
400- scope : constant.character.escape.coffee
401- - include : interpolated_coffee
402- embedded_comment :
403- - match : (?<!\\)(#).*$\n?
404- scope : comment.line.number-sign.coffee
405- captures :
406- 1 : punctuation.definition.comment.coffee
407251 escape :
408252 - match : ' \\[-`*_#+.!(){}\[\]\\>]'
409253 scope : constant.character.escape.markdown
@@ -478,20 +322,6 @@ contexts:
478322 - include : image-ref
479323 - include : link-ref-literal
480324 - include : link-ref
481- instance_variable :
482- - match : ' (@)([a-zA-Z_\$]\w*)?'
483- scope : variable.other.readwrite.instance.coffee
484- interpolated_coffee :
485- - match : ' \#\{'
486- captures :
487- 0 : punctuation.section.embedded.coffee
488- push :
489- - meta_scope : source.coffee.embedded.source
490- - match : ' \}'
491- captures :
492- 0 : punctuation.section.embedded.coffee
493- pop : true
494- - include : main
495325 italic :
496326 - match : |-
497327 (?x)
@@ -652,20 +482,3 @@ contexts:
652482 separator :
653483 - match : ' \G[ ]{,3}([-*_])([ ]{,2}\1){2,}[ \t]*$\n?'
654484 scope : meta.separator.markdown
655- single_quoted_string :
656- - match : " '"
657- captures :
658- 0 : punctuation.definition.string.begin.coffee
659- push :
660- - meta_scope : string.quoted.single.coffee
661- - match : " '"
662- captures :
663- 0 : punctuation.definition.string.end.coffee
664- pop : true
665- - match : ' \\(x\h{2}|[0-2][0-7]{,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)'
666- scope : constant.character.escape.coffee
667- variable_name :
668- - match : ' ([a-zA-Z\$_]\w*(\.\w+)*)'
669- scope : variable.assignment.coffee
670- captures :
671- 1 : variable.assignment.coffee
0 commit comments