@@ -0,0 +1,711 @@
3+# http://www.sublimetext.com/docs/3/syntax.html
12+ - match: '^\s*(@(?:import|charset|css|font-face|(?:-webkit-)?keyframes)(?:\s+([\w-]+))?)\b'
14+ 1: keyword.control.at-rule.other.stylus
15+ 2: variable.other.animation-name.stylus
17+ - match: '$|;|(?=\{)'
19+ - include: string-quoted
20+ - match: ^\s*(@media)\s*
22+ 1: keyword.control.at-rule.media.stylus
26+ - include: media-query
40+ - include: expression
42+ - include: conditionals
45+ (?x) # multi-line regex definition mode
47+ ^(\s*) # starts at the beginning of line
48+ ([\w$-]+) # identifier (name)
49+ (\() # start of argument list
52+ \)\s*\{ # we see a curly brace afterwards
53+ ) # which means this is a function definition
55+ 2: entity.name.function.stylus
56+ 3: punctuation.definition.parameters.start.stylus
58+ - meta_scope: meta.function-call.stylus
61+ 1: punctuation.definition.parameters.end.stylus
63+ - include: expression
65+ (?x) # multi-line regex definition mode
68+ (^|;) # starts at the beginning of line or at a ;
70+ (\+?\s* # for block mixins
71+ [\w$-]+) # identifier (name)
72+ (\() # start of argument list
75+ \)\s*;?\s* # if there are only spaces and semicolons
80+ 3: entity.other.attribute-name.mixin.stylus
81+ 4: punctuation.definition.parameters.start.stylus
83+ - meta_scope: meta.function-call.stylus
86+ 1: punctuation.definition.parameters.end.stylus
88+ - include: expression
90+ (?x) # multi-line regex definition mode
100+ \/|normal|bold|light(er?)|serif|sans|monospace|
101+ \b\d+(?:\b|px|r?em|%)|
105+ ) | # we need to distinguish between tag and property `cursor`
114+ (?:-moz-|-webkit-|-ms-)?
115+ (?:auto|default|none|context-menu|help|pointer|progress|
116+ wait|cell|crosshair|text|vertical-text|alias|copy|
117+ move|no-drop|not-allowed|e-resize|n-resize|ne-resize|
118+ nw-resize|s-resize|se-resize|sw-resize|w-resize|
119+ ew-resize|ns-resize|nesw-resize|nwse-resize|col-resize|
120+ row-resize|all-scroll|zoom-in|zoom-out|grab|grabbing
121+ normal|bold|light(er?)|serif|sans|monospace)
125+ altGlyph|altGlyphDef|altGlyphItem|animate|animateColor|
126+ animateMotion|animateTransform|circle|clipPath|color-profile|
127+ defs|desc|ellipse|feBlend|feColorMatrix|
128+ feComponentTransfer|feComposite|feConvolveMatrix|
129+ feDiffuseLighting|feDisplacementMap|feDistantLight|feFlood|
130+ feFuncA|feFuncB|feFuncG|feFuncR|feGaussianBlur|feImage|feMerge|
131+ feMergeNode|feMorphology|feOffset|fePointLight|
132+ feSpecularLighting|feSpotLight|feTile|feTurbulence|filter|
133+ font-face|font-face-format|font-face-name|font-face-src|
134+ font-face-uri|foreignObject|g|glyph|glyphRef|hkern|image|line|
135+ linearGradient|marker|mask|metadata|missing-glyph|mpath|path|
136+ pattern|polygon|polyline|radialGradient|rect|set|stop|svg|
137+ switch|symbol|text|textPath|tref|tspan|use|view|vkern|
138+ a|abbr|acronym|address|applet|area|article|aside|audio|b|base|
139+ basefont|bdi|bdo|bgsound|big|blink|blockquote|body|br|button|
140+ canvas|caption|center|cite|code|col|colgroup|data|
141+ datalist|dd|decorator|del|details|dfn|dir|div|dl|dt|element|
142+ em|embed|fieldset|figcaption|figure|footer|form|frame|
143+ frameset|h1|h2|h3|h4|h5|h6|head|header|hgroup|hr|html|i|iframe|
144+ img|input|ins|isindex|kbd|keygen|label|legend|li|link|listing|
145+ main|map|mark|marquee|menu|menuitem|meta|meter|nav|nobr|
146+ noframes|noscript|object|ol|optgroup|option|output|p|param|
147+ plaintext|pre|progress|q|rp|rt|ruby|s|samp|script|section|
148+ select|shadow|small|source|spacer|span|strike|strong|style|
149+ sub|summary|sup|table|tbody|td|template|textarea|tfoot|th|
150+ thead|time|title|tr|track|tt|u|ul|var|video|wbr|xmp)
152+ \s*([\s,.#\[]|:[^\s]|(?=\{|$))
155+ [:~>\[*\/] # symbols but they are valid for selector
159+ \+\s*[\w$-]+\b\s* # are an identifier starting with $
160+ (?!\() # and they can't have anything besides
162+ ) | ( # for animtions
164+ \d+(\.\d+)?%|(from|to)\b
166+ ) | ( # Placeholder selectors
168+ \$[\w$-]+\b\s* # are an identifier starting with $
169+ (?=$|\{) # and they can't have anything besides
179+ ) | ( # Reference to parent
181+ ([\w\d_-]+)? # matching any word right before &
182+ (&) # & itself, escaped because of plist
183+ ([\w\d_-]+)? # matching any word right after &
187+ - meta_scope: meta.selector.stylus
190+ |$|(?=\{\s*\}.*$)|(?=\{.*?[:;])|(?=\{)(?!.+\}.*$)
193+ - match: \d+(\.\d+)?%|from|to
194+ scope: entity.other.animation-keyframe.stylus
195+ - include: selector-components
197+ scope: entity.other.attribute-name.stylus
199+ (?x) # multi-line regex definition mode
200+ (?<=^|;|{)\s* # starts after begining of line, '{' or ';''
203+ [a-zA-Z0-9_-] # then a letter
205+ (\{(.*?)\}) # interpolation
207+ (/\*.*?\*/) # comment
210+ \s*[:\s]\s* # value is separted by colon or space
212+ (?!(\s*\{)) # if there are only spaces afterwards
215+ [^}]*? # checking for an unclosed curly braces on this
216+ \{ # line because if one exists it means that
217+ [^}]* # this is a selector and not a property
222+ - match: '(?=\}|;)|(?<!,)\s*\n'
225+ - include: interpolation
226+ - match: '(?<!^|;|{)\s*(?:(:)|\s)'
228+ 1: punctuation.separator.key-value.stylus
230+ - match: '(;)|(?=\})|(?=(?<!\,)\s*\n)'
232+ 1: punctuation.terminator.rule.stylus
235+ - include: expression
236+ - match: "-(moz|o|ms|webkit|khtml)-"
237+ scope: support.type.vendor-prefix.stylus
239+ scope: meta.property-name.stylus support.type.property-name.stylus
240+ - match: '@extends?\s'
242+ 0: keyword.language.stylus
246+ - include: selector-components
247+ - include: string-quoted
249+ - include: language-constants
250+ - include: language-operators
251+ - include: language-keywords
252+ - include: property-reference
253+ - include: function-call
255+ scope: punctuation.section.start.stylus
257+ scope: punctuation.section.end.stylus
259+ - match: '\[(?=[^\]]*\])'
261+ 0: punctuation.definition.entity.start.stylus
263+ - meta_scope: meta.attribute-selector.stylus
266+ 0: punctuation.definition.entity.end.stylus
268+ - match: '(?<=\[)|(?<=\{)'
270+ - match: '(?=[|~=\]\s])'
272+ - include: interpolation
275+ 0: entity.other.attribute-name.stylus
276+ - include: interpolation
279+ 1: keyword.operator.stylus
280+ - include: string-quoted
283+ 0: string.unquoted.stylus
285+ - match: \b(aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow)\b
286+ scope: constant.color.w3c-standard-color-name.stylus
287+ - match: (hsla?|rgba?)\s*(\()
289+ 1: keyword.language.function.misc.stylus
290+ 2: punctuation.definition.parameters.start.stylus
294+ 0: punctuation.definition.parameters.end.stylus
297+ (?x) # multi-line regex definition mode
299+ (?:0*((?:1?[0-9]{1,2})|(?:2(?:[0-4][0-9]|5[0-5])))\s*(,)\s*)
300+ (?:0*((?:1?[0-9]{1,2})|(?:2(?:[0-4][0-9]|5[0-5])))\s*(,)\s*)
301+ (?:0*((?:1?[0-9]{1,2})|(?:2(?:[0-4][0-9]|5[0-5])))\b)
303+ 1: constant.other.color.rgb-value.stylus constant.other.color.rgb-value.red.stylus
304+ 2: punctuation.delimiter.comma.stylus
305+ 3: constant.other.color.rgb-value.stylus constant.other.color.rgb-value.green.stylus
306+ 4: punctuation.delimiter.comma.stylus
307+ 5: constant.other.color.rgb-value.stylus constant.other.color.rgb-value.blue.stylus
309+ (?x) # multi-line regex definition mode
311+ ((?:[0-9]{1,2}|100)%)(,) # red
313+ ((?:[0-9]{1,2}|100)%)(,) # green
315+ ((?:[0-9]{1,2}|100)%) # blue
317+ 1: constant.other.color.rgb-value.stylus constant.other.color.rgb-value.red.stylus
318+ 2: punctuation.delimiter.comma.stylus
319+ 3: constant.other.color.rgb-value.stylus constant.other.color.rgb-value.green.stylus
320+ 4: punctuation.delimiter.comma.stylus
321+ 5: constant.other.color.rgb-value.stylus constant.other.color.rgb-value.blue.stylus
323+ (?x) # multi-line regex definition mode
324+ (?:\s*(,)\s*((0?\.[0-9]+)|[0-1]))?
326+ 1: punctuation.delimiter.comma.stylus
327+ 2: constant.other.color.rgb-value.stylus constant.other.color.rgb-value.alpha.stylus
328+ - include: numeric-values
329+ - include: numeric-values
332+ scope: punctuation.delimiter.comma.stylus
334+ - include: single-line-comment
337+ 0: punctuation.definition.comment.stylus
339+ - meta_scope: comment.block.stylus
342+ 0: punctuation.definition.comment.stylus
345+ - match: '(^\s*|\s+)(if|unless|else)(?=[\s({]|$)\s*'
347+ 2: keyword.control.stylus
351+ - include: expression
354+ scope: constant.character.escape.stylus
356+ - include: single-line-comment
358+ - include: iteration
359+ - include: conditionals
360+ - include: language-operators
361+ - include: language-keywords
362+ - include: hash-definition
363+ - include: color-values
365+ - include: function-call
366+ - include: string-quoted
368+ - include: hash-access
369+ - include: language-constants
370+ - include: language-property-value-constants
371+ - include: property-reference
374+ - match: '([\w$-]+)(\()'
376+ 1: entity.function-name.stylus
377+ 2: punctuation.definition.parameters.start.stylus
379+ - meta_scope: meta.function-call.stylus
382+ 1: punctuation.definition.parameters.end.stylus
384+ - include: expression
386+ - match: '(?=[\w$-]+(?:\.|\[[^\]=]*\]))'
388+ - meta_scope: meta.hash-access.stylus
389+ - match: '(?=[^''''""\[\]\w.$-]|\s|$)'
392+ scope: punctuation.delimiter.hash.stylus
394+ scope: punctuation.definition.entity.start.stylus
396+ scope: punctuation.definition.entity.end.stylus
397+ - include: string-quoted
402+ 0: punctuation.section.embedded.start.stylus
404+ - meta_scope: meta.hash.stylus
407+ 0: punctuation.section.embedded.end.stylus
409+ - include: single-line-comment
423+ 1: support.type.property-name.stylus
424+ 2: string.quoted.single.stylus
425+ 3: string.quoted.double.stylus
426+ 4: punctuation.separator.key-value.stylus
428+ - match: '(;)|(?=\}|$)'
430+ 1: punctuation.terminator.statement.stylus
432+ - include: expression
436+ 0: punctuation.section.embedded.start.stylus
438+ - meta_scope: stylus.embedded.source
441+ 0: punctuation.section.embedded.end.stylus
443+ - include: expression
445+ - match: (^\s*|\s+)(for)\s+(?=.*?\s+in\s+)
447+ 2: keyword.control.stylus
451+ - include: expression
453+ - match: \b(true|false|null)\b
454+ scope: constant.language.stylus
456+ - match: (\b|\s)(return|else)\b
457+ scope: keyword.control.stylus
458+ - match: (\b|\s)(!important|in|is defined|is a)\b
459+ scope: keyword.other.stylus
460+ - match: \barguments\b
461+ scope: variable.language.stylus
463+ - match: ((?:\?|:|!|~|\+|-|(?:\*)?\*|\/|%|(\.)?\.\.|<|>|(?:=|:|\?|\+|-|\*|\/|%|<|>)?=|!=)|\b(?:in|is(?:nt)?|(?<!:)not)\b)
464+ scope: keyword.operator.stylus
465+ language-property-value-constants:
466+ - match: \b(absolute|all(-scroll)?|always|armenian|auto|avoid|baseline|below|bidi-override|block|bold(er)?|(border|content|padding)-box|both|bottom|break-all|break-word|capitalize|center|char|circle|cjk-ideographic|col-resize|collapse|crosshair|cursive|dashed|decimal-leading-zero|decimal|default|disabled|disc|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ellipsis|fantasy|fixed|geometricPrecision|georgian|groove|hand|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|inactive|inherit|inline-block|inline|inset|inside|inter-ideograph|inter-word|italic|justify|katakana-iroha|katakana|keep-all|left|lighter|line-edge|line-through|line|list-item|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|medium|middle|move|monospace|n-resize|ne-resize|newspaper|no-drop|no-repeat|nw-resize|none|normal|not-allowed|nowrap|oblique|optimize(Legibility|Quality|Speed)|outset|outside|overline|pointer|pre(-(wrap|line))?|progress|relative|repeat-x|repeat-y|repeat|right|ridge|row-resize|rtl|(sans-)?serif|s-resize|scroll|se-resize|separate|small-caps|solid|square|static|strict|sub|super|sw-resize|table(-(row|cell|footer-group|header-group))?|tb-rl|text-bottom|text-top|text|thick|thin|top|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|vertical(-(ideographic|text))?|visible(Painted|Fill|Stroke)?|w-resize|wait|whitespace|zero|smaller|larger|((xx?-)?(small(er)?|large(r)?))|painted|fill|stroke)\b
467+ scope: constant.property-value.stylus
469+ - match: '\s*(?![{;]|$)'
471+ - meta_scope: meta.at-rule.media.stylus
472+ - match: '\s*(?=[{;]|$)'
474+ - match: '(?i)\s*(only|not)?\s*(all|aural|braille|embossed|handheld|print|projection|screen|tty|tv)?(?![\w\d$-]+)'
476+ 1: keyword.operator.logic.media.stylus
477+ 2: support.constant.media.stylus
479+ - match: '\s*(?:(,)|(?=[{;]|$))'
481+ - include: media-query-list
484+ - match: \s*(and)?\s*(\()\s*
486+ 1: keyword.operator.logic.media.stylus
487+ 2: punctuation.definition.parameters.start.stylus
491+ 0: punctuation.definition.parameters.end.stylus
493+ - include: media-query-properties
494+ - include: numeric-values
495+ media-query-properties:
498+ 0: punctuation.separator.key-value.stylus
504+ ((device-)?(height|width|aspect-ratio))|
505+ (color(-index)?)|monochrome|resolution
507+ )|grid|scan|orientation
509+ 0: support.type.property-name.media.stylus
510+ - match: \b(portrait|landscape|progressive|interlace)\b
512+ 1: support.constant.property-value.stylus
515+ (?x) # multi-line regex definition mode
526+ scope: constant.other.color.rgb-value.stylus
528+ 1: punctuation.definition.constant.stylus
529+ 2: constant.other.color.rgb-value.red.stylus
530+ 3: constant.other.color.rgb-value.green.stylus
531+ 4: constant.other.color.rgb-value.blue.stylus
532+ 5: constant.other.color.rgb-value.alpha.stylus
533+ 6: constant.other.color.rgb-value.red.stylus
534+ 7: constant.other.color.rgb-value.green.stylus
535+ 8: constant.other.color.rgb-value.blue.stylus
536+ 9: constant.other.color.rgb-value.alpha.stylus
538+ (?x) # multi-line regex definition mode
539+ (?:-|\+)? # negative / positive
542+ [0-9]+ # integer part
543+ (?:\.[0-9]+)? # fraction
545+ (?:\.[0-9]+) # fraction without leading zero
549+ r?em|ex|pc|vw|vh|vmin|vmax|deg|
550+ g?rad|turn|dpi|dpcm|dppx|m?s|k?Hz
552+ scope: constant.numeric.stylus
554+ 1: keyword.other.unit.stylus
557+ scope: variable.other.property.stylus
559+ - match: (:)(active|checked|default|disabled|empty|enabled|first-child|first-of-type|first|fullscreen|focus|hover|indeterminate|in-range|invalid|last-child|last-of-type|left|link|only-child|only-of-type|optional|out-of-range|read-only|read-write|required|right|root|scope|target|valid|visited)\b
560+ scope: entity.other.attribute-name.pseudo-class.stylus
562+ 1: puncutation.definition.entity.stylus
563+ - match: (:?:)(before|after)\b
564+ scope: entity.other.attribute-name.pseudo-element.stylus
566+ 1: puncutation.definition.entity.stylus
567+ - match: (::)(first-letter|first-number|selection)\b
568+ scope: entity.other.attribute-name.pseudo-element.stylus
570+ 1: puncutation.definition.entity.stylus
571+ - match: ((:)dir)\s*(?:(\()(ltr|rtl)?(\)))?
573+ 1: entity.other.attribute-name.pseudo-element.stylus
574+ 2: puncutation.definition.entity.stylus
575+ 3: puncutation.definition.parameters.start.stylus
576+ 4: constant.language.stylus
577+ 5: puncutation.definition.parameters.end.stylus
578+ - match: ((:)lang)\s*(?:(\()(\w+(-\w+)?)?(\)))?
580+ 1: entity.other.attribute-name.pseudo-element.stylus
581+ 2: puncutation.definition.entity.stylus
582+ 3: puncutation.definition.parameters.start.stylus
583+ 4: constant.language.stylus
584+ 5: puncutation.definition.parameters.end.stylus
585+ - include: pseudo-nth
586+ - include: pseudo-not
588+ - match: ((:)not)\s*(\()
590+ 1: entity.other.attribute-name.pseudo-element.stylus
591+ 2: puncutation.definition.entity.stylus
592+ 3: puncutation.definition.parameters.start.stylus
596+ 0: puncutation.definition.parameters.end.stylus
598+ - include: selector-components
600+ - match: ((:)(?:nth-child|nth-last-child|nth-of-type|nth-last-of-type|nth-match|nth-last-match|nth-column|nth-last-column))\s*(\()
602+ 1: entity.other.attribute-name.pseudo-class.stylus
603+ 2: puncutation.definition.entity.stylus
604+ 3: puncutation.definition.parameters.start.stylus
608+ 0: puncutation.definition.parameters.end.stylus
610+ - include: language-operators
611+ - include: interpolation
612+ - match: \b(odd|even)\b
613+ scope: constant.language.stylus
614+ - match: \b(\d+)?n\b
615+ scope: variable.language.stylus
617+ 1: constant.numeric.stylus
619+ scope: constant.numeric.stylus
621+ - match: ^\s*(return)
623+ 1: keyword.control.stylus
627+ 1: punctuation.terminator.statement.stylus
629+ - include: expression
630+ selector-components:
632+ - include: interpolation
633+ - include: attribute-selector
635+ - match: '\$[\w$-]+\b'
636+ scope: entity.other.placeholder.stylus
638+ scope: keyword.operator.selector.stylus
640+ (?x) # multi-line regex definition mode
642+ altGlyph|altGlyphDef|altGlyphItem|animate|animateColor|
643+ animateMotion|animateTransform|circle|clipPath|color-profile|
644+ defs|desc|ellipse|feBlend|feColorMatrix|
645+ feComponentTransfer|feComposite|feConvolveMatrix|
646+ feDiffuseLighting|feDisplacementMap|feDistantLight|feFlood|
647+ feFuncA|feFuncB|feFuncG|feFuncR|feGaussianBlur|feImage|feMerge|
648+ feMergeNode|feMorphology|feOffset|fePointLight|
649+ feSpecularLighting|feSpotLight|feTile|feTurbulence|filter|
650+ font-face|font-face-format|font-face-name|font-face-src|
651+ font-face-uri|foreignObject|g|glyph|glyphRef|hkern|image|line|
652+ linearGradient|marker|mask|metadata|missing-glyph|mpath|path|
653+ pattern|polygon|polyline|radialGradient|rect|set|stop|svg|
654+ switch|symbol|text|textPath|tref|tspan|use|view|vkern|
655+ a|abbr|acronym|address|applet|area|article|aside|audio|b|base|
656+ basefont|bdi|bdo|bgsound|big|blink|blockquote|body|br|button|
657+ canvas|caption|center|cite|code|col|colgroup|content|data|
658+ datalist|dd|decorator|del|details|dfn|dir|div|dl|dt|element|
659+ em|embed|fieldset|figcaption|figure|font|footer|form|frame|
660+ frameset|h1|h2|h3|h4|h5|h6|head|header|hgroup|hr|html|i|iframe|
661+ img|input|ins|isindex|kbd|keygen|label|legend|li|link|listing|
662+ main|map|mark|marquee|menu|menuitem|meta|meter|nav|nobr|
663+ noframes|noscript|object|ol|optgroup|option|output|p|param|
664+ plaintext|pre|progress|q|rp|rt|ruby|s|samp|script|section|
665+ select|shadow|small|source|spacer|span|strike|strong|style|
666+ sub|summary|sup|table|tbody|td|template|textarea|tfoot|th|
667+ thead|time|title|tr|track|tt|u|ul|var|video|wbr|xmp
669+ scope: entity.name.tag.stylus
670+ - match: '\.[a-zA-Z0-9_-]+'
671+ scope: entity.other.attribute-name.class.stylus
672+ - match: "#[a-zA-Z0-9_-]+"
673+ scope: entity.other.attribute-name.id.stylus
675+ (?x) # multi-line regex definition mode
676+ ([\w\d_-]+)? # matching any word right before &
677+ (&) # & itself, escaped because of plist
678+ ([\w\d_-]+)? # matching any word right after &
680+ 1: entity.other.attribute-name.stylus
681+ 2: variable.language.stylus
682+ 3: entity.other.attribute-name.stylus
683+ single-line-comment:
685+ scope: comment.line.stylus
687+ 1: punctuation.definition.comment.stylus
690+ scope: string.quoted.single.stylus
692+ scope: string.quoted.double.stylus
694+ - match: (url)\s*(\()
696+ 1: entity.function-name.stylus
697+ 2: punctuation.definition.parameters.start.stylus
699+ - meta_scope: meta.function-call.stylus
702+ 1: punctuation.definition.parameters.end.stylus
704+ - include: string-quoted
705+ - include: language-constants
706+ - include: language-property-value-constants
707+ - include: property-reference
710+ - match: '([\w$-]+\b)'
711+ scope: variable.other.stylus