genkit 0.3.1

A common generator kit for static site generator.
Documentation
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
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
%YAML 1.2
---
# http://www.sublimetext.com/docs/3/syntax.html
name: Stylus
file_extensions:
  - styl
  - stylus
scope: source.stylus
contexts:
  main:
    - include: comments
    - match: '^\s*(@(?:import|charset|css|font-face|(?:-webkit-)?keyframes)(?:\s+([\w-]+))?)\b'
      captures:
        1: keyword.control.at-rule.other.stylus
        2: variable.other.animation-name.stylus
      push:
        - match: '$|;|(?=\{)'
          pop: true
        - include: string-quoted
    - match: ^\s*(@media)\s*
      captures:
        1: keyword.control.at-rule.media.stylus
      push:
        - match: '$|(?=\{)'
          pop: true
        - include: media-query
    - match: |-
        (?x)
        (?<=^|;|})
        \s*
        (?=
            [\[\]'".\w$-]+
            \s*
            ([?:]?=)
            (?![^\[]*\])
        )
      push:
        - match: $|;
          pop: true
        - include: expression
    - include: iteration
    - include: conditionals
    - include: return
    - match: |-
        (?x)            # multi-line regex definition mode

        ^(\s*)          # starts at the beginning of line
        ([\w$-]+)       # identifier (name)
        (\()            # start of argument list
        (?=
            .*?
            \)\s*\{     # we see a curly brace afterwards
        )               # which means this is a function definition
      captures:
        2: entity.name.function.stylus
        3: punctuation.definition.parameters.start.stylus
      push:
        - meta_scope: meta.function-call.stylus
        - match: (\))
          captures:
            1: punctuation.definition.parameters.end.stylus
          pop: true
        - include: expression
    - match: |-
        (?x)                # multi-line regex definition mode
        (

            (^|;)           # starts at the beginning of line or at a ;
            \s*
            (\+?\s*         # for block mixins
             [\w$-]+)       # identifier (name)
            (\()            # start of argument list
            (?=
                .*?
                \)\s*;?\s*  # if there are only spaces and semicolons
                $|;         # then this a
            )
        )
      captures:
        3: entity.other.attribute-name.mixin.stylus
        4: punctuation.definition.parameters.start.stylus
      push:
        - meta_scope: meta.function-call.stylus
        - match: (\))
          captures:
            1: punctuation.definition.parameters.end.stylus
          pop: true
        - include: expression
    - match: |-
        (?x) # multi-line regex definition mode
        (^|(?<=\*/|\}))\s*
        (?=
            font(?!
                \s*:\s
                |
                -
                |
                .*?
                (?:
                    \/|normal|bold|light(er?)|serif|sans|monospace|
                    \b\d+(?:\b|px|r?em|%)|
                    var\s*\(|
                    ['"][^\]]*$
                )
            ) | # we need to distinguish between tag and property `cursor`
            cursor(?!
                \s*[:;]\s
                |
                -
                |
                .*?
                (?:
                    (?:url\s*\()|
                    (?:-moz-|-webkit-|-ms-)?
                    (?:auto|default|none|context-menu|help|pointer|progress|
                    wait|cell|crosshair|text|vertical-text|alias|copy|
                    move|no-drop|not-allowed|e-resize|n-resize|ne-resize|
                    nw-resize|s-resize|se-resize|sw-resize|w-resize|
                    ew-resize|ns-resize|nesw-resize|nwse-resize|col-resize|
                    row-resize|all-scroll|zoom-in|zoom-out|grab|grabbing
                    normal|bold|light(er?)|serif|sans|monospace)
                )
            ) | (
                (
                altGlyph|altGlyphDef|altGlyphItem|animate|animateColor|
                animateMotion|animateTransform|circle|clipPath|color-profile|
                defs|desc|ellipse|feBlend|feColorMatrix|
                feComponentTransfer|feComposite|feConvolveMatrix|
                feDiffuseLighting|feDisplacementMap|feDistantLight|feFlood|
                feFuncA|feFuncB|feFuncG|feFuncR|feGaussianBlur|feImage|feMerge|
                feMergeNode|feMorphology|feOffset|fePointLight|
                feSpecularLighting|feSpotLight|feTile|feTurbulence|filter|
                font-face|font-face-format|font-face-name|font-face-src|
                font-face-uri|foreignObject|g|glyph|glyphRef|hkern|image|line|
                linearGradient|marker|mask|metadata|missing-glyph|mpath|path|
                pattern|polygon|polyline|radialGradient|rect|set|stop|svg|
                switch|symbol|text|textPath|tref|tspan|use|view|vkern|
                a|abbr|acronym|address|applet|area|article|aside|audio|b|base|
                basefont|bdi|bdo|bgsound|big|blink|blockquote|body|br|button|
                canvas|caption|center|cite|code|col|colgroup|data|
                datalist|dd|decorator|del|details|dfn|dir|div|dl|dt|element|
                em|embed|fieldset|figcaption|figure|footer|form|frame|
                frameset|h1|h2|h3|h4|h5|h6|head|header|hgroup|hr|html|i|iframe|
                img|input|ins|isindex|kbd|keygen|label|legend|li|link|listing|
                main|map|mark|marquee|menu|menuitem|meta|meter|nav|nobr|
                noframes|noscript|object|ol|optgroup|option|output|p|param|
                plaintext|pre|progress|q|rp|rt|ruby|s|samp|script|section|
                select|shadow|small|source|spacer|span|strike|strong|style|
                sub|summary|sup|table|tbody|td|template|textarea|tfoot|th|
                thead|time|title|tr|track|tt|u|ul|var|video|wbr|xmp)

                \s*([\s,.#\[]|:[^\s]|(?=\{|$))

            ) | (
                [:~>\[*\/]       # symbols but they are valid for selector

            ) | (

                \+\s*[\w$-]+\b\s*      # are an identifier starting with $
                (?!\()              # and they can't have anything besides

            ) | (                    # for animtions

                \d+(\.\d+)?%|(from|to)\b

            ) | (                   # Placeholder selectors

                \$[\w$-]+\b\s*      # are an identifier starting with $
                (?=$|\{)            # and they can't have anything besides

            ) | (                   # CSS class

                \.[a-zA-Z0-9_-]+

            ) | (                   # CSS id

                \#[a-zA-Z0-9_-]+

            ) | (                   # Reference to parent

                ([\w\d_-]+)?        # matching any word right before &
                (&)             # & itself, escaped because of plist
                ([\w\d_-]+)?        # matching any word right after &
            )
        )
      push:
        - meta_scope: meta.selector.stylus
        - match: |-

            |$|(?=\{\s*\}.*$)|(?=\{.*?[:;])|(?=\{)(?!.+\}.*$)
          pop: true
        - include: comma
        - match: \d+(\.\d+)?%|from|to
          scope: entity.other.animation-keyframe.stylus
        - include: selector-components
        - match: .
          scope: entity.other.attribute-name.stylus
    - match: |-
        (?x)                # multi-line regex definition mode
        (?<=^|;|{)\s*    # starts after begining of line, '{' or ';''
        (?=                 # lookahead for
            (
             [a-zA-Z0-9_-]  # then a letter
             |              # or
             (\{(.*?)\})    # interpolation
             |              # or
             (/\*.*?\*/)    # comment
            )+

            \s*[:\s]\s*     # value is separted by colon or space

            (?!(\s*\{))     # if there are only spaces afterwards

            (?!
                [^}]*?      # checking for an unclosed curly braces on this
                \{          # line because if one exists it means that
                [^}]*       # this is a selector and not a property
                ($|\})
            )
        )
      push:
        - match: '(?=\}|;)|(?<!,)\s*\n'
          pop: true
        - include: comments
        - include: interpolation
        - match: '(?<!^|;|{)\s*(?:(:)|\s)'
          captures:
            1: punctuation.separator.key-value.stylus
          push:
            - match: '(;)|(?=\})|(?=(?<!\,)\s*\n)'
              captures:
                1: punctuation.terminator.rule.stylus
              pop: true
            - include: comments
            - include: expression
        - match: "-(moz|o|ms|webkit|khtml)-"
          scope: support.type.vendor-prefix.stylus
        - match: .
          scope: meta.property-name.stylus support.type.property-name.stylus
    - match: '@extends?\s'
      captures:
        0: keyword.language.stylus
      push:
        - match: (?=$|;)
          pop: true
        - include: selector-components
    - include: string-quoted
    - include: escape
    - include: language-constants
    - include: language-operators
    - include: language-keywords
    - include: property-reference
    - include: function-call
    - match: '\{'
      scope: punctuation.section.start.stylus
    - match: '\}'
      scope: punctuation.section.end.stylus
  attribute-selector:
    - match: '\[(?=[^\]]*\])'
      captures:
        0: punctuation.definition.entity.start.stylus
      push:
        - meta_scope: meta.attribute-selector.stylus
        - match: '\]'
          captures:
            0: punctuation.definition.entity.end.stylus
          pop: true
        - match: '(?<=\[)|(?<=\{)'
          push:
            - match: '(?=[|~=\]\s])'
              pop: true
            - include: interpolation
            - match: .
              captures:
                0: entity.other.attribute-name.stylus
        - include: interpolation
        - match: "([|~]?=)"
          captures:
            1: keyword.operator.stylus
        - include: string-quoted
        - match: .
          captures:
            0: string.unquoted.stylus
  color-values:
    - match: \b(aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow)\b
      scope: constant.color.w3c-standard-color-name.stylus
    - match: (hsla?|rgba?)\s*(\()
      captures:
        1: keyword.language.function.misc.stylus
        2: punctuation.definition.parameters.start.stylus
      push:
        - match: \)
          captures:
            0: punctuation.definition.parameters.end.stylus
          pop: true
        - match: |-
            (?x) # multi-line regex definition mode
            \b
            (?:0*((?:1?[0-9]{1,2})|(?:2(?:[0-4][0-9]|5[0-5])))\s*(,)\s*)
            (?:0*((?:1?[0-9]{1,2})|(?:2(?:[0-4][0-9]|5[0-5])))\s*(,)\s*)
            (?:0*((?:1?[0-9]{1,2})|(?:2(?:[0-4][0-9]|5[0-5])))\b)
          captures:
            1: constant.other.color.rgb-value.stylus constant.other.color.rgb-value.red.stylus
            2: punctuation.delimiter.comma.stylus
            3: constant.other.color.rgb-value.stylus constant.other.color.rgb-value.green.stylus
            4: punctuation.delimiter.comma.stylus
            5: constant.other.color.rgb-value.stylus constant.other.color.rgb-value.blue.stylus
        - match: |-
            (?x) # multi-line regex definition mode
            \b
            ((?:[0-9]{1,2}|100)%)(,) # red
            \s*
            ((?:[0-9]{1,2}|100)%)(,) # green
            \s*
            ((?:[0-9]{1,2}|100)%)    # blue
          captures:
            1: constant.other.color.rgb-value.stylus constant.other.color.rgb-value.red.stylus
            2: punctuation.delimiter.comma.stylus
            3: constant.other.color.rgb-value.stylus constant.other.color.rgb-value.green.stylus
            4: punctuation.delimiter.comma.stylus
            5: constant.other.color.rgb-value.stylus constant.other.color.rgb-value.blue.stylus
        - match: |-
            (?x) # multi-line regex definition mode
            (?:\s*(,)\s*((0?\.[0-9]+)|[0-1]))?
          captures:
            1: punctuation.delimiter.comma.stylus
            2: constant.other.color.rgb-value.stylus constant.other.color.rgb-value.alpha.stylus
        - include: numeric-values
    - include: numeric-values
  comma:
    - match: \s*,\s*
      scope: punctuation.delimiter.comma.stylus
  comments:
    - include: single-line-comment
    - match: \/\*
      captures:
        0: punctuation.definition.comment.stylus
      push:
        - meta_scope: comment.block.stylus
        - match: \*\/
          captures:
            0: punctuation.definition.comment.stylus
          pop: true
  conditionals:
    - match: '(^\s*|\s+)(if|unless|else)(?=[\s({]|$)\s*'
      captures:
        2: keyword.control.stylus
      push:
        - match: '(?=$|\{)'
          pop: true
        - include: expression
  escape:
    - match: \\.
      scope: constant.character.escape.stylus
  expression:
    - include: single-line-comment
    - include: comma
    - include: iteration
    - include: conditionals
    - include: language-operators
    - include: language-keywords
    - include: hash-definition
    - include: color-values
    - include: url
    - include: function-call
    - include: string-quoted
    - include: escape
    - include: hash-access
    - include: language-constants
    - include: language-property-value-constants
    - include: property-reference
    - include: variable
  function-call:
    - match: '([\w$-]+)(\()'
      captures:
        1: entity.function-name.stylus
        2: punctuation.definition.parameters.start.stylus
      push:
        - meta_scope: meta.function-call.stylus
        - match: (\))
          captures:
            1: punctuation.definition.parameters.end.stylus
          pop: true
        - include: expression
  hash-access:
    - match: '(?=[\w$-]+(?:\.|\[[^\]=]*\]))'
      push:
        - meta_scope: meta.hash-access.stylus
        - match: '(?=[^''''""\[\]\w.$-]|\s|$)'
          pop: true
        - match: \.
          scope: punctuation.delimiter.hash.stylus
        - match: '\['
          scope: punctuation.definition.entity.start.stylus
        - match: '\]'
          scope: punctuation.definition.entity.end.stylus
        - include: string-quoted
        - include: variable
  hash-definition:
    - match: '\{'
      captures:
        0: punctuation.section.embedded.start.stylus
      push:
        - meta_scope: meta.hash.stylus
        - match: '\}'
          captures:
            0: punctuation.section.embedded.end.stylus
          pop: true
        - include: single-line-comment
        - match: |-
            (?x)
            (?:
                ([\w$-]+)
                |
                ('[^']*')
                |
                ("[^"]*")
            )
            \s*
            (:)
            \s*
          captures:
            1: support.type.property-name.stylus
            2: string.quoted.single.stylus
            3: string.quoted.double.stylus
            4: punctuation.separator.key-value.stylus
          push:
            - match: '(;)|(?=\}|$)'
              captures:
                1: punctuation.terminator.statement.stylus
              pop: true
            - include: expression
  interpolation:
    - match: '\{'
      captures:
        0: punctuation.section.embedded.start.stylus
      push:
        - meta_scope: stylus.embedded.source
        - match: '\}'
          captures:
            0: punctuation.section.embedded.end.stylus
          pop: true
        - include: expression
  iteration:
    - match: (^\s*|\s+)(for)\s+(?=.*?\s+in\s+)
      captures:
        2: keyword.control.stylus
      push:
        - match: '$|\{'
          pop: true
        - include: expression
  language-constants:
    - match: \b(true|false|null)\b
      scope: constant.language.stylus
  language-keywords:
    - match: (\b|\s)(return|else)\b
      scope: keyword.control.stylus
    - match: (\b|\s)(!important|in|is defined|is a)\b
      scope: keyword.other.stylus
    - match: \barguments\b
      scope: variable.language.stylus
  language-operators:
    - match: ((?:\?|:|!|~|\+|-|(?:\*)?\*|\/|%|(\.)?\.\.|<|>|(?:=|:|\?|\+|-|\*|\/|%|<|>)?=|!=)|\b(?:in|is(?:nt)?|(?<!:)not)\b)
      scope: keyword.operator.stylus
  language-property-value-constants:
    - 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
      scope: constant.property-value.stylus
  media-query:
    - match: '\s*(?![{;]|$)'
      push:
        - meta_scope: meta.at-rule.media.stylus
        - match: '\s*(?=[{;]|$)'
          pop: true
        - match: '(?i)\s*(only|not)?\s*(all|aural|braille|embossed|handheld|print|projection|screen|tty|tv)?(?![\w\d$-]+)'
          captures:
            1: keyword.operator.logic.media.stylus
            2: support.constant.media.stylus
          push:
            - match: '\s*(?:(,)|(?=[{;]|$))'
              pop: true
            - include: media-query-list
        - include: variable
  media-query-list:
    - match: \s*(and)?\s*(\()\s*
      captures:
        1: keyword.operator.logic.media.stylus
        2: punctuation.definition.parameters.start.stylus
      push:
        - match: \)
          captures:
            0: punctuation.definition.parameters.end.stylus
          pop: true
        - include: media-query-properties
        - include: numeric-values
  media-query-properties:
    - match: \s*:\s*
      captures:
        0: punctuation.separator.key-value.stylus
    - match: |-
        (?x)
        (
            ((min|max)-)?
            (
                ((device-)?(height|width|aspect-ratio))|
                (color(-index)?)|monochrome|resolution
            )
        )|grid|scan|orientation
      captures:
        0: support.type.property-name.media.stylus
    - match: \b(portrait|landscape|progressive|interlace)\b
      captures:
        1: support.constant.property-value.stylus
  numeric-values:
    - match: |-
        (?x) # multi-line regex definition mode
        (\#)(?:
                ([0-9a-fA-F])
                ([0-9a-fA-F])
                ([0-9a-fA-F])
                ([0-9a-fA-F])?
        |       ([0-9a-fA-F]{2})
                ([0-9a-fA-F]{2})
                ([0-9a-fA-F]{2})
                ([0-9a-fA-F]{2})?
        )\b
      scope: constant.other.color.rgb-value.stylus
      captures:
        1: punctuation.definition.constant.stylus
        2: constant.other.color.rgb-value.red.stylus
        3: constant.other.color.rgb-value.green.stylus
        4: constant.other.color.rgb-value.blue.stylus
        5: constant.other.color.rgb-value.alpha.stylus
        6: constant.other.color.rgb-value.red.stylus
        7: constant.other.color.rgb-value.green.stylus
        8: constant.other.color.rgb-value.blue.stylus
        9: constant.other.color.rgb-value.alpha.stylus
    - match: |-
        (?x)                    # multi-line regex definition mode
        (?:-|\+)?               # negative / positive
        (?:
            (?:
                [0-9]+          # integer part
                (?:\.[0-9]+)?   # fraction
            ) |
            (?:\.[0-9]+)        # fraction without leading zero
        )
        ((?:                    # units
            px|pt|ch|cm|mm|in|
            r?em|ex|pc|vw|vh|vmin|vmax|deg|
            g?rad|turn|dpi|dpcm|dppx|m?s|k?Hz
        )\b|%)?
      scope: constant.numeric.stylus
      captures:
        1: keyword.other.unit.stylus
  property-reference:
    - match: "@[a-z-]+"
      scope: variable.other.property.stylus
  pseudo:
    - 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
      scope: entity.other.attribute-name.pseudo-class.stylus
      captures:
        1: puncutation.definition.entity.stylus
    - match: (:?:)(before|after)\b
      scope: entity.other.attribute-name.pseudo-element.stylus
      captures:
        1: puncutation.definition.entity.stylus
    - match: (::)(first-letter|first-number|selection)\b
      scope: entity.other.attribute-name.pseudo-element.stylus
      captures:
        1: puncutation.definition.entity.stylus
    - match: ((:)dir)\s*(?:(\()(ltr|rtl)?(\)))?
      captures:
        1: entity.other.attribute-name.pseudo-element.stylus
        2: puncutation.definition.entity.stylus
        3: puncutation.definition.parameters.start.stylus
        4: constant.language.stylus
        5: puncutation.definition.parameters.end.stylus
    - match: ((:)lang)\s*(?:(\()(\w+(-\w+)?)?(\)))?
      captures:
        1: entity.other.attribute-name.pseudo-element.stylus
        2: puncutation.definition.entity.stylus
        3: puncutation.definition.parameters.start.stylus
        4: constant.language.stylus
        5: puncutation.definition.parameters.end.stylus
    - include: pseudo-nth
    - include: pseudo-not
  pseudo-not:
    - match: ((:)not)\s*(\()
      captures:
        1: entity.other.attribute-name.pseudo-element.stylus
        2: puncutation.definition.entity.stylus
        3: puncutation.definition.parameters.start.stylus
      push:
        - match: \)
          captures:
            0: puncutation.definition.parameters.end.stylus
          pop: true
        - include: selector-components
  pseudo-nth:
    - match: ((:)(?:nth-child|nth-last-child|nth-of-type|nth-last-of-type|nth-match|nth-last-match|nth-column|nth-last-column))\s*(\()
      captures:
        1: entity.other.attribute-name.pseudo-class.stylus
        2: puncutation.definition.entity.stylus
        3: puncutation.definition.parameters.start.stylus
      push:
        - match: \)
          captures:
            0: puncutation.definition.parameters.end.stylus
          pop: true
        - include: language-operators
        - include: interpolation
        - match: \b(odd|even)\b
          scope: constant.language.stylus
        - match: \b(\d+)?n\b
          scope: variable.language.stylus
          captures:
            1: constant.numeric.stylus
        - match: \d+
          scope: constant.numeric.stylus
  return:
    - match: ^\s*(return)
      captures:
        1: keyword.control.stylus
      push:
        - match: (;)|(?=$)
          captures:
            1: punctuation.terminator.statement.stylus
          pop: true
        - include: expression
  selector-components:
    - include: comments
    - include: interpolation
    - include: attribute-selector
    - include: pseudo
    - match: '\$[\w$-]+\b'
      scope: entity.other.placeholder.stylus
    - match: "[:~>]"
      scope: keyword.operator.selector.stylus
    - match: |-
        (?x) # multi-line regex definition mode
        \b(
            altGlyph|altGlyphDef|altGlyphItem|animate|animateColor|
            animateMotion|animateTransform|circle|clipPath|color-profile|
            defs|desc|ellipse|feBlend|feColorMatrix|
            feComponentTransfer|feComposite|feConvolveMatrix|
            feDiffuseLighting|feDisplacementMap|feDistantLight|feFlood|
            feFuncA|feFuncB|feFuncG|feFuncR|feGaussianBlur|feImage|feMerge|
            feMergeNode|feMorphology|feOffset|fePointLight|
            feSpecularLighting|feSpotLight|feTile|feTurbulence|filter|
            font-face|font-face-format|font-face-name|font-face-src|
            font-face-uri|foreignObject|g|glyph|glyphRef|hkern|image|line|
            linearGradient|marker|mask|metadata|missing-glyph|mpath|path|
            pattern|polygon|polyline|radialGradient|rect|set|stop|svg|
            switch|symbol|text|textPath|tref|tspan|use|view|vkern|
            a|abbr|acronym|address|applet|area|article|aside|audio|b|base|
            basefont|bdi|bdo|bgsound|big|blink|blockquote|body|br|button|
            canvas|caption|center|cite|code|col|colgroup|content|data|
            datalist|dd|decorator|del|details|dfn|dir|div|dl|dt|element|
            em|embed|fieldset|figcaption|figure|font|footer|form|frame|
            frameset|h1|h2|h3|h4|h5|h6|head|header|hgroup|hr|html|i|iframe|
            img|input|ins|isindex|kbd|keygen|label|legend|li|link|listing|
            main|map|mark|marquee|menu|menuitem|meta|meter|nav|nobr|
            noframes|noscript|object|ol|optgroup|option|output|p|param|
            plaintext|pre|progress|q|rp|rt|ruby|s|samp|script|section|
            select|shadow|small|source|spacer|span|strike|strong|style|
            sub|summary|sup|table|tbody|td|template|textarea|tfoot|th|
            thead|time|title|tr|track|tt|u|ul|var|video|wbr|xmp
        )\b
      scope: entity.name.tag.stylus
    - match: '\.[a-zA-Z0-9_-]+'
      scope: entity.other.attribute-name.class.stylus
    - match: "#[a-zA-Z0-9_-]+"
      scope: entity.other.attribute-name.id.stylus
    - match: |-
        (?x)            # multi-line regex definition mode
        ([\w\d_-]+)?    # matching any word right before &
        (&)         # & itself, escaped because of plist
        ([\w\d_-]+)?    # matching any word right after &
      captures:
        1: entity.other.attribute-name.stylus
        2: variable.language.stylus
        3: entity.other.attribute-name.stylus
  single-line-comment:
    - match: (\/\/).*$
      scope: comment.line.stylus
      captures:
        1: punctuation.definition.comment.stylus
  string-quoted:
    - match: "'[^']*'"
      scope: string.quoted.single.stylus
    - match: '"[^"]*"'
      scope: string.quoted.double.stylus
  url:
    - match: (url)\s*(\()
      captures:
        1: entity.function-name.stylus
        2: punctuation.definition.parameters.start.stylus
      push:
        - meta_scope: meta.function-call.stylus
        - match: (\))
          captures:
            1: punctuation.definition.parameters.end.stylus
          pop: true
        - include: string-quoted
        - include: language-constants
        - include: language-property-value-constants
        - include: property-reference
        - include: variable
  variable:
    - match: '([\w$-]+\b)'
      scope: variable.other.stylus