CSS.sublime-syntax (108646B)
1 %YAML 1.2 2 --- 3 # https://www.sublimetext.com/docs/syntax.html 4 # Derived from https://github.com/i-akhmadullin/Sublime-CSS3 5 name: CSS 6 scope: source.css 7 version: 2 8 9 file_extensions: 10 - css 11 - css.erb 12 - css.liquid 13 14 ############################################################################### 15 16 variables: 17 # Basic tokens 18 # https://www.w3.org/TR/css3-selectors/#lex 19 unicode: \\\h{1,6}[ \t\n\f]? 20 escape: (?:{{unicode}}|\\[^\n\f\h]) 21 nmstart: (?:[_[:alpha:][:^ascii:]]|{{escape}}) 22 nmchar: (?:[-_[:alnum:][:^ascii:]]|{{escape}}) 23 24 # Identifier Break 25 # The proper pattern would be (?!{{nmchar}}), but its impact on performance 26 # is just too high, thus several optimizations are applied. 27 # 1. Use positive lookahead with \Z to handle `eof` 28 # 2. Breaks are ascii characters other than denoted by {{nmchar}}. 29 # 3. Assume unicode or escape character if backslash is matched, instead of 30 # matching (?!{{escape}}) which also effects performance negative. 31 break: (?=[[^-_[:alnum:]\\]&&[[:ascii:]]]|\Z) 32 33 # Identifiers 34 # https://www.w3.org/TR/css-syntax-3/#typedef-ident-token 35 # https://www.w3.org/TR/css3-selectors/#lex 36 ident: (?:{{custom_ident}}|{{generic_ident}}) 37 custom_ident: (?:--{{nmchar}}*) 38 generic_ident: (?:-?{{nmstart}}{{nmchar}}*) 39 40 # Ilegal Custom Identifier Names 41 # https://www.w3.org/TR/css-values-4/#custom-idents 42 illegal_custom_ident: |- 43 \b{{illegal_custom_ident_tokens}}{{break}} 44 illegal_custom_ident_tokens: |- 45 (?xi: auto | default | inherit | initial | none | unset ) 46 47 # Types 48 # https://www.w3.org/TR/css3-values/#numeric-types 49 # https://www.w3.org/TR/css-syntax-3/#number-token-diagram 50 integer: ([-+]?)(\d+) 51 float: ([-+]?)(\d*(\.)\d+(?:[eE][-+]?\d+)?|\d+[eE][-+]?\d+) 52 53 # Units 54 # https://www.w3.org/TR/css3-values/#lengths 55 units: |- 56 (?x: 57 % 58 | {{absolute_lengths}} 59 | {{angle_units}} 60 | {{duration_units}} 61 | {{font_relative_lengths}} 62 | {{frequency_units}} 63 | {{resolution_units}} 64 | {{viewport_percentage_lengths}} 65 ) 66 font_relative_lengths: (?i:em|ex|ch|rem)\b 67 viewport_percentage_lengths: (?i:vw|vh|vmin|vmax)\b 68 absolute_lengths: (?i:cm|mm|q|in|pt|pc|px|fr)\b 69 angle_units: (?i:deg|grad|rad|turn)\b 70 duration_units: (?i:s|ms)\b 71 frequency_units: (?i:Hz|kHz)\b 72 resolution_units: (?i:dpi|dpcm|dppx)\b 73 74 # Combinators 75 # https://drafts.csswg.org/selectors-4/#combinators 76 combinators: (?:>{1,3}|[~+]|\|{2}) 77 78 vendor_prefix: -(?:webkit|moz|ms|o)- 79 80 # Custom Element Names 81 # https://html.spec.whatwg.org/multipage/custom-elements.html#custom-elements-core-concepts 82 custom_element_tags: \b[a-z]{{custom_element_chars}}*-{{custom_element_chars}}*{{break}} 83 # Note: Excludes `.` as it is used to identify attribute access 84 custom_element_chars: |- 85 (?x: 86 [-_a-z0-9\x{00B7}] 87 | [\x{00C0}-\x{00D6}] 88 | [\x{00D8}-\x{00F6}] 89 | [\x{00F8}-\x{02FF}] 90 | [\x{0300}-\x{037D}] 91 | [\x{037F}-\x{1FFF}] 92 | [\x{200C}-\x{200D}] 93 | [\x{203F}-\x{2040}] 94 | [\x{2070}-\x{218F}] 95 | [\x{2C00}-\x{2FEF}] 96 | [\x{3001}-\x{D7FF}] 97 | [\x{F900}-\x{FDCF}] 98 | [\x{FDF0}-\x{FFFD}] 99 | [\x{10000}-\x{EFFFF}] 100 ) 101 102 # HTML tags 103 # https://developer.mozilla.org/en-US/docs/Web/HTML/Element 104 # Note: Sections are sorted by expected frequency. 105 html_tags: |- 106 (?x: 107 {{html_inline_tags}} 108 | {{html_text_tags}} 109 | {{html_section_tags}} 110 | {{html_table_tags}} 111 | {{html_embedded_tags}} 112 | {{html_forms_tags}} 113 | {{html_media_tags}} 114 | {{html_interactive_tags}} 115 | {{html_script_tags}} 116 | {{html_web_tags}} 117 | {{html_markup_tags}} 118 | {{html_header_tags}} 119 | {{html_root_tags}} 120 | {{html_deprecated_tags}} 121 ) 122 123 html_root_tags: |- 124 \b(?xi: html | body ){{break}} 125 126 html_header_tags: |- 127 \b(?xi: base | head | link | meta | script | style | title ){{break}} 128 129 html_section_tags: |- 130 \b(?xi: 131 address | article | aside | footer | header | h1 | h2 | h3 | h4 | h5 | h6 132 | hgroup | main | nav | section 133 ){{break}} 134 135 html_text_tags: |- 136 \b(?xi: 137 blockquote | cite | dd | dt | dl | div | figcaption | figure | hr | li 138 | ol | p | pre | ul 139 ){{break}} 140 141 html_inline_tags: |- 142 \b(?xi: 143 a | abbr | b | bdi | bdo | br | code | data | time | dfn | em | i | kbd 144 | mark | q | rb | ruby | rp | rt | rtc | s | samp | small | span | strong 145 | sub | sup | u | var | wbr 146 ){{break}} 147 148 html_media_tags: |- 149 \b(?xi: area | audio | source | img | map | track | video ){{break}} 150 151 html_embedded_tags: |- 152 \b(?xi: embed | iframe | object | param | picture | source ){{break}} 153 154 html_script_tags: |- 155 \b(?xi: canvas | noscript | script ){{break}} 156 157 html_markup_tags: |- 158 \b(?xi: del | ins ){{break}} 159 160 html_table_tags: |- 161 \b(?xi: 162 caption | col | colgroup | table | tbody | tr | td | tfoot | th | thead 163 ){{break}} 164 165 html_forms_tags: |- 166 \b(?xi: 167 button | datalist | option | fieldset | label | form | input | legend 168 | meter | optgroup | select | output | progress | textarea 169 ){{break}} 170 171 html_interactive_tags: |- 172 \b(?xi: details | dialog | menu | summary ){{break}} 173 174 html_web_tags: |- 175 \b(?xi: slot | template ){{break}} 176 177 html_deprecated_tags: |- 178 \b(?xi: 179 acronym | applet | basefont | bgsound | big | blink | center | command 180 | content | dir | element | font | frame | frameset | image | isindex 181 | keygen | listing | marquee | menuitem | multicol | nextid | nobr 182 | noembed | noframes | plaintext | shadow | spacer | strike | tt | xmp 183 ){{break}} 184 185 # SVG tag names 186 # maintained from previous CSS.sublime-syntax 187 svg_tags: |- 188 \b(?xi: 189 circle | clipPath | defs | ellipse | eventsource | filter | foreignObject 190 | g | glyph | glyphRef | line | linearGradient | marker | mask | path 191 | pattern | polygon | polyline | radialGradient | rect | stop | svg 192 | switch | symbol | text | textPath | tref | tspan | use 193 # custom element like tags reserved for SVG/MathML 194 | annotation-xml | color-profile | missing-glyph 195 | font-face(?: -src | -uri | -format | -name )? 196 ){{break}} 197 198 # Predefined Color Values (Standard Set) 199 # https://www.w3.org/TR/CSS22/syndata.html#color-units 200 standard_colors: |- 201 \b(?xi: 202 aqua | black | blue | fuchsia | gray | green | lime | maroon | navy 203 | olive | orange | purple | red | silver | teal | white | yellow 204 ){{break}} 205 206 # Predefined Color Values (Extended Set) 207 # https://www.w3.org/TR/css3-color/#svg-color 208 extended_colors: |- 209 \b(?xi: 210 aliceblue | antiquewhite | aquamarine | azure | beige | bisque 211 | blanchedalmond | blueviolet | brown | burlywood | cadetblue | chartreuse 212 | chocolate | coral | cornflowerblue | cornsilk | crimson | cyan | darkblue 213 | darkcyan | darkgoldenrod | darkgray | darkgreen | darkgrey | darkkhaki 214 | darkmagenta | darkolivegreen | darkorange | darkorchid | darkred 215 | darksalmon | darkseagreen | darkslateblue | darkslategray | darkslategrey 216 | darkturquoise | darkviolet | deeppink | deepskyblue | dimgray | dimgrey 217 | dodgerblue | firebrick | floralwhite | forestgreen | gainsboro 218 | ghostwhite | gold | goldenrod | greenyellow | grey | honeydew | hotpink 219 | indianred | indigo | ivory | khaki | lavender | lavenderblush | lawngreen 220 | lemonchiffon | lightblue | lightcoral | lightcyan | lightgoldenrodyellow 221 | lightgray | lightgreen | lightgrey | lightpink | lightsalmon 222 | lightseagreen | lightskyblue | lightslategray | lightslategrey 223 | lightsteelblue | lightyellow | limegreen | linen | magenta 224 | mediumaquamarine | mediumblue | mediumorchid | mediumpurple 225 | mediumseagreen | mediumslateblue | mediumspringgreen | mediumturquoise 226 | mediumvioletred | midnightblue | mintcream | mistyrose | moccasin 227 | navajowhite | oldlace | olivedrab | orangered | orchid | palegoldenrod 228 | palegreen | paleturquoise | palevioletred | papayawhip | peachpuff | peru 229 | pink | plum | powderblue | rebeccapurple | rosybrown | royalblue 230 | saddlebrown | salmon | sandybrown | seagreen | seashell | sienna 231 | skyblue | slateblue | slategray | slategrey | snow | springgreen 232 | steelblue | tan | thistle | tomato | turquoise | violet | wheat 233 | whitesmoke | yellowgreen 234 ){{break}} 235 236 # Illegal Counter Style Definition Names 237 # https://drafts.csswg.org/css-counter-styles-3/#typedef-counter-style-name 238 counter_style_illegal_names: |- 239 \b(?xi: decimal | disc | {{illegal_custom_ident_tokens}} ){{break}} 240 241 # Predefined Counter Styles 242 # https://drafts.csswg.org/css-counter-styles-3/#predefined-counters 243 counter_style_names: |- 244 \b(?xi: 245 none | arabic-indic | armenian | bengali | cambodian | circle 246 | cjk-decimal | cjk-earthly-branch | cjk-heavenly-stem | decimal-leading-zero 247 | decimal | devanagari | disclosure-closed | disclosure-open | disc 248 | ethiopic-numeric | georgian | gujarati | gurmukhi | hebrew 249 | hiragana-iroha | hiragana | japanese-formal | japanese-informal 250 | kannada | katakana-iroha | katakana | khmer 251 | korean-hangul-formal | korean-hanja-formal | korean-hanja-informal | lao 252 | lower-alpha | lower-armenian | lower-greek | lower-latin | lower-roman 253 | malayalam | mongolian | myanmar | oriya | persian 254 | simp-chinese-formal | simp-chinese-informal 255 | square | tamil | telugu | thai | tibetan 256 | trad-chinese-formal | trad-chinese-informal 257 | upper-alpha | upper-armenian | upper-latin | upper-roman 258 ){{break}} 259 260 # Predefined Counter Speak As Property Constants 261 # https://drafts.csswg.org/css-counter-styles-3/#counter-style-speak-as 262 counter_speak_as_constants: |- 263 \b(?xi: auto | bullets | numbers | words | spell-out ){{break}} 264 265 # Predefined Counter Style System Constants 266 # https://drafts.csswg.org/css-counter-styles-3/#counter-style-system 267 counter_system_constants: |- 268 \b(?xi: cyclic | numeric | alphabetic | symbolic | additive | fixed ){{break}} 269 270 # Page Margin Property Names 271 # https://www.w3.org/TR/css-page-3/#margin-at-rule 272 page_margin_property_names: |- 273 \b(?xi: 274 (?: bottom | top ) - (?: left-corner | left | center | right | right-corner ) 275 | (?: left | right ) - (?: top | middle | bottom ) 276 ){{break}} 277 278 # Property names are sorted by popularity in descending order. 279 # Note: 280 # 1) Popularity data taken from https://www.chromestatus.com/metrics/css/popularity 281 # 2) Properties starting with `alias-` or `webkit-` are removed 282 property_names: |- 283 \b(?xi: 284 width | height | display | position | padding | border | margin | top 285 | left | margin-top | color | font-size | background-color | text-align 286 | opacity | font-weight | font-family | background | overflow | line-height 287 | float | box-sizing | text-decoration | z-index | cursor | margin-left 288 | border-radius | vertical-align | margin-bottom | margin-right | right 289 | padding-top | padding-left | max-width | box-shadow | bottom | content 290 | padding-right | transform | white-space | min-height | padding-bottom 291 | background-image | border-bottom | visibility | outline 292 | background-position | min-width | transition | border-top | border-color 293 | background-repeat | text-transform | background-size | max-height 294 | list-style | clear | font-style | justify-content | border-left 295 | align-items | border-right | border-width | font | text-overflow 296 | overflow-y | pointer-events | border-style | flex-direction | animation 297 | overflow-x | letter-spacing | flex | word-wrap | flex-wrap | fill 298 | transform-origin | list-style-type | border-collapse 299 | border-top-left-radius | border-bottom-left-radius | user-select | clip 300 | text-shadow | border-bottom-right-radius | word-break | flex-grow 301 | border-top-right-radius | border-bottom-color | border-top-color 302 | flex-shrink | align-self | text-rendering | animation-timing-function 303 | direction | background-clip | zoom | border-spacing | text-indent 304 | outline-offset | border-left-color | transition-property | src 305 | border-right-color | animation-name | stroke | touch-action 306 | animation-duration | transition-delay | filter | overflow-wrap 307 | animation-delay | border-bottom-width | variable | font-variant 308 | flex-basis | transition-duration | border-top-width | animation-fill-mode 309 | object-fit | transition-timing-function | will-change | outline-width 310 | order | outline-style | stroke-width | border-right-width | align-content 311 | resize | table-layout | appearance | animation-iteration-count 312 | border-left-width | flex-flow | stroke-dashoffset | stroke-dasharray 313 | backface-visibility | unicode-bidi | unicode-range | border-bottom-style 314 | text-size-adjust | border-top-style | animation-direction | word-spacing 315 | contain | speak | grid-template-columns | font-feature-settings 316 | perspective | list-style-position | clip-path | image-rendering 317 | font-display | transform-style | border-left-style | outline-color 318 | background-position-x | background-attachment | border-right-style 319 | margin-block-end | background-origin | animation-play-state | hyphens 320 | stroke-linecap | font-stretch | object-position | page-break-inside 321 | column-gap | counter-reset | counter-increment | background-position-y 322 | margin-block-start | size | grid-template-rows | column-count | quotes 323 | padding-inline-end | text-decoration-skip | border-image | all 324 | page-break-after | fill-opacity | font-variant-ligatures 325 | scroll-boundary-behavior | empty-cells | list-style-image | justify-self 326 | overflow-anchor | padding-inline-start | grid-gap | text-decoration-color 327 | margin-inline-start | caret-color | grid-column-gap | aspect-ratio 328 | stroke-opacity | margin-inline-end | grid-column | perspective-origin 329 | caption-side | columns | scroll-behavior | justify-items | line-break 330 | grid-row-gap | column-width | orphans | widows | backdrop-filter 331 | mix-blend-mode | tab-size | stop-color | column-rule | grid-area 332 | stroke-miterlimit | text-align-last | page-break-before 333 | grid-column-start | border-image-slice | border-image-repeat 334 | text-decoration-style | border-image-width | grid-column-end | grid-row 335 | scroll-snap-align | scroll-snap-type | border-image-outset 336 | text-decoration-line | column-fill | border-inline-end-width 337 | border-inline-start-width | grid-row-start | stroke-linejoin 338 | inset-inline-end | inset-inline-start | grid-auto-flow | grid-auto-rows 339 | grid-template-areas | border-image-source | fill-rule | font-kerning 340 | grid-row-end | font-variant-numeric | break-inside | shape-outside 341 | color-scheme | shape-image-threshold | scroll-boundary-behavior-y 342 | text-decoration-skip-ink | page | isolation | background-blend-mode 343 | page-orientation | inset | gap | scroll-snap-margin | column-rule-color 344 | place-items | column-rule-style | shape-rendering | content-visibility 345 | grid-auto-columns | scroll-boundary-behavior-x | writing-mode | clip-rule 346 | font-variant-caps | scroll-padding | text-anchor | mask | row-gap 347 | background-repeat-x | intrinsic-size | text-underline-position 348 | font-variant-east-asian | column-span | vector-effect | dominant-baseline 349 | stop-opacity | break-after | grid-template | break-before | mask-type 350 | scroll-snap-stop | border-inline-start-color | border-inline-end-color | r 351 | alignment-baseline | text-decoration-thickness | column-rule-width | d 352 | image-orientation | rx | text-orientation | cx | baseline-shift 353 | scroll-padding-top | padding-block-start | padding-block-end | cy 354 | min-inline-size | inline-size | background-repeat-y | shape-margin 355 | block-size | marker | min-block-size | paint-order | ry 356 | scroll-snap-margin-top | border-block-end-color | border-block-end-width 357 | border-inline-start-style | border-inline-end-style 358 | border-block-end-style | font-variation-settings 359 | border-block-start-width | border-block-start-color 360 | border-block-start-style | place-content | y | x | ruby-position 361 | text-combine-upright | color-interpolation-filters | color-interpolation 362 | color-rendering | transform-box | marker-end | flood-color | marker-start 363 | marker-mid | flood-opacity | lighting-color | forced-color-adjust 364 | buffered-rendering | place-self | offset-path | scroll-padding-left 365 | offset-distance | offset-rotate | text-underline-offset | max-inline-size 366 | max-block-size | border-inline-end | scroll-snap-margin-inline-start 367 | scroll-padding-inline-start | scroll-snap-margin-block-end 368 | scroll-snap-margin-block-start | scroll-padding-block-end 369 | scroll-snap-margin-inline-end | scroll-padding-block-start 370 | scroll-padding-inline-end | font-optical-sizing | grid 371 | scroll-padding-bottom | scroll-snap-margin-left | inset-block-end 372 | overscroll-behavior-block | overscroll-behavior-inline | inset-block-start 373 | scroll-snap-margin-right | scroll-padding-right 374 | scroll-snap-margin-bottom | border-inline-start | margin-inline 375 | border-end-start-radius | border-end-end-radius | margin-block 376 | border-start-start-radius | border-start-end-radius | padding-inline 377 | counter-set | padding-block | border-block-end | offset 378 | border-block-start | inset-inline | inset-block | scroll-snap-margin-block 379 | scroll-padding-inline | scroll-padding-block | scroll-snap-margin-inline 380 | border-block | offset-rotation | border-inline | border-block-color 381 | border-inline-width | border-inline-color | border-block-style 382 | border-block-width | border-inline-style | motion | motion-offset 383 | motion-path | font-size-adjust | text-justify | scale | scrollbar-gutter 384 | animation-timeline | rotate | translate | snap-height | math-style 385 | math-shift | math-depth | offset-anchor | offset-position 386 | glyph-orientation-vertical | internal-callback | text-line-through 387 | text-line-through-color | text-line-through-mode | text-line-through-style 388 | text-line-through-width | text-overline | text-overline-color 389 | text-overline-mode | text-overline-style | text-overline-width 390 | text-underline | text-underline-color | text-underline-mode 391 | text-underline-style | text-underline-width | shape-inside | shape-padding 392 | enable-background | color-profile | glyph-orientation-horizontal | kerning 393 | image-resolution | max-zoom | min-zoom | orientation | user-zoom 394 | mask-source-type | touch-action-delay | scroll-blocks-on | motion-rotation 395 | scroll-snap-points-x | scroll-snap-points-y | scroll-snap-coordinate 396 | scroll-snap-destination | apply-at-rule | viewport-fit | overflow-block 397 | syntax | content-size | intrinsic-block-size | intrinsic-height 398 | intrinsic-inline-size | intrinsic-width | render-subtree 399 | origin-trial-test-property | subtree-visibility 400 | math-superscript-shift-style | start 401 # END OF QUERY RESULTS 402 # BEGIN OF legacy properties which existed before the last query 403 | box-direction | line-box-contain 404 | prefix | mask-image | mask-origin | flex-order | system | speak-as 405 | font-synthesis | line-clamp | flex-negative | blend-mode 406 | font-variant-position | flex-align | column-break-before | negative 407 | flex-item-align | azimuth | user-drag | range | mask-repeat | box-flex 408 | flex-preferred-size | font-language-override | box-align | pad 409 | text-emphasis-color | box-ordinal-group | mask-composite 410 | transform-origin-y | pause | tap-highlight-color | text-fill-color 411 | suffix | text-emphasis-style | transform-origin-x | text-emphasis-position 412 | box-pack | box-decoration-break | box-orient | additive-symbols 413 | text-emphasis | symbols | mask-clip | nbsp-mode | pause-after | pitch 414 | text-height | mask-position | flex-line-pack | perspective-origin-x 415 | mask-size | font-variant-alternates | perspective-origin-y 416 | font-smoothing | overflow-scrolling | flex-positive | pitch-range 417 ){{break}} 418 419 property_value_constants: |- 420 (?x: 421 {{font_display_constants}} 422 | {{font_property_constants}} 423 | {{font_size_constants}} 424 | {{font_style_constants}} 425 | {{unsorted_property_constants}} 426 ) 427 428 unsorted_property_constants: |- 429 \b(?xi: 430 absolute|active|add 431 | all(-(petite|small)-caps|-scroll)? 432 | alpha(betic)? 433 | alternate(-reverse)? 434 | always|annotation|antialiased|at 435 | auto(hiding-scrollbar|-flow)? 436 | avoid(-column|-page|-region)? 437 | background(-color|-image|-position|-size)? 438 | backwards|balance|baseline|below|bevel|bicubic|bidi-override|blink 439 | block-line-height 440 | blur 441 | border(-bottom|-left|-right|-top)?-(color|radius|width|style) 442 | border-(bottom|top)-(left|right)-radius 443 | border-image(-outset|-repeat|-slice|-source|-width)? 444 | border(-bottom|-left|-right|-top|-collapse|-spacing|-box)? 445 | both|bottom 446 | box(-shadow)? 447 | break-(all|word) 448 | brightness 449 | butt(on)? 450 | capitalize 451 | cent(er|ral) 452 | char(acter-variant)? 453 | cjk-ideographic|clip|clone|close-quote 454 | closest-(corner|side) 455 | col-resize|collapse 456 | color(-stop|-burn|-dodge)? 457 | column((-count|-gap|-reverse|-rule(-color|-width)?|-width)|s)? 458 | common-ligatures|condensed|consider-shifts|contain 459 | content(-box|s)? 460 | contextual|contrast|cover 461 | crisp(-e|E)dges 462 | crop 463 | cross(hair)? 464 | da(rken|shed) 465 | default|dense|diagonal-fractions|difference|disabled 466 | discretionary-ligatures|disregard-shifts 467 | distribute(-all-lines|-letter|-space)? 468 | dotted|double|drop-shadow 469 | (nwse|nesw|ns|ew|sw|se|nw|ne|w|s|e|n)-resize 470 | ease(-in-out|-in|-out)? 471 | element|ellipsis|embed|end|EndColorStr|evenodd 472 | exclu(de(-ruby)?|sion) 473 | expanded 474 | (extra|semi|ultra)-(condensed|expanded) 475 | farthest-(corner|side)? 476 | fill(-box|-opacity)? 477 | filter|first|fixed|flat 478 | fit-content 479 | flex((-basis|-end|-grow|-shrink|-start)|box)? 480 | flip|flood-color 481 | font(-size(-adjust)?|-stretch|-weight)? 482 | forwards 483 | from(-image)? 484 | full-width|geometricPrecision|glyphs|gradient|grayscale 485 | grid(-height)? 486 | groove|hand|hanging|hard-light|height|help|hidden|hide 487 | historical-(forms|ligatures) 488 | horizontal(-tb)? 489 | hue 490 | ideograph(-alpha|-numeric|-parenthesis|-space|ic) 491 | inactive|include-ruby|infinite|inherit|initial 492 | inline(-block|-box|-flex(box)?|-line-height|-table)? 493 | inset|inside 494 | inter(-ideograph|-word|sect) 495 | invert|isolat(e|ion) 496 | jis(04|78|83|90) 497 | justify(-all)? 498 | keep-all 499 | landscape|ledger|legal|letter|A[3-5]|(JIS-)?B[4-5]|portrait 500 | last|left|letter-spacing|legacy 501 | light(e[nr]|ing-color) 502 | line(-edge|-height|-through)? 503 | linear(-gradient|RGB)? 504 | lining-nums|list-item|local|loose|lowercase|lr-tb|ltr 505 | lumin(osity|ance)|manual 506 | margin(-bottom|-box|-left|-right|-top)? 507 | marker(-offset|s)? 508 | mathematical 509 | max-(content|height|lines|size|width) 510 | medium|middle 511 | min-(content|height|width) 512 | miter|mixed|move|multiply|newspaper 513 | no-(change|clip|(close|open)-quote|(common|discretionary|historical)-ligatures|contextual|drop|repeat) 514 | none|nonzero|not-allowed|nowrap 515 | offset(-after|-before|-end|-start)? 516 | oldstyle-nums|opacity|open-quote 517 | optimize(Legibility|Precision|Quality|Speed) 518 | order|ordinal|ornaments 519 | outline(-color|-offset|-width)? 520 | outset|outside|over(line|-edge|lay) 521 | padding(-bottom|-box|-left|-right|-top)? 522 | page|painted|paused 523 | perspective-origin 524 | petite-caps|pixelated|pointer 525 | pre(-line|-wrap)? 526 | preserve-3d 527 | progid:DXImageTransform.Microsoft.(Alpha|Blur|dropshadow|gradient|Shadow) 528 | progress 529 | proportional-(nums|width) 530 | radial-gradient|recto|region|relative 531 | repeat(-[xy])? 532 | repeating-(linear|radial)-gradient 533 | replaced|reset-size|reverse|ridge|right 534 | round 535 | row(-resize|-reverse)? 536 | run-in 537 | ruby(-base|-text)?(-container)? 538 | rtl|running|saturat(e|ion)|screen 539 | safe 540 | scroll(-position|bar)? 541 | separate|sepia 542 | scale-down 543 | shape-(image-threshold|margin|outside) 544 | show 545 | sideways(-lr|-rl)? 546 | simplified 547 | slashed-zero|slice 548 | smooth|snap|solid|soft-light 549 | space(-around|-between|-evenly)? 550 | span|sRGB 551 | stack(ed-fractions)? 552 | start(ColorStr)? 553 | static 554 | step-(end|start) 555 | sticky 556 | stop-(color|opacity) 557 | stretch|strict 558 | stroke(-box|-dash(array|offset)|-miterlimit|-opacity|-width)? 559 | style(set)? 560 | stylistic 561 | sub(grid|pixel-antialiased|tract)? 562 | super|swash 563 | table(-caption|-cell|(-column|-footer|-header|-row)-group|-column|-row)? 564 | tabular-nums|tb-rl 565 | text((-bottom|-(decoration|emphasis)-color|-indent|-(over|under|after|before)-edge|-shadow|-size(-adjust)?|-top)|field)? 566 | thi(ck|n) 567 | titling-ca(ps|se) 568 | to[p]? 569 | touch|traditional 570 | transform(-origin)? 571 | under(-edge|line)? 572 | unicase|unsafe|unset|uppercase|upright 573 | use-(glyph-orientation|script) 574 | verso 575 | vertical(-align|-ideographic|-lr|-rl|-text)? 576 | view-box 577 | viewport-fill(-opacity)? 578 | visibility 579 | visible(Fill|Painted|Stroke)? 580 | wait|wavy|weight|whitespace|width|word-spacing 581 | wrap(-reverse)? 582 | z-index|zero 583 | zoom(-in|-out)? 584 ){{break}} 585 586 # https://www.w3.org/TR/css-fonts-4/#font-display-desc 587 font_display_constants: |- 588 \b(?xi: 589 block | swap | fallback | optional 590 ){{break}} 591 592 # Generic Font Families 593 font_family_constants: |- 594 \b(?xi: 595 # CSS 2 fonts 596 # https://www.w3.org/TR/CSS22/fonts.html#generic-font-families 597 sans-serif | serif | cursive | monospace | fantasy 598 # CSS 3 level 4 fonts 599 # https://www.w3.org/TR/2019/WD-css-fonts-4-20191113/#generic-family-value 600 | emoji | math | fangsong | system-ui 601 # https://www.w3.org/TR/2019/WD-css-fonts-4-20191113/#standard-font-families 602 | ui-sans-serif | ui-serif | ui-monospace | ui-rounded 603 ){{break}} 604 605 # https://www.w3.org/TR/CSS22/fonts.html#font-shorthand 606 font_property_constants: |- 607 \b(?xi: 608 caption | icon | menu | message-box | small-caption | status-bar 609 ){{break}} 610 611 # https://www.w3.org/TR/CSS22/fonts.html#font-size-props 612 font_size_constants: |- 613 \b(?xi: 614 larger | large | medium | small | smaller | x{1,2}-(?: large | small ) 615 ){{break}} 616 617 # https://www.w3.org/TR/CSS22/fonts.html#font-boldness 618 # https://www.w3.org/TR/CSS22/fonts.html#font-styling 619 # https://www.w3.org/TR/CSS22/fonts.html#small-caps 620 font_style_constants: |- 621 \b(?xi: 622 normal | bold | bolder | lighter | italic | oblique | small-caps 623 ){{break}} 624 625 ############################################################################### 626 627 contexts: 628 629 main: 630 - include: comments 631 - include: selectors 632 - include: at-rules 633 - include: property-lists 634 - include: rule-terminators 635 - include: illegal-groups 636 637 ###[ COMMENTS ]################################################################ 638 639 comments: 640 # empty block comment 641 - match: (/\*+)(\*/) 642 scope: comment.block.css 643 captures: 644 1: punctuation.definition.comment.begin.css 645 2: punctuation.definition.comment.end.css 646 # normal block comment 647 - match: /\*+ 648 scope: punctuation.definition.comment.begin.css 649 push: comments-content 650 651 comments-content: 652 - meta_scope: comment.block.css 653 - match: \*+/ 654 scope: punctuation.definition.comment.end.css 655 pop: 1 656 - match: ^\s*(\*)(?!/) 657 captures: 658 1: punctuation.definition.comment.css 659 660 ###[ AT RULES ]################################################################ 661 662 at-rules: 663 - include: at-charset 664 - include: at-counter-style 665 - include: at-custom-media 666 - include: at-document 667 - include: at-font-face 668 - include: at-import 669 - include: at-keyframes 670 - include: at-media 671 - include: at-namespace 672 - include: at-page 673 - include: at-page-margin 674 - include: at-supports 675 - include: at-other 676 677 # @charset 678 # https://www.w3.org/TR/css-syntax-3/#at-ruledef-charset 679 at-charset: 680 - match: (@)(?i:charset){{break}} 681 captures: 682 0: keyword.control.directive.css 683 1: punctuation.definition.keyword.css 684 push: at-charset-content 685 686 at-charset-content: 687 - meta_scope: meta.at-rule.charset.css 688 - include: quoted-strings 689 - include: at-rule-end 690 691 # @counter-style 692 # https://drafts.csswg.org/css-counter-styles-3/#the-counter-style-rule 693 at-counter-style: 694 - match: (@)(?i:counter-style){{break}} 695 captures: 696 0: keyword.control.directive.css 697 1: punctuation.definition.keyword.css 698 push: at-counter-style-content 699 700 at-counter-style-content: 701 - meta_scope: meta.at-rule.counter-style.css 702 - include: rule-list 703 - include: at-counter-style-names 704 - include: at-rule-end 705 706 at-counter-style-names: 707 - match: '{{counter_style_illegal_names}}' 708 scope: invalid.illegal.identifier.css 709 - match: '{{ident}}' 710 scope: entity.other.counter-style-name.css 711 712 # @custom-media 713 # https://?? 714 at-custom-media: 715 - match: (@)(?i:custom-media){{break}} 716 captures: 717 0: keyword.control.directive.css 718 1: punctuation.definition.keyword.css 719 push: 720 - at-custom-media-content 721 - at-custom-media-identifier 722 723 at-custom-media-identifier: 724 - match: '{{custom_ident}}' 725 scope: entity.other.custom-media.css 726 pop: 1 727 - include: comments 728 - include: else-pop 729 730 at-custom-media-content: 731 - meta_scope: meta.at-rule.custom-media.css 732 - include: media-queries 733 - include: at-rule-end 734 735 # @document 736 # https://www.w3.org/TR/2012/WD-css3-conditional-20120911/#at-document 737 at-document: 738 - match: (@)(?i:document){{break}} 739 captures: 740 0: keyword.control.directive.css 741 1: punctuation.definition.keyword.css 742 push: at-document-content 743 744 at-document-content: 745 - meta_scope: meta.at-rule.document.css 746 - include: comma-delimiters 747 - include: url-functions 748 - include: at-document-functions 749 - include: at-rule-block 750 - include: at-rule-end 751 752 # @font-face 753 # https://www.w3.org/TR/css-fonts-4/#at-font-face-rule 754 at-font-face: 755 - match: (@)(?i:font-face){{break}} 756 captures: 757 0: keyword.control.directive.css 758 1: punctuation.definition.keyword.css 759 push: at-font-face-content 760 761 at-font-face-content: 762 - meta_scope: meta.at-rule.font-face.css 763 - include: rule-list 764 - include: at-rule-end 765 766 # @import 767 # https://www.w3.org/TR/css-cascade-4/#at-ruledef-import 768 at-import: 769 - match: (@)(?i:import){{break}} 770 captures: 771 0: keyword.control.directive.css 772 1: punctuation.definition.keyword.css 773 push: at-import-content 774 775 at-import-content: 776 - meta_scope: meta.at-rule.import.css 777 - include: quoted-strings 778 - include: url-functions 779 - include: media-queries 780 - include: at-rule-end 781 782 # @keyframes 783 # https://www.w3.org/TR/css3-animations/#at-ruledef-keyframes 784 at-keyframes: 785 - match: (@)(?i:keyframes){{break}} 786 captures: 787 0: keyword.control.directive.css 788 1: punctuation.definition.keyword.css 789 push: at-keyframe-content 790 791 at-keyframe-content: 792 - meta_scope: meta.at-rule.keyframe.css 793 - include: comma-delimiters 794 - include: at-keyframe-block 795 - include: at-keyframe-names 796 - include: at-rule-end 797 798 at-keyframe-names: 799 - match: '{{illegal_custom_ident}}' 800 scope: invalid.illegal.identifier.css 801 - match: '{{ident}}' 802 scope: entity.other.animation-name.css 803 - include: quoted-strings 804 805 at-keyframe-block: 806 - match: \{ 807 scope: punctuation.section.block.begin.css 808 push: at-keyframe-block-content 809 810 at-keyframe-block-content: 811 - meta_scope: meta.block.css 812 - include: block-end2 813 - include: comments 814 - include: property-lists 815 - include: at-keyframe-selectors 816 817 at-keyframe-selectors: 818 - match: (?=[[:alnum:].,%]) 819 push: at-keyframe-selector-content 820 821 at-keyframe-selector-content: 822 - meta_scope: meta.selector.css 823 - include: comma-delimiters 824 - include: percentage-constants 825 - match: \b(?i:from|to){{break}} 826 scope: keyword.other.selector.css 827 - include: selector-end 828 829 # @media 830 # https://drafts.csswg.org/css-conditional-3/#at-ruledef-media 831 at-media: 832 - match: (@)(?i:media){{break}} 833 captures: 834 0: keyword.control.directive.css 835 1: punctuation.definition.keyword.css 836 push: at-media-content 837 838 at-media-content: 839 - meta_scope: meta.at-rule.media.css 840 - include: media-queries 841 - include: at-rule-block 842 - include: at-rule-end 843 844 # @namespace 845 # https://www.w3.org/TR/css3-namespace/ 846 at-namespace: 847 - match: (@)(?i:namespace){{break}} 848 captures: 849 0: keyword.control.directive.css 850 1: punctuation.definition.keyword.css 851 push: 852 - at-namespace-content 853 - at-namespace-identifier 854 855 at-namespace-identifier: 856 - match: '{{ident}}(?!{{nmchar}}|\()' 857 scope: entity.other.namespace-prefix.css 858 pop: 1 859 - include: comments 860 - include: else-pop 861 862 at-namespace-content: 863 - meta_scope: meta.at-rule.namespace.css 864 - include: var-functions 865 - include: url-functions 866 - include: quoted-urls 867 - include: at-rule-end 868 869 # @page 870 # https://www.w3.org/TR/css3-page/#at-ruledef-page 871 at-page: 872 - match: (@)(?i:page){{break}} 873 captures: 874 0: keyword.control.directive.css 875 1: punctuation.definition.keyword.css 876 push: at-page-content 877 878 at-page-content: 879 - meta_scope: meta.at-rule.page.css 880 - include: comma-delimiters 881 - include: at-page-block 882 - include: at-page-names 883 - include: at-rule-end 884 885 at-page-names: 886 - match: (:)(?i:blank|first|left|right){{break}} 887 captures: 888 0: entity.other.pseudo-class.css 889 1: punctuation.definition.entity.css 890 - match: (:){{nmchar}}* 891 captures: 892 # 0: invalid.illegal.pseudo-class.css 893 1: punctuation.definition.entity.css 894 - match: '{{ident}}' 895 scope: entity.other.page-name.css 896 897 at-page-block: 898 - match: \{ 899 scope: punctuation.section.block.begin.css 900 push: at-page-block-content 901 902 at-page-block-content: 903 - meta_scope: meta.property-list.css meta.block.css 904 - include: block-end2 905 - include: at-page-margin 906 - include: at-other 907 - include: property-lists 908 - include: rule-list-body 909 910 # @top-center, ... 911 # https://www.w3.org/TR/css-page-3/#margin-at-rule 912 at-page-margin: 913 - match: (@){{page_margin_property_names}} 914 captures: 915 0: keyword.control.directive.css 916 1: punctuation.definition.keyword.css 917 push: at-page-margin-content 918 919 at-page-margin-content: 920 - meta_scope: meta.at-rule.margin.css 921 - include: at-page-block 922 - include: at-rule-end 923 924 # @supports 925 # https://drafts.csswg.org/css-conditional-3/#at-supports 926 at-supports: 927 - match: (@)(?i:supports){{break}} 928 captures: 929 0: keyword.control.directive.css 930 1: punctuation.definition.keyword.css 931 push: at-supports-content 932 933 at-supports-content: 934 - meta_scope: meta.at-rule.supports.css 935 - include: at-supports-groups 936 - include: at-supports-operators 937 - include: at-rule-block 938 - include: at-rule-end 939 940 at-supports-operators: 941 - match: \b(?i:and|or|not){{break}} 942 scope: keyword.operator.logical.css 943 944 at-supports-groups: 945 - match: \( 946 scope: punctuation.section.group.begin.css 947 push: at-supports-group-content 948 949 at-supports-group-content: 950 - meta_scope: meta.group.css 951 - include: group-end 952 - include: at-rule-end 953 - include: at-supports-groups 954 - include: at-supports-operators 955 - include: rule-list-body 956 957 # @<ident> 958 # Fallback context for incomplete or unknown at-rules. 959 # https://www.w3.org/TR/css-syntax-3/#at-rule 960 # https://www.w3.org/TR/CSS22/syndata.html#parsing-errors 961 at-other: 962 - match: (@){{ident}} 963 push: at-other-content 964 965 at-other-content: 966 - meta_scope: meta.at-rule.other.css 967 - match: \{ 968 scope: punctuation.section.block.begin.css 969 push: at-other-block-content 970 - include: at-rule-end 971 972 at-other-block-content: 973 - meta_scope: meta.block.css 974 - include: block-end2 975 976 at-rule-block: 977 - match: \{ 978 scope: punctuation.section.block.begin.css 979 push: at-rule-block-content 980 981 at-rule-block-content: 982 - meta_scope: meta.block.css 983 - include: block-end2 984 - include: main 985 986 at-rule-end: 987 - match: (?=[;{}]) 988 pop: 1 989 - include: comments 990 991 ###[ MEDIA QUERIES ]########################################################### 992 993 # https://drafts.csswg.org/mediaqueries-5/#media 994 media-queries: 995 - include: comma-delimiters 996 - include: media-query-conditions 997 - include: media-query-media-types 998 999 media-query-conditions: 1000 - match: \( 1001 scope: punctuation.section.group.begin.css 1002 push: media-query-group-content 1003 - match: '[<>]=?|=' 1004 scope: keyword.operator.comparison.css 1005 - match: \b(?i:and|or|not|only){{break}} 1006 scope: keyword.operator.logic.css 1007 1008 media-query-group-content: 1009 - meta_scope: meta.group.css 1010 - match: (?=[,;{}]) 1011 pop: 1 1012 - include: group-end 1013 - include: comments 1014 - include: media-query-conditions 1015 - include: media-query-property-names 1016 - include: media-query-property-values 1017 - include: var-functions 1018 - include: calc-functions 1019 - include: scalar-rational-constants 1020 - include: numeric-constants 1021 1022 media-query-property-names: 1023 - match: |- 1024 (?xi: 1025 ({{vendor_prefix}})? 1026 ( 1027 (?: min- | max- )? 1028 (?: 1029 color (?: -gamut | -index )? 1030 | monochrome | resolution | update 1031 | (?: device- )? (?: height | width | aspect-ratio | pixel-ratio ) 1032 ) 1033 | (?:any-)?(?: pointer | hover ) 1034 | display-mode | grid | orientation | scan | scripting 1035 | overflow-(?: block | inline ) 1036 ) 1037 ){{break}} 1038 captures: 1039 1: support.type.vendor-prefix.css 1040 2: support.type.property-name.css 1041 1042 media-query-property-values: 1043 - match: ':' 1044 scope: punctuation.separator.key-value.css 1045 push: media-query-property-value-content 1046 1047 media-query-property-value-content: 1048 - match: |- 1049 \b(?xi: 1050 # global css constants 1051 all | inherit | initial | none | unset 1052 # color-gamut / color-index: 1053 | srgb | p3 | rec2020 1054 # display-mode: 1055 | browser | fullscreen | standalone | minimal-ui 1056 # hover: 1057 | hover 1058 # orientation: 1059 | landscape | portrait 1060 # overflow: 1061 | optional-paged | paged | scroll 1062 # pointer: 1063 | coarse | fine 1064 # scan: 1065 | interlace | progressive 1066 # scripting: 1067 | enabled | initial-only 1068 # update: 1069 | fast | normal | slow 1070 ){{break}} 1071 scope: support.constant.property-value.css 1072 pop: 1 1073 - include: else-pop 1074 1075 media-query-media-types: 1076 # Media Types: 1077 # https://www.w3.org/TR/CSS21/media.html 1078 # https://drafts.csswg.org/mediaqueries-5/#media-types 1079 - match: |- 1080 \b(?xi: 1081 # global css constants 1082 all | inherit | initial | none | unset 1083 # specs 1084 | print | screen | speech 1085 # deprecated 1086 | aural | braille | embossed | handheld | projection | tty | tv 1087 ){{break}} 1088 scope: support.constant.media.css 1089 1090 ###[ SELECTORS ]############################################################### 1091 1092 selectors: 1093 - match: (?=[:.*#[:alpha:]\[]|{{combinators}}) 1094 push: selector-content 1095 1096 selector-content: 1097 - meta_scope: meta.selector.css 1098 - include: selector-end 1099 - include: comma-delimiters 1100 # Html Tags 1101 - match: '{{html_tags}}' 1102 scope: entity.name.tag.html.css 1103 - match: '{{svg_tags}}' 1104 scope: entity.name.tag.svg.css 1105 # Custom Elements 1106 # http://w3c.github.io/webcomponents/spec/custom/#custom-elements-core-concepts 1107 - match: '{{custom_element_tags}}' 1108 scope: entity.name.tag.custom.css 1109 - match: \* 1110 scope: variable.language.wildcard.asterisk.css 1111 # Class and Id Selectors 1112 # https://drafts.csswg.org/selectors-4/#class-html 1113 - match: \. 1114 scope: punctuation.definition.entity.css 1115 push: 1116 - meta_scope: entity.other.attribute-name.class.css 1117 - match: '{{generic_ident}}' 1118 pop: 1 1119 - include: immediately-pop 1120 # https://drafts.csswg.org/selectors-4/#id-selectors 1121 - match: \# 1122 scope: punctuation.definition.entity.css 1123 push: 1124 - meta_scope: entity.other.attribute-name.id.css 1125 - match: '{{generic_ident}}' 1126 pop: 1 1127 - include: immediately-pop 1128 # Attribute Selectors 1129 # https://drafts.csswg.org/selectors-4/#attribute-selectors 1130 - match: \[ 1131 scope: punctuation.section.brackets.begin.css 1132 push: 1133 - attribute-selector-meta 1134 - attribute-selector-key 1135 # Pseudo Elements 1136 # https://drafts.csswg.org/selectors-4/#pseudo-elements 1137 - match: '::' 1138 scope: punctuation.definition.pseudo-element.css 1139 push: 1140 - meta_include_prototype: false 1141 - include: vendor-prefixes 1142 - include: pseudo-element-function 1143 - include: pseudo-element-regular 1144 - include: immediately-pop 1145 # Pseudo Classes 1146 # https://drafts.csswg.org/selectors-4/#pseudo-classes 1147 - match: ':' 1148 scope: punctuation.definition.pseudo-class.css 1149 push: 1150 - meta_include_prototype: false 1151 - include: vendor-prefixes 1152 - include: pseudo-element-css2 1153 - include: pseudo-class-function 1154 - include: pseudo-class-regular 1155 - include: immediately-pop 1156 # Combinators 1157 # https://drafts.csswg.org/selectors-4/#combinators 1158 # https://drafts.csswg.org/css-scoping/#deep-combinator 1159 - match: '{{combinators}}(?![>~+|])' 1160 scope: keyword.operator.combinator.css 1161 - match: '{{combinators}}{2,}|\|{3,}' 1162 scope: invalid.illegal.combinator.css 1163 1164 selector-end: 1165 - match: (?=\s*[;@(){}]) 1166 pop: 1 1167 - include: comments 1168 1169 # Qualified Names 1170 # https://drafts.csswg.org/css-namespaces-3/#css-qnames 1171 namespace-prefixes: 1172 - match: (?:({{ident}})|(\*))?(\|)(?!=) 1173 captures: 1174 1: entity.other.namespace-prefix.css 1175 2: variable.language.wildcard.asterisk.css 1176 3: punctuation.separator.namespace.css 1177 1178 vendor-prefixes: 1179 - match: '{{vendor_prefix}}' 1180 scope: support.type.vendor-prefix.css 1181 1182 ###[ SELECTORS / ATTRIBUTE SELECTORS ]######################################### 1183 1184 attribute-selector-meta: 1185 - meta_scope: meta.attribute-selector.css meta.brackets.css 1186 - include: immediately-pop 1187 1188 attribute-selector-key: 1189 - include: namespace-prefixes 1190 - match: '{{ident}}' 1191 scope: entity.other.attribute-name.css 1192 set: attribute-selector-operator 1193 - match: \* 1194 scope: variable.language.wildcard.asterisk.css 1195 set: attribute-selector-operator 1196 - include: attribute-selector-operator 1197 1198 attribute-selector-operator: 1199 - match: '[~*|^$]?=' 1200 scope: keyword.operator.logical.css 1201 set: 1202 - attribute-selector-flag 1203 - attribute-selector-value 1204 - include: attribute-selector-flag 1205 1206 attribute-selector-value: 1207 - include: comments 1208 - include: quoted-string 1209 - match: '[^\s\]\[''"]+' 1210 scope: meta.string.css string.unquoted.css 1211 pop: 1 1212 - include: else-pop 1213 1214 attribute-selector-flag: 1215 - match: \b[iI]{{break}} 1216 scope: keyword.other.flag.css 1217 set: attribute-selector-end 1218 - include: attribute-selector-end 1219 1220 attribute-selector-end: 1221 - match: \] 1222 scope: punctuation.section.brackets.end.css 1223 pop: 1 1224 - include: selector-end 1225 - match: \S 1226 scope: invalid.illegal.css 1227 1228 ###[ SELECTORS / PSEUDO CLASSES ]############################################## 1229 1230 # Functional Pseudo Classes 1231 # https://drafts.csswg.org/selectors-4/#functional-pseudo-class 1232 pseudo-class-function: 1233 - include: pseudo-class-function-dir 1234 - include: pseudo-class-function-lang 1235 - include: pseudo-class-function-with-anb-args 1236 - include: pseudo-class-function-with-selector-args 1237 - include: pseudo-class-function-with-generic-args 1238 1239 # Special :dir() pseudo-class 1240 # https://drafts.csswg.org/selectors-4/#the-dir-pseudo 1241 pseudo-class-function-dir: 1242 - match: (?i:dir)(?=\() 1243 scope: meta.function-call.identifier.css entity.other.pseudo-class.css 1244 set: 1245 - meta_include_prototype: false 1246 - match: \( 1247 scope: punctuation.section.group.begin.css 1248 set: 1249 - meta_scope: meta.function-call.arguments.css meta.group.css 1250 - include: function-arguments-common 1251 - include: direction-constants 1252 1253 # Special :lang() pseudo-class 1254 # https://drafts.csswg.org/selectors-4/#the-lang-pseudo 1255 pseudo-class-function-lang: 1256 - match: (?i:lang)(?=\() 1257 scope: meta.function-call.identifier.css entity.other.pseudo-class.css 1258 set: 1259 - meta_include_prototype: false 1260 - match: \( 1261 scope: punctuation.section.group.begin.css 1262 set: 1263 - meta_scope: meta.function-call.arguments.css meta.group.css 1264 - include: function-arguments-common 1265 - include: comma-delimiters 1266 - include: quoted-strings 1267 - include: language-ranges 1268 1269 # Functional Pseudo Classes with `An+B` param 1270 # An+B Notation: https://drafts.csswg.org/css-syntax/#anb 1271 pseudo-class-function-with-anb-args: 1272 - match: |- 1273 (?xi: 1274 # https://drafts.csswg.org/selectors-4/#table-pseudos 1275 nth-last-col 1276 | nth-col 1277 # https://drafts.csswg.org/selectors-4/#typed-child-index 1278 | nth-last-child 1279 | nth-child 1280 | nth-last-of-type 1281 | nth-of-type 1282 )(?=\() 1283 scope: meta.function-call.identifier.css entity.other.pseudo-class.css 1284 set: 1285 - meta_include_prototype: false 1286 - match: \( 1287 scope: punctuation.section.group.begin.css 1288 set: 1289 - meta_scope: meta.function-call.arguments.css meta.group.css 1290 - include: function-arguments-common 1291 - include: anb-notation-values 1292 - include: scalar-integer-constants 1293 1294 anb-notation-values: 1295 - match: \b(even|odd){{break}} 1296 scope: support.constant.property-value.css 1297 - match: (([-+]?)(\d*)(n))\s*(([-+])(\s*\d+))? 1298 captures: 1299 1: meta.number.integer.decimal.css 1300 2: keyword.operator.arithmetic.css 1301 3: constant.numeric.value.css 1302 4: constant.numeric.suffix.css 1303 5: meta.number.integer.decimal.css 1304 6: keyword.operator.arithmetic.css 1305 7: constant.numeric.value.css 1306 - match: '[-+]\s+\d+n?|[-+]?\d+\s+n' 1307 scope: invalid.illegal.numeric.css 1308 1309 # Functional Pseudo Classes with selector list 1310 pseudo-class-function-with-selector-args: 1311 - match: (?i:matches|is|where|not|has)(?=\() 1312 scope: meta.function-call.identifier.css entity.other.pseudo-class.css 1313 set: 1314 - meta_include_prototype: false 1315 - match: \( 1316 scope: punctuation.section.group.begin.css 1317 set: 1318 - meta_scope: meta.function-call.arguments.css meta.group.css 1319 - include: function-arguments-common 1320 - include: selectors 1321 1322 # Functional Pseudo Classes with generic arguments 1323 pseudo-class-function-with-generic-args: 1324 - match: '{{ident}}(?=\()' 1325 scope: meta.function-call.identifier.css entity.other.pseudo-class.css 1326 set: other-functions-arguments 1327 1328 # Regular Pseudo Classes 1329 # https://drafts.csswg.org/selectors-4/#pseudo-classes 1330 pseudo-class-regular: 1331 - match: '{{ident}}' 1332 scope: entity.other.pseudo-class.css 1333 pop: 1 1334 1335 # Legacy Pseudo Elements 1336 # https://drafts.csswg.org/selectors-4/#pseudo-elements 1337 pseudo-element-css2: 1338 # Note: CSS1 & CSS2 compatibility requires those to be matched after `:` 1339 - match: (?i:before|after|first-line|first-letter){{break}} 1340 scope: entity.other.pseudo-element.css 1341 pop: 1 1342 1343 # Functional Pseudo Elements 1344 # https://drafts.csswg.org/selectors-4/#pseudo-elements 1345 pseudo-element-function: 1346 - match: '{{ident}}(?=\()' 1347 scope: meta.function-call.identifier.css entity.other.pseudo-element.css 1348 set: other-functions-arguments 1349 1350 # Pseudo Elements 1351 # https://drafts.csswg.org/selectors-4/#pseudo-elements 1352 pseudo-element-regular: 1353 - match: '{{ident}}' 1354 scope: entity.other.pseudo-element.css 1355 pop: 1 1356 1357 ###[ PROPERTY LISTS ]########################################################## 1358 1359 property-lists: 1360 - match: \{ 1361 scope: punctuation.section.block.begin.css 1362 push: property-list-content 1363 1364 property-list-content: 1365 - meta_scope: meta.property-list.css meta.block.css 1366 - match: \} 1367 scope: punctuation.section.block.end.css 1368 pop: 1 1369 - include: rule-list-body 1370 1371 rule-list: 1372 - match: \{ 1373 scope: punctuation.section.block.begin.css 1374 push: rule-list-content 1375 1376 rule-list-content: 1377 - meta_scope: meta.property-list.css meta.block.css 1378 - include: block-end2 1379 - include: rule-list-body 1380 1381 rule-list-body: 1382 # Note: This context is used by HTML.sublime-syntax 1383 - include: comments 1384 - include: property-identifiers 1385 - include: property-values 1386 - include: rule-terminators 1387 - include: illegal-blocks 1388 - include: illegal-groups 1389 1390 ###[ PROPERTY IDENTIFIERS ]#################################################### 1391 1392 property-identifiers: 1393 - match: (?=[-[:alpha:]]) 1394 push: property-identifier-content 1395 1396 property-identifier-content: 1397 - meta_scope: meta.property-name.css 1398 - include: vendor-prefixes 1399 # specific properties with special treatment 1400 - include: counter-property 1401 - include: counter-style-fallback-property 1402 - include: counter-style-system-property 1403 - include: counter-style-speak-as-property 1404 - include: font-property 1405 # common properties 1406 - include: builtin-property 1407 - include: custom-property 1408 - include: deprecated-property 1409 - include: other-property 1410 # bailout 1411 - include: immediately-pop 1412 1413 builtin-property: 1414 - match: '{{property_names}}' 1415 scope: support.type.property-name.css 1416 pop: 1 1417 1418 # Custom Properties 1419 # https://drafts.csswg.org/css-variables/#typedef-custom-property 1420 custom-property: 1421 # custom property definition 1422 - match: '{{custom_ident}}' 1423 scope: entity.other.custom-property.css 1424 pop: 1 1425 1426 deprecated-property: 1427 - match: \b(var-)({{ident}}) 1428 scope: invalid.deprecated.custom-property.css 1429 captures: 1430 1: entity.other.custom-property.prefix.css 1431 2: entity.other.custom-property.name.css 1432 pop: 1 1433 1434 other-property: 1435 # Note: Consume unknown identifiers to maintain word boundaries. 1436 - match: '{{generic_ident}}' 1437 pop: 1 1438 1439 ###[ PROPERTY VALUES ]######################################################### 1440 1441 property-values: 1442 - match: ':' 1443 scope: punctuation.separator.key-value.css 1444 push: property-value-content 1445 1446 property-value-content: 1447 - meta_content_scope: meta.property-value.css 1448 - include: terminator-pop 1449 - include: comments 1450 - include: comma-delimiters 1451 - include: common-operators 1452 - include: builtin-values 1453 - include: other-functions 1454 - include: other-constants 1455 1456 builtin-values: 1457 - include: quoted-strings 1458 - include: builtin-functions 1459 - include: color-values 1460 - include: line-names 1461 - include: unicode-ranges 1462 - include: numeric-constants 1463 - include: common-constants 1464 - include: generic-font-names 1465 - include: vendor-prefixes 1466 1467 # When including `color-values` and `color-adjuster-functions`, make sure it is 1468 # included after the color adjustors to prevent `color-values` from consuming 1469 # conflicting function names & color constants such as `red`, `green`, or `blue`. 1470 color-values: 1471 - include: color-functions 1472 - include: color-constants 1473 1474 # Counter Symbol Values 1475 # https://drafts.csswg.org/css-counter-styles-3/#counter-style-system 1476 # https://drafts.csswg.org/css-counter-styles-3/#symbols-function 1477 counter-symbol-values: 1478 - include: image-values 1479 - include: counter-system-constants 1480 - include: scalar-integer-constants 1481 - include: quoted-strings 1482 1483 # 2D Image Values 1484 # https://drafts.csswg.org/css-images-4/#image-values 1485 image-values: 1486 - include: cross-fade-functions 1487 - include: gradient-functions 1488 - include: image-functions 1489 - include: image-set-functions 1490 - include: url-functions 1491 1492 ###[ COUNTER PROPERTY ]######################################################## 1493 1494 counter-property: 1495 # https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Lists_and_Counters/Using_CSS_counters 1496 - match: \b(?i:counter-(increment|reset|set)){{break}} 1497 scope: support.type.property-name.css 1498 set: counter-property-value 1499 1500 counter-property-value: 1501 - match: ':' 1502 scope: punctuation.separator.key-value.css 1503 set: 1504 - property-value-content 1505 - counter-identifier 1506 - include: else-pop 1507 1508 counter-identifier: 1509 - match: '{{ident}}' 1510 scope: entity.other.counter-name.css 1511 pop: 1 1512 - include: comments 1513 - include: else-pop 1514 1515 ###[ COUNTER STYLE FALLBACK PROPERTY ]######################################### 1516 1517 # Counter Style Fallback 1518 # https://drafts.csswg.org/css-counter-styles-3/#counter-style-fallback 1519 counter-style-fallback-property: 1520 - match: \b(?i:fallback){{break}} 1521 scope: support.type.property-name.css 1522 set: counter-style-fallback-property-value 1523 1524 counter-style-fallback-property-value: 1525 - match: ':' 1526 scope: punctuation.separator.key-value.css 1527 set: counter-style-fallback-property-value-content 1528 - include: else-pop 1529 1530 counter-style-fallback-property-value-content: 1531 - meta_content_scope: meta.property-value.css 1532 - include: terminator-pop 1533 - include: comments 1534 - include: var-functions 1535 - include: counter-style-identifiers 1536 1537 counter-style-identifiers: 1538 - match: '{{counter_style_names}}' 1539 scope: support.constant.counter-style-name.css 1540 - match: '{{ident}}' 1541 scope: entity.other.counter-style-name.css 1542 1543 ###[ COUNTER STYLE SYSTEM PROPERTY ]########################################### 1544 1545 # Counter Style System 1546 # https://drafts.csswg.org/css-counter-styles-3/#counter-style-system 1547 counter-style-system-property: 1548 - match: \b(?i:system){{break}} 1549 scope: support.type.property-name.css 1550 set: counter-style-system-property-value 1551 1552 counter-style-system-property-value: 1553 - match: ':' 1554 scope: punctuation.separator.key-value.css 1555 set: counter-style-system-property-value-content 1556 - include: else-pop 1557 1558 counter-style-system-property-value-content: 1559 - meta_content_scope: meta.property-value.css 1560 - include: terminator-pop 1561 - include: comments 1562 - include: var-functions 1563 - include: counter-symbol-values 1564 - match: \b(?i:extends){{break}} 1565 scope: keyword.declaration.extends.css 1566 push: counter-style-identifier 1567 1568 counter-style-identifier: 1569 - match: '{{counter_style_names}}' 1570 scope: support.constant.counter-style-name.css 1571 pop: 1 1572 - match: '{{ident}}' 1573 scope: entity.other.counter-style-name.css 1574 pop: 1 1575 - include: comments 1576 - include: else-pop 1577 1578 ###[ COUNTER STYLE SPEAK AS PROPERTY ]######################################### 1579 1580 # Counter Style Speak As 1581 # https://drafts.csswg.org/css-counter-styles-3/#counter-style-speak-as 1582 counter-style-speak-as-property: 1583 - match: \b(?i:speak-as){{break}} 1584 scope: support.type.property-name.css 1585 set: counter-style-speak-as-property-value 1586 1587 counter-style-speak-as-property-value: 1588 - match: ':' 1589 scope: punctuation.separator.key-value.css 1590 set: counter-style-speak-as-property-value-content 1591 - include: else-pop 1592 1593 counter-style-speak-as-property-value-content: 1594 - meta_content_scope: meta.property-value.css 1595 - include: terminator-pop 1596 - include: comments 1597 - include: var-functions 1598 - include: quoted-strings 1599 - include: counter-speak-as-constants 1600 - include: counter-style-identifiers 1601 1602 ###[ FONT PROPERTY ]########################################################### 1603 1604 # Font and Font-Family Property 1605 # https://drafts.csswg.org/css-fonts-3/#font-family-prop 1606 # https://drafts.csswg.org/css-fonts-3/#font-prop 1607 font-property: 1608 - match: \b(?i:font(-family)?){{break}} 1609 scope: support.type.property-name.css 1610 set: font-property-value 1611 1612 font-property-value: 1613 - match: ':' 1614 scope: punctuation.separator.key-value.css 1615 set: font-property-value-content 1616 - include: else-pop 1617 1618 font-property-value-content: 1619 - meta_content_scope: meta.property-value.css 1620 - include: terminator-pop 1621 - include: comments 1622 - include: comma-delimiters 1623 - include: common-operators 1624 - include: builtin-values 1625 - include: font-family-names 1626 1627 ###[ BUILTIN FUNCTIONS ]####################################################### 1628 1629 builtin-functions: 1630 - include: at-counter-functions 1631 - include: at-font-functions 1632 - include: attr-functions 1633 - include: calc-functions 1634 - include: color-adjuster-functions 1635 - include: cross-fade-functions 1636 - include: filter-functions 1637 - include: filters-functions 1638 - include: gradient-functions 1639 - include: image-functions 1640 - include: image-set-functions 1641 - include: minmax-functions 1642 - include: repeat-functions 1643 - include: shape-functions 1644 - include: timing-functions 1645 - include: toggle-functions 1646 - include: transform-functions 1647 - include: url-functions 1648 - include: var-functions 1649 1650 function-arguments-common: 1651 - include: group-end 1652 - include: terminator-pop 1653 - include: comments 1654 - include: var-functions 1655 1656 ###[ BUILTIN AT RULE FUNCTIONS ]############################################### 1657 1658 at-counter-functions: 1659 # counter() 1660 # https://drafts.csswg.org/css-lists-3/#funcdef-counter 1661 # counters() 1662 # https://drafts.csswg.org/css-lists-3/#funcdef-counters 1663 - match: \b(?i:counters?)(?=\() 1664 scope: meta.function-call.identifier.css support.function.counter.css 1665 push: 1666 - meta_include_prototype: false 1667 - match: \( 1668 scope: punctuation.section.group.begin.css 1669 set: 1670 - - meta_scope: meta.function-call.arguments.css meta.group.css 1671 - include: function-arguments-common 1672 - include: comma-delimiters 1673 - include: counter-style-identifiers 1674 - include: quoted-strings 1675 - counter-identifier 1676 1677 # symbols() 1678 # https://drafts.csswg.org/css-counter-styles-3/#symbols-function 1679 - match: \b(?i:symbols)(?=\() 1680 scope: meta.function-call.identifier.css support.function.counter.css 1681 push: 1682 - meta_include_prototype: false 1683 - match: \( 1684 scope: punctuation.section.group.begin.css 1685 set: 1686 - meta_scope: meta.function-call.arguments.css meta.group.css 1687 - include: function-arguments-common 1688 - include: comma-delimiters 1689 - include: counter-symbol-values 1690 1691 at-document-functions: 1692 # url-prefix() 1693 # https://www.w3.org/TR/2012/WD-css3-conditional-20120911/#url-prefix 1694 - match: \b(?i:url-prefix)(?=\() 1695 scope: meta.function-call.identifier.css support.function.url-prefix.css 1696 push: 1697 - meta_include_prototype: false 1698 - match: \( 1699 scope: punctuation.section.group.begin.css 1700 set: 1701 - meta_scope: meta.function-call.arguments.css meta.group.css 1702 - include: function-arguments-common 1703 - include: quoted-urls 1704 - include: unquoted-urls 1705 1706 # domain() 1707 # https://www.w3.org/TR/2012/WD-css3-conditional-20120911/#url-domain 1708 - match: \b(?i:domain)(?=\() 1709 scope: meta.function-call.identifier.css support.function.domain.css 1710 push: 1711 - meta_include_prototype: false 1712 - match: \( 1713 scope: punctuation.section.group.begin.css 1714 set: 1715 - meta_scope: meta.function-call.arguments.css meta.group.css 1716 - include: function-arguments-common 1717 - include: quoted-urls 1718 - include: unquoted-urls 1719 1720 # regexp() 1721 # https://www.w3.org/TR/2012/WD-css3-conditional-20120911/#url-regexp 1722 - match: \b(?i:regexp)(?=\() 1723 scope: meta.function-call.identifier.css support.function.regexp.css 1724 push: 1725 - meta_include_prototype: false 1726 - match: \( 1727 scope: punctuation.section.group.begin.css 1728 set: 1729 - meta_scope: meta.function-call.arguments.css meta.group.css 1730 - include: function-arguments-common 1731 - include: quoted-strings 1732 1733 at-font-functions: 1734 # format() 1735 # https://drafts.csswg.org/css-fonts-3/#descdef-src 1736 # format() is also mentioned in `issue 2` at https://drafts.csswg.org/css-images-3/#issues-index 1737 # but does not seem to be implemented in any manner 1738 - match: \b(?i:format)(?=\() 1739 scope: meta.function-call.identifier.css support.function.font-face.css 1740 push: 1741 - meta_include_prototype: false 1742 - match: \( 1743 scope: punctuation.section.group.begin.css 1744 set: 1745 - meta_scope: meta.function-call.arguments.css meta.group.css 1746 - include: function-arguments-common 1747 - include: quoted-strings 1748 1749 # local() 1750 # https://drafts.csswg.org/css-fonts-3/#descdef-src 1751 - match: \b(?i:local)(?=\() 1752 scope: meta.function-call.identifier.css support.function.font-face.css 1753 push: 1754 - meta_include_prototype: false 1755 - match: \( 1756 scope: punctuation.section.group.begin.css 1757 set: 1758 - meta_scope: meta.function-call.arguments.css meta.group.css 1759 - include: function-arguments-common 1760 - include: quoted-strings 1761 - include: generic-font-names 1762 - include: font-family-names 1763 1764 ###[ BUILTIN COLOR FUNCTIONS ]################################################# 1765 1766 # Color Functions 1767 # https://drafts.csswg.org/css-color 1768 color-functions: 1769 # rgb(), rgba() 1770 # https://drafts.csswg.org/css-color/#rgb-functions 1771 - match: \b(?i:rgba?)(?=\() 1772 scope: meta.function-call.identifier.css support.function.color.css 1773 push: 1774 - meta_include_prototype: false 1775 - match: \( 1776 scope: punctuation.section.group.begin.css 1777 set: 1778 - meta_scope: meta.function-call.arguments.css meta.group.css 1779 - include: function-arguments-common 1780 - include: comma-delimiters 1781 - include: calc-functions 1782 - include: percentage-constants 1783 - include: scalar-constants 1784 1785 # hsl(), hsla() 1786 # https://drafts.csswg.org/css-color/#the-hsl-notation 1787 # hwb() - Not yet implemented by browsers 1788 # https://drafts.csswg.org/css-color/#funcdef-hwb 1789 - match: \b(?i:hsla?|hwb)(?=\() 1790 scope: meta.function-call.identifier.css support.function.color.css 1791 push: 1792 - meta_include_prototype: false 1793 - match: \( 1794 scope: punctuation.section.group.begin.css 1795 set: 1796 - meta_scope: meta.function-call.arguments.css meta.group.css 1797 - include: function-arguments-common 1798 - include: comma-delimiters 1799 - include: calc-functions 1800 - include: angle-constants 1801 - include: percentage-constants 1802 - include: scalar-constants 1803 1804 # gray() - Not yet implemented by browsers 1805 # https://drafts.csswg.org/css-color/#funcdef-gray 1806 - match: \b(?i:gray)(?=\() 1807 scope: meta.function-call.identifier.css support.function.color.css 1808 push: 1809 - meta_include_prototype: false 1810 - match: \( 1811 scope: punctuation.section.group.begin.css 1812 set: 1813 - meta_scope: meta.function-call.arguments.css meta.group.css 1814 - include: function-arguments-common 1815 - include: comma-delimiters 1816 - include: calc-functions 1817 - include: percentage-constants 1818 - include: scalar-constants 1819 1820 # device-cmyk() - Not yet implemented by browsers 1821 # https://drafts.csswg.org/css-color/#funcdef-device-cmyk 1822 - match: \b(?i:device-cmyk)(?=\() 1823 scope: meta.function-call.identifier.css support.function.color.css 1824 push: 1825 - meta_include_prototype: false 1826 - match: \( 1827 scope: punctuation.section.group.begin.css 1828 set: 1829 - meta_scope: meta.function-call.arguments.css meta.group.css 1830 - include: function-arguments-common 1831 - include: comma-delimiters 1832 - include: calc-functions 1833 - include: color-adjuster-functions # must be included before `color-values` 1834 - include: color-values 1835 - include: percentage-constants 1836 - include: scalar-constants 1837 1838 # color-mod() - Not yet implemented by browsers 1839 # https://drafts.csswg.org/css-color/#funcdef-color-mod 1840 - match: \b(?i:color)(?=\() 1841 scope: meta.function-call.identifier.css support.function.color.css 1842 push: 1843 - meta_include_prototype: false 1844 - match: \( 1845 scope: punctuation.section.group.begin.css 1846 set: 1847 - meta_scope: meta.function-call.arguments.css meta.group.css 1848 - include: function-arguments-common 1849 - include: comma-delimiters 1850 - include: calc-functions 1851 - include: color-adjuster-functions # must be included before `color-values` 1852 - include: color-values 1853 - include: angle-constants 1854 - include: scalar-constants 1855 1856 # Color Adjuster Functions - Not yet implemented by browsers 1857 # https://drafts.csswg.org/css-color/#typedef-color-adjuster 1858 color-adjuster-functions: 1859 # red(), green(), blue(), alpha() - Not yet implemented by browsers 1860 - match: \b(?i:red|green|blue|alpha|a)(?=\() 1861 scope: meta.function-call.identifier.css support.function.color.css 1862 push: 1863 - meta_include_prototype: false 1864 - match: \( 1865 scope: punctuation.section.group.begin.css 1866 set: 1867 - meta_scope: meta.function-call.arguments.css meta.group.css 1868 - include: function-arguments-common 1869 - include: calc-functions 1870 - include: color-adjuster-operators 1871 - include: percentage-constants 1872 - include: scalar-constants 1873 1874 # hue() - Not yet implemented by browsers 1875 - match: \b(?i:hue|h)(?=\() 1876 scope: meta.function-call.identifier.css support.function.color.css 1877 push: 1878 - meta_include_prototype: false 1879 - match: \( 1880 scope: punctuation.section.group.begin.css 1881 set: 1882 - meta_scope: meta.function-call.arguments.css meta.group.css 1883 - include: function-arguments-common 1884 - include: calc-functions 1885 - include: color-adjuster-operators 1886 - include: angle-constants 1887 1888 # saturation(), lightness(), whiteness(), blackness() - Not yet implemented by browsers 1889 - match: \b(?i:saturation|lightness|whiteness|blackness|[slwb])(?=\() 1890 scope: meta.function-call.identifier.css support.function.color.css 1891 push: 1892 - meta_include_prototype: false 1893 - match: \( 1894 scope: punctuation.section.group.begin.css 1895 set: 1896 - meta_scope: meta.function-call.arguments.css meta.group.css 1897 - include: function-arguments-common 1898 - include: calc-functions 1899 - include: color-adjuster-operators 1900 - include: percentage-constants 1901 1902 # tint(), shade(), contrast() - Not yet implemented by browsers 1903 # contrast() interferes with the contrast() filter function; 1904 # therefore, it is not yet implemented here 1905 - match: \b(?i:tint|shade)(?=\() 1906 scope: meta.function-call.identifier.css support.function.color.css 1907 push: 1908 - meta_include_prototype: false 1909 - match: \( 1910 scope: punctuation.section.group.begin.css 1911 set: 1912 - meta_scope: meta.function-call.arguments.css meta.group.css 1913 - include: function-arguments-common 1914 - include: calc-functions 1915 - include: percentage-constants 1916 1917 # blend(), blenda() - Not yet implemented by browsers 1918 - match: \b(?i:blenda|blend)(?=\() 1919 scope: meta.function-call.identifier.css support.function.color.css 1920 push: 1921 - meta_include_prototype: false 1922 - match: \( 1923 scope: punctuation.section.group.begin.css 1924 set: 1925 - meta_scope: meta.function-call.arguments.css meta.group.css 1926 - include: function-arguments-common 1927 - include: calc-functions 1928 - include: color-values 1929 - include: percentage-constants 1930 - match: \b(?i:rgb|hsl|hwb){{break}} 1931 scope: keyword.other.color-space.css 1932 1933 ###[ BUILTIN FILTER FUNCTIONS ]################################################ 1934 1935 filter-functions: 1936 # filter() 1937 # https://drafts.fxtf.org/filters/#funcdef-filter 1938 - match: \b(?i:filter)(?=\() 1939 scope: meta.function-call.identifier.css support.function.filter.css 1940 push: 1941 - meta_include_prototype: false 1942 - match: \( 1943 scope: punctuation.section.group.begin.css 1944 set: 1945 - meta_scope: meta.function-call.arguments.css meta.group.css 1946 - include: function-arguments-common 1947 - include: comma-delimiters 1948 - include: filters-functions 1949 - include: image-values 1950 - include: quoted-strings 1951 1952 # Filter Functions 1953 # https://drafts.fxtf.org/filters/#typedef-filter-function 1954 filters-functions: 1955 # blur() 1956 # https://drafts.fxtf.org/filters/#funcdef-filter-blur 1957 - match: \b(?i:blur)(?=\() 1958 scope: meta.function-call.identifier.css support.function.filter.css 1959 push: 1960 - meta_include_prototype: false 1961 - match: \( 1962 scope: punctuation.section.group.begin.css 1963 set: 1964 - meta_scope: meta.function-call.arguments.css meta.group.css 1965 - include: function-arguments-common 1966 - include: calc-functions 1967 - include: length-constants 1968 1969 # brightness(), contrast(), grayscale(), invert(), opacity(), saturate(), sepia() 1970 # https://drafts.fxtf.org/filters/#funcdef-filter-brightness 1971 - match: \b(?i:brightness|contrast|grayscale|invert|opacity|saturate|sepia)(?=\() 1972 scope: meta.function-call.identifier.css support.function.filter.css 1973 push: 1974 - meta_include_prototype: false 1975 - match: \( 1976 scope: punctuation.section.group.begin.css 1977 set: 1978 - meta_scope: meta.function-call.arguments.css meta.group.css 1979 - include: function-arguments-common 1980 - include: calc-functions 1981 - include: percentage-constants 1982 - include: scalar-constants 1983 1984 # drop-shadow() 1985 # https://drafts.fxtf.org/filters/#funcdef-filter-drop-shadow 1986 - match: \b(?i:drop-shadow)(?=\() 1987 scope: meta.function-call.identifier.css support.function.filter.css 1988 push: 1989 - meta_include_prototype: false 1990 - match: \( 1991 scope: punctuation.section.group.begin.css 1992 set: 1993 - meta_scope: meta.function-call.arguments.css meta.group.css 1994 - include: function-arguments-common 1995 - include: calc-functions 1996 - include: color-values 1997 - include: length-constants 1998 1999 # hue-rotate() 2000 # https://drafts.fxtf.org/filters/#funcdef-filter-hue-rotate 2001 - match: \b(?i:hue-rotate)(?=\() 2002 scope: meta.function-call.identifier.css support.function.filter.css 2003 push: 2004 - meta_include_prototype: false 2005 - match: \( 2006 scope: punctuation.section.group.begin.css 2007 set: 2008 - meta_scope: meta.function-call.arguments.css meta.group.css 2009 - include: function-arguments-common 2010 - include: calc-functions 2011 - include: angle-constants 2012 2013 ###[ BUILTIN GRID FUNCTIONS ]################################################## 2014 2015 # minmax() 2016 # https://drafts.csswg.org/css-grid/#valdef-grid-template-columns-minmax 2017 minmax-functions: 2018 - match: \b(?i:minmax)(?=\() 2019 scope: meta.function-call.identifier.css support.function.grid.css 2020 push: 2021 - meta_include_prototype: false 2022 - match: \( 2023 scope: punctuation.section.group.begin.css 2024 set: 2025 - meta_scope: meta.function-call.arguments.css meta.group.css 2026 - include: function-arguments-common 2027 - include: comma-delimiters 2028 - include: calc-functions 2029 - include: grid-constants 2030 - include: length-constants 2031 - include: percentage-constants 2032 2033 # repeat() 2034 # https://drafts.csswg.org/css-grid/#funcdef-repeat 2035 repeat-functions: 2036 - match: \b(?i:repeat)(?=\() 2037 scope: meta.function-call.identifier.css support.function.grid.css 2038 push: 2039 - meta_include_prototype: false 2040 - match: \( 2041 scope: punctuation.section.group.begin.css 2042 set: 2043 - meta_scope: meta.function-call.arguments.css meta.group.css 2044 - include: function-arguments-common 2045 - include: comma-delimiters 2046 - match: \b(?i:auto-fill|auto-fit){{break}} 2047 scope: keyword.other.grid.css 2048 - include: calc-functions 2049 - include: minmax-functions 2050 - include: grid-constants 2051 - include: length-constants 2052 - include: percentage-constants 2053 - include: scalar-integer-constants 2054 - include: line-names 2055 2056 ###[ BUILTIN IMAGE FUNCTIONS ]################################################# 2057 2058 # cross-fade() 2059 # https://drafts.csswg.org/css-images-4/#funcdef-cross-fade 2060 cross-fade-functions: 2061 - match: \b(?i:cross-fade)(?=\() 2062 scope: meta.function-call.identifier.css support.function.image.css 2063 push: 2064 - meta_include_prototype: false 2065 - match: \( 2066 scope: punctuation.section.group.begin.css 2067 set: 2068 - meta_scope: meta.function-call.arguments.css meta.group.css 2069 - include: function-arguments-common 2070 - include: comma-delimiters 2071 - include: color-values 2072 - include: image-values 2073 - include: percentage-constants 2074 - include: quoted-urls 2075 2076 # image() 2077 # https://drafts.csswg.org/css-images-4/#funcdef-image 2078 image-functions: 2079 - match: \b(?i:image)(?=\() 2080 scope: meta.function-call.identifier.css support.function.image.css 2081 push: 2082 - meta_include_prototype: false 2083 - match: \( 2084 scope: punctuation.section.group.begin.css 2085 set: 2086 - meta_scope: meta.function-call.arguments.css meta.group.css 2087 - include: function-arguments-common 2088 - include: comma-delimiters 2089 - include: color-values 2090 - include: image-values 2091 - include: quoted-urls 2092 - include: direction-constants 2093 2094 # image-set() 2095 # https://drafts.csswg.org/css-images-4/#funcdef-image-set 2096 image-set-functions: 2097 - match: \b(?i:image-set)(?=\() 2098 scope: meta.function-call.identifier.css support.function.image.css 2099 push: 2100 - meta_include_prototype: false 2101 - match: \( 2102 scope: punctuation.section.group.begin.css 2103 set: 2104 - meta_scope: meta.function-call.arguments.css meta.group.css 2105 - include: function-arguments-common 2106 - include: comma-delimiters 2107 - include: color-values 2108 - include: image-values 2109 - include: quoted-urls 2110 - include: resolution-constants 2111 - match: ([0-9]+)(x) 2112 scope: meta.number.integer.decimal.css 2113 captures: 2114 1: constant.numeric.value.css 2115 2: constant.numeric.suffix.css 2116 2117 # Gradient Functions 2118 # https://drafts.csswg.org/css-images-3/#gradients 2119 gradient-functions: 2120 # conic-gradient() 2121 # https://developer.mozilla.org/en-US/docs/Web/CSS/conic-gradient() 2122 # repeating-conic-gradient() 2123 # https://developer.mozilla.org/en-US/docs/Web/CSS/repeating-conic-gradient() 2124 - match: \b((?:repeating-)?conic-gradient)(?=\() 2125 scope: meta.function-call.identifier.css support.function.gradient.css 2126 push: 2127 - meta_include_prototype: false 2128 - match: \( 2129 scope: punctuation.section.group.begin.css 2130 set: 2131 - meta_scope: meta.function-call.arguments.css meta.group.css 2132 - include: function-arguments-common 2133 - include: comma-delimiters 2134 - match: \b(?i:at|from){{break}} 2135 scope: keyword.other.gradient.css 2136 - match: \b(?i:bottom|center|left|right|top){{break}} 2137 scope: support.constant.property-value.css 2138 - include: color-values 2139 - include: angle-constants 2140 - include: length-constants 2141 - include: percentage-constants 2142 2143 # linear-gradient() 2144 # https://developer.mozilla.org/en-US/docs/Web/CSS/linear-gradient() 2145 # repeating-linear-gradient() 2146 # https://developer.mozilla.org/en-US/docs/Web/CSS/repeating-linear-gradient() 2147 - match: \b((?:repeating-)?linear-gradient)(?=\() 2148 scope: meta.function-call.identifier.css support.function.gradient.css 2149 push: 2150 - meta_include_prototype: false 2151 - match: \( 2152 scope: punctuation.section.group.begin.css 2153 set: 2154 - meta_scope: meta.function-call.arguments.css meta.group.css 2155 - include: function-arguments-common 2156 - include: comma-delimiters 2157 - match: \b(?i:to){{break}} 2158 scope: keyword.other.gradient.css 2159 - match: \b(?i:bottom|left|right|top){{break}} 2160 scope: support.constant.property-value.css 2161 - include: color-values 2162 - include: angle-constants 2163 - include: length-constants 2164 - include: percentage-constants 2165 2166 # radial-gradient() 2167 # https://developer.mozilla.org/en-US/docs/Web/CSS/radial-gradient() 2168 # repeating-radial-gradient() 2169 # https://developer.mozilla.org/en-US/docs/Web/CSS/repeating-radial-gradient() 2170 - match: \b((?:repeating-)?radial-gradient)(?=\() 2171 scope: meta.function-call.identifier.css support.function.gradient.css 2172 push: 2173 - meta_include_prototype: false 2174 - match: \( 2175 scope: punctuation.section.group.begin.css 2176 set: 2177 - meta_scope: meta.function-call.arguments.css meta.group.css 2178 - include: function-arguments-common 2179 - include: comma-delimiters 2180 - match: \b(?i:at|circle|ellipse){{break}} 2181 scope: keyword.other.gradient.css 2182 - match: \b(?i:bottom|center|left|right|top|(closest|farthest)-(corner|side)){{break}} 2183 scope: support.constant.property-value.css 2184 - include: color-values 2185 - include: length-constants 2186 - include: percentage-constants 2187 2188 ###[ BUILTIN SHAPE FUNCTIONS ]################################################# 2189 2190 # Shape Functions 2191 # https://www.w3.org/TR/css-shapes-1/#typedef-basic-shape 2192 shape-functions: 2193 # rect() - Deprecated 2194 # https://drafts.fxtf.org/css-masking-1/#funcdef-clip-rect 2195 - match: \b(?i:rect)(?=\() 2196 scope: meta.function-call.identifier.css support.function.shape.css 2197 push: 2198 - meta_include_prototype: false 2199 - match: \( 2200 scope: punctuation.section.group.begin.css 2201 set: 2202 - meta_scope: meta.function-call.arguments.css meta.group.css 2203 - include: function-arguments-common 2204 - match: \b(?i:auto){{break}} 2205 scope: support.constant.property-value.css 2206 - include: calc-functions 2207 - include: length-constants 2208 2209 # inset() 2210 # https://www.w3.org/TR/css-shapes-1/#funcdef-inset 2211 - match: \b(?i:inset)(?=\() 2212 scope: meta.function-call.identifier.css support.function.shape.css 2213 push: 2214 - meta_include_prototype: false 2215 - match: \( 2216 scope: punctuation.section.group.begin.css 2217 set: 2218 - meta_scope: meta.function-call.arguments.css meta.group.css 2219 - include: function-arguments-common 2220 - match: \b(?i:round){{break}} 2221 scope: keyword.other.shape.css 2222 - include: calc-functions 2223 - include: length-constants 2224 - include: percentage-constants 2225 2226 # circle() 2227 # https://www.w3.org/TR/css-shapes-1/#funcdef-circle 2228 # ellipse() 2229 # https://www.w3.org/TR/css-shapes-1/#funcdef-ellipse 2230 - match: \b(?i:circle|ellipse)(?=\() 2231 scope: meta.function-call.identifier.css support.function.shape.css 2232 push: 2233 - meta_include_prototype: false 2234 - match: \( 2235 scope: punctuation.section.group.begin.css 2236 set: 2237 - meta_scope: meta.function-call.arguments.css meta.group.css 2238 - include: function-arguments-common 2239 - match: \b(?i:at){{break}} 2240 scope: keyword.other.shape.css 2241 - match: \b(?i:top|right|bottom|left|center|closest-side|farthest-side){{break}} 2242 scope: support.constant.property-value.css 2243 - include: calc-functions 2244 - include: length-constants 2245 - include: percentage-constants 2246 2247 # polygon() 2248 # https://www.w3.org/TR/css-shapes-1/#funcdef-polygon 2249 - match: \b(?i:polygon)(?=\() 2250 scope: meta.function-call.identifier.css support.function.shape.css 2251 push: 2252 - meta_include_prototype: false 2253 - match: \( 2254 scope: punctuation.section.group.begin.css 2255 set: 2256 - meta_scope: meta.function-call.arguments.css meta.group.css 2257 - include: function-arguments-common 2258 - include: comma-delimiters 2259 - match: \b(?i:nonzero|evenodd){{break}} 2260 scope: support.constant.property-value.css 2261 - include: calc-functions 2262 - include: length-constants 2263 - include: percentage-constants 2264 2265 ###[ BUILTIN TIMING FUNCTIONS ]################################################ 2266 2267 # Timing Functions 2268 # https://www.w3.org/TR/web-animations-1/#timing-functions 2269 timing-functions: 2270 # cubic-bezier() 2271 # https://www.w3.org/TR/web-animations-1/#cubic-bzier-timing-function 2272 - match: \b(?i:cubic-bezier)(?=\() 2273 scope: meta.function-call.identifier.css support.function.timing.css 2274 push: 2275 - meta_include_prototype: false 2276 - match: \( 2277 scope: punctuation.section.group.begin.css 2278 set: 2279 - meta_scope: meta.function-call.arguments.css meta.group.css 2280 - include: function-arguments-common 2281 - include: comma-delimiters 2282 - include: calc-functions 2283 - include: scalar-constants 2284 2285 # steps() 2286 # https://www.w3.org/TR/web-animations-1/#step-timing-function 2287 - match: \b(?i:steps)(?=\() 2288 scope: meta.function-call.identifier.css support.function.timing.css 2289 push: 2290 - meta_include_prototype: false 2291 - match: \( 2292 scope: punctuation.section.group.begin.css 2293 set: 2294 - meta_scope: meta.function-call.arguments.css meta.group.css 2295 - include: function-arguments-common 2296 - include: comma-delimiters 2297 - include: calc-functions 2298 - match: \b(?i:end|middle|start){{break}} 2299 scope: keyword.other.timing.css 2300 - include: scalar-integer-constants 2301 2302 ###[ BUILTIN TRANSFORM FUNCTIONS ]############################################# 2303 2304 # Transform Functions 2305 # https://www.w3.org/TR/css-transforms-1/#transform-functions 2306 transform-functions: 2307 # transform functions with comma separated <number> types 2308 # matrix(), scale(), matrix3d(), scale3d() 2309 - match: \b(?i:matrix3d|scale3d|matrix|scale)(?=\() 2310 scope: meta.function-call.identifier.css support.function.transform.css 2311 push: 2312 - meta_include_prototype: false 2313 - match: \( 2314 scope: punctuation.section.group.begin.css 2315 set: 2316 - meta_scope: meta.function-call.arguments.css meta.group.css 2317 - include: function-arguments-common 2318 - include: comma-delimiters 2319 - include: calc-functions 2320 - include: scalar-constants 2321 2322 # transform functions with comma separated <number> or <length> types 2323 # translate(), translate3d() 2324 - match: \b(?i:translate(3d)?)(?=\() 2325 scope: meta.function-call.identifier.css support.function.transform.css 2326 push: 2327 - meta_include_prototype: false 2328 - match: \( 2329 scope: punctuation.section.group.begin.css 2330 set: 2331 - meta_scope: meta.function-call.arguments.css meta.group.css 2332 - include: function-arguments-common 2333 - include: comma-delimiters 2334 - include: calc-functions 2335 - include: percentage-constants 2336 - include: length-constants 2337 - include: scalar-constants 2338 2339 # transform functions with a single <number> or <length> type 2340 # translateX(), translateY() 2341 - match: \b(?i:translate[XY])(?=\() 2342 scope: meta.function-call.identifier.css support.function.transform.css 2343 push: 2344 - meta_include_prototype: false 2345 - match: \( 2346 scope: punctuation.section.group.begin.css 2347 set: 2348 - meta_scope: meta.function-call.arguments.css meta.group.css 2349 - include: function-arguments-common 2350 - include: calc-functions 2351 - include: percentage-constants 2352 - include: length-constants 2353 - include: scalar-constants 2354 2355 # transform functions with a single <angle> type 2356 # rotate(), skewX(), skewY(), rotateX(), rotateY(), rotateZ() 2357 - match: \b(?i:rotate[XYZ]?|skew[XY])(?=\() 2358 scope: meta.function-call.identifier.css support.function.transform.css 2359 push: 2360 - meta_include_prototype: false 2361 - match: \( 2362 scope: punctuation.section.group.begin.css 2363 set: 2364 - meta_scope: meta.function-call.arguments.css meta.group.css 2365 - include: function-arguments-common 2366 - include: calc-functions 2367 - include: angle-constants 2368 2369 # transform functions with comma separated <angle> types 2370 # skew() 2371 - match: \b(?i:skew)(?=\() 2372 scope: meta.function-call.identifier.css support.function.transform.css 2373 push: 2374 - meta_include_prototype: false 2375 - match: \( 2376 scope: punctuation.section.group.begin.css 2377 set: 2378 - meta_scope: meta.function-call.arguments.css meta.group.css 2379 - include: function-arguments-common 2380 - include: comma-delimiters 2381 - include: calc-functions 2382 - include: angle-constants 2383 2384 # transform functions with a single <length> type 2385 # translateZ(), perspective() 2386 - match: \b(?i:translateZ|perspective)(?=\() 2387 scope: meta.function-call.identifier.css support.function.transform.css 2388 push: 2389 - meta_include_prototype: false 2390 - match: \( 2391 scope: punctuation.section.group.begin.css 2392 set: 2393 - meta_scope: meta.function-call.arguments.css meta.group.css 2394 - include: function-arguments-common 2395 - include: calc-functions 2396 - include: length-constants 2397 2398 # transform functions with a comma separated <number> or <angle> types 2399 # rotate3d() 2400 - match: \b(?i:rotate3d)(?=\() 2401 scope: meta.function-call.identifier.css support.function.transform.css 2402 push: 2403 - meta_include_prototype: false 2404 - match: \( 2405 scope: punctuation.section.group.begin.css 2406 set: 2407 - meta_scope: meta.function-call.arguments.css meta.group.css 2408 - include: function-arguments-common 2409 - include: comma-delimiters 2410 - include: calc-functions 2411 - include: angle-constants 2412 - include: scalar-constants 2413 2414 # transform functions with a single <number> type 2415 # scaleX(), scaleY(), scaleZ() 2416 - match: \b(?i:scale[XYZ])(?=\() 2417 scope: meta.function-call.identifier.css support.function.transform.css 2418 push: 2419 - meta_include_prototype: false 2420 - match: \( 2421 scope: punctuation.section.group.begin.css 2422 set: 2423 - meta_scope: meta.function-call.arguments.css meta.group.css 2424 - include: function-arguments-common 2425 - include: comma-delimiters 2426 - include: calc-functions 2427 - include: scalar-constants 2428 2429 ###[ BUILTIN VALUE FUNCTIONS ]################################################# 2430 2431 # attr() 2432 # https://www.w3.org/TR/css3-values/#funcdef-attr 2433 attr-functions: 2434 - match: \b(?i:attr)(?=\() 2435 scope: meta.function-call.identifier.css support.function.attr.css 2436 push: 2437 - meta_include_prototype: false 2438 - match: \( 2439 scope: punctuation.section.group.begin.css 2440 set: 2441 - attr-function-arguments-value 2442 - attr-function-arguments-identifier 2443 2444 attr-function-arguments-identifier: 2445 - include: namespace-prefixes 2446 - include: quoted-string 2447 - include: var-function 2448 - match: '{{ident}}' 2449 scope: entity.other.attribute-name.css 2450 pop: 1 2451 - include: comments 2452 - include: else-pop 2453 2454 attr-function-arguments-value: 2455 - meta_scope: meta.function-call.arguments.css meta.group.css 2456 - include: function-arguments-common 2457 - include: comma-delimiters 2458 - match: '{{units}}' 2459 scope: keyword.other.unit.css 2460 - include: color-values 2461 - include: common-constants 2462 - include: generic-font-names 2463 - include: numeric-constants 2464 2465 calc-functions: 2466 # calc() 2467 # https://www.w3.org/TR/css3-values/#funcdef-calc 2468 - match: \b(?i:calc)(?=\() 2469 scope: meta.function-call.identifier.css support.function.calc.css 2470 push: 2471 - meta_include_prototype: false 2472 - match: \( 2473 scope: punctuation.section.group.begin.css 2474 set: 2475 - meta_scope: meta.function-call.arguments.css meta.group.css 2476 - include: calc-function-arguments-content 2477 2478 # clamp() 2479 # https://developer.mozilla.org/en-US/docs/Web/CSS/clamp() 2480 # max() 2481 # https://developer.mozilla.org/en-US/docs/Web/CSS/max() 2482 # min() 2483 # https://developer.mozilla.org/en-US/docs/Web/CSS/min() 2484 - match: \b(?i:clamp|max|min)(?=\() 2485 scope: meta.function-call.identifier.css support.function.calc.css 2486 push: 2487 - meta_include_prototype: false 2488 - match: \( 2489 scope: punctuation.section.group.begin.css 2490 set: 2491 - meta_scope: meta.function-call.arguments.css meta.group.css 2492 - include: calc-function-arguments-content 2493 - include: comma-delimiters 2494 2495 calc-function-arguments-content: 2496 - meta_scope: meta.group.css 2497 - match: \) 2498 scope: punctuation.section.group.end.css 2499 set: maybe-illegal-operator 2500 - match: \( 2501 scope: punctuation.section.group.begin.css 2502 push: calc-function-arguments-content 2503 - include: terminator-pop 2504 - include: comments 2505 - include: attr-functions 2506 - include: calc-functions 2507 - include: var-functions 2508 - match: '{{float}}({{units}})?' 2509 scope: meta.number.float.decimal.css 2510 captures: 2511 1: keyword.operator.arithmetic.css 2512 2: constant.numeric.value.css 2513 3: punctuation.separator.decimal.css 2514 4: constant.numeric.suffix.css 2515 push: maybe-illegal-operator 2516 - match: '{{integer}}({{units}})?' 2517 scope: meta.number.integer.decimal.css 2518 captures: 2519 1: keyword.operator.arithmetic.css 2520 2: constant.numeric.value.css 2521 3: constant.numeric.suffix.css 2522 push: maybe-illegal-operator 2523 - match: '[-+*/]' 2524 scope: keyword.operator.arithmetic.css 2525 2526 toggle-functions: 2527 # toggle() 2528 # https://www.w3.org/TR/css3-values/#toggle-notation 2529 - match: \b(?i:toggle)(?=\() 2530 scope: meta.function-call.identifier.css support.function.toggle.css 2531 push: 2532 - meta_include_prototype: false 2533 - match: \( 2534 scope: punctuation.section.group.begin.css 2535 set: 2536 - meta_scope: meta.function-call.arguments.css meta.group.css 2537 - include: function-arguments-common 2538 - include: comma-delimiters 2539 - include: calc-functions 2540 - include: vendor-prefixes 2541 - include: color-values 2542 - include: common-constants 2543 - include: numeric-constants 2544 - include: quoted-strings 2545 2546 # url() 2547 # https://drafts.csswg.org/css-values-3/#urls 2548 url-functions: 2549 - match: \b(?i:url)(?=\() 2550 scope: meta.function-call.identifier.css support.function.url.css 2551 push: 2552 - meta_include_prototype: false 2553 - match: \( 2554 scope: punctuation.section.group.begin.css 2555 set: 2556 - meta_scope: meta.function-call.arguments.css meta.group.css 2557 - include: function-arguments-common 2558 - include: quoted-urls 2559 - include: unquoted-urls 2560 2561 # var() 2562 # https://drafts.csswg.org/css-variables/#funcdef-var 2563 # Note: Match valid groups before `var-functions` context is included. 2564 var-functions: 2565 - match: \b(?i:var)(?=\() 2566 scope: meta.function-call.identifier.css support.function.var.css 2567 push: var-function-arguments 2568 - include: illegal-groups 2569 2570 var-function: 2571 - match: \b(?i:var)(?=\() 2572 scope: meta.function-call.identifier.css support.function.var.css 2573 set: var-function-arguments 2574 - include: illegal-groups 2575 2576 var-function-arguments: 2577 - match: \( 2578 scope: punctuation.section.group.begin.css 2579 set: 2580 - var-function-arguments-defaults 2581 - var-function-arguments-identifier 2582 2583 var-function-arguments-defaults: 2584 - meta_scope: meta.function-call.arguments.css meta.group.css 2585 - include: group-end 2586 - include: font-property-value-content 2587 2588 var-function-arguments-identifier: 2589 - match: '{{custom_ident}}' 2590 scope: variable.other.custom-property.css 2591 pop: 1 2592 - include: comments 2593 - include: else-pop 2594 2595 ###[ OTHER FUNCTIONS ]######################################################### 2596 2597 other-functions: 2598 - match: '{{ident}}(?=\()' 2599 scope: meta.function-call.identifier.css variable.function.css 2600 push: other-functions-arguments 2601 2602 other-functions-arguments: 2603 - meta_include_prototype: false 2604 - match: \( 2605 scope: punctuation.section.group.begin.css 2606 set: 2607 - meta_scope: meta.function-call.arguments.css meta.group.css 2608 - include: function-arguments-common 2609 - include: comma-delimiters 2610 - include: calc-functions 2611 - include: quoted-strings 2612 - include: numeric-constants 2613 - include: other-constants 2614 2615 ###[ CONSTANTS ]############################################################### 2616 2617 color-constants: 2618 # https://www.w3.org/TR/CSS22/syndata.html#color-units 2619 - match: '{{standard_colors}}' 2620 scope: support.constant.color.w3c.standard.css 2621 # https://www.w3.org/TR/css3-color/#svg-color 2622 - match: '{{extended_colors}}' 2623 scope: support.constant.color.w3c.extended.css 2624 # Special Color Keywords 2625 # https://www.w3.org/TR/css3-color/#currentcolor 2626 # https://www.w3.org/TR/css3-color/#transparent-def 2627 - match: \b(?i:currentColor|transparent){{break}} 2628 scope: support.constant.color.w3c.special.css 2629 # Hex Color 2630 - match: (#)(\h{3}|\h{6}){{break}} 2631 scope: constant.other.color.rgb-value.css 2632 captures: 2633 1: punctuation.definition.constant.css 2634 # RGBA Hexadecimal Colors 2635 # https://en.wikipedia.org/wiki/RGBA_color_space#RGBA_hexadecimal_.28word-order.29 2636 - match: (#)(\h{4}|\h{8}){{break}} 2637 scope: constant.other.color.rgba-value.css 2638 captures: 2639 1: punctuation.definition.constant.css 2640 2641 common-constants: 2642 - match: '{{property_value_constants}}' 2643 scope: support.constant.property-value.css 2644 2645 counter-speak-as-constants: 2646 - match: '{{counter_speak_as_constants}}' 2647 scope: support.constant.property-value.css 2648 2649 counter-system-constants: 2650 - match: '{{counter_system_constants}}' 2651 scope: support.constant.symbol-type.css 2652 2653 direction-constants: 2654 - match: \b(ltr|rtl){{break}} 2655 scope: support.constant.property-value.css 2656 2657 # Generic Font Families 2658 # https://drafts.csswg.org/css-fonts-3/#family-name-value 2659 generic-font-names: 2660 - match: '{{font_family_constants}}' 2661 scope: support.constant.property-value.css 2662 2663 grid-constants: 2664 - match: \b(?i:auto|max-content|min-content){{break}} 2665 scope: support.constant.property-value.css 2666 2667 other-constants: 2668 - match: '{{ident}}' 2669 scope: constant.other.css 2670 2671 ###[ NUMERIC CONSTANTS ]####################################################### 2672 2673 # https://www.w3.org/TR/css3-values/#numeric-constantss 2674 numeric-constants: 2675 - match: '{{float}}({{units}})?' 2676 scope: meta.number.float.decimal.css 2677 captures: 2678 1: keyword.operator.arithmetic.css 2679 2: constant.numeric.value.css 2680 3: punctuation.separator.decimal.css 2681 4: constant.numeric.suffix.css 2682 - match: '{{integer}}({{units}})?' 2683 scope: meta.number.integer.decimal.css 2684 captures: 2685 1: keyword.operator.arithmetic.css 2686 2: constant.numeric.value.css 2687 3: constant.numeric.suffix.css 2688 2689 # Make sure `scalar-constants` is included after any other numeric values 2690 # as `scalar-constants` will consume all numeric values. 2691 scalar-constants: 2692 - include: scalar-float-constants 2693 - include: scalar-integer-constants 2694 2695 scalar-float-constants: 2696 - match: '{{float}}' 2697 scope: meta.number.float.decimal.css 2698 captures: 2699 1: keyword.operator.arithmetic.css 2700 2: constant.numeric.value.css 2701 3: punctuation.separator.decimal.css 2702 2703 scalar-integer-constants: 2704 - match: '{{integer}}' 2705 scope: meta.number.integer.decimal.css 2706 captures: 2707 1: keyword.operator.arithmetic.css 2708 2: constant.numeric.value.css 2709 2710 scalar-rational-constants: 2711 - match: \d+(/)\d+ 2712 scope: meta.number.rational.css constant.numeric.value.css 2713 captures: 2714 1: keyword.operator.arithmetic.css 2715 2716 angle-constants: 2717 - match: '{{float}}({{angle_units}})' 2718 scope: meta.number.float.decimal.css 2719 captures: 2720 1: keyword.operator.arithmetic.css 2721 2: constant.numeric.value.css 2722 3: punctuation.separator.decimal.css 2723 4: constant.numeric.suffix.css 2724 - match: '{{integer}}({{angle_units}})' 2725 scope: meta.number.integer.decimal.css 2726 captures: 2727 1: keyword.operator.arithmetic.css 2728 2: constant.numeric.value.css 2729 3: constant.numeric.suffix.css 2730 - match: \b0\b(?!%) 2731 scope: meta.number.integer.decimal.css constant.numeric.value.css 2732 2733 frequency-constants: 2734 - match: '{{float}}({{frequency_units}})' 2735 scope: meta.number.float.decimal.css 2736 captures: 2737 1: keyword.operator.arithmetic.css 2738 2: constant.numeric.value.css 2739 3: punctuation.separator.decimal.css 2740 4: constant.numeric.suffix.css 2741 - match: '{{integer}}({{frequency_units}})' 2742 scope: meta.number.integer.decimal.css 2743 captures: 2744 1: keyword.operator.arithmetic.css 2745 2: constant.numeric.value.css 2746 3: constant.numeric.suffix.css 2747 2748 length-constants: 2749 - match: '{{float}}({{font_relative_lengths}}|{{viewport_percentage_lengths}}|{{absolute_lengths}})' 2750 scope: meta.number.float.decimal.css 2751 captures: 2752 1: keyword.operator.arithmetic.css 2753 2: constant.numeric.value.css 2754 3: punctuation.separator.decimal.css 2755 4: constant.numeric.suffix.css 2756 - match: '{{integer}}({{font_relative_lengths}}|{{viewport_percentage_lengths}}|{{absolute_lengths}})' 2757 scope: meta.number.integer.decimal.css 2758 captures: 2759 1: keyword.operator.arithmetic.css 2760 2: constant.numeric.value.css 2761 3: constant.numeric.suffix.css 2762 - match: \b0\b(?!%) 2763 scope: meta.number.integer.decimal.css constant.numeric.value.css 2764 2765 resolution-constants: 2766 - match: '{{float}}({{resolution_units}})' 2767 scope: meta.number.float.decimal.css 2768 captures: 2769 1: keyword.operator.arithmetic.css 2770 2: constant.numeric.value.css 2771 3: punctuation.separator.decimal.css 2772 4: constant.numeric.suffix.css 2773 - match: '{{integer}}({{resolution_units}})' 2774 scope: meta.number.integer.decimal.css 2775 captures: 2776 1: keyword.operator.arithmetic.css 2777 2: constant.numeric.value.css 2778 3: constant.numeric.suffix.css 2779 2780 percentage-constants: 2781 - match: '{{float}}(%)' 2782 scope: meta.number.float.decimal.css 2783 captures: 2784 1: keyword.operator.arithmetic.css 2785 2: constant.numeric.value.css 2786 3: punctuation.separator.decimal.css 2787 4: constant.numeric.suffix.css 2788 - match: '{{integer}}(%)' 2789 scope: meta.number.integer.decimal.css 2790 captures: 2791 1: keyword.operator.arithmetic.css 2792 2: constant.numeric.value.css 2793 3: constant.numeric.suffix.css 2794 2795 time-constants: 2796 - match: '{{float}}({{duration_units}})' 2797 scope: meta.number.float.decimal.css 2798 captures: 2799 1: keyword.operator.arithmetic.css 2800 2: constant.numeric.value.css 2801 3: punctuation.separator.decimal.css 2802 4: constant.numeric.suffix.css 2803 - match: '{{integer}}({{duration_units}})' 2804 scope: meta.number.integer.decimal.css 2805 captures: 2806 1: keyword.operator.arithmetic.css 2807 2: constant.numeric.value.css 2808 3: constant.numeric.suffix.css 2809 2810 # Unicode Ranges 2811 # https://www.w3.org/TR/css-syntax-3/#urange 2812 unicode-ranges: 2813 - match: ([Uu]\+)([\h?]{1,6}(?:(-)\h{1,6})?) 2814 scope: meta.number.unicode-range.css 2815 captures: 2816 1: constant.numeric.prefix.css 2817 2: constant.numeric.value.css 2818 3: punctuation.separator.range.css 2819 2820 ###[ STRING CONSTANTS ]######################################################## 2821 2822 # Font Family Names 2823 # https://drafts.csswg.org/css-fonts-3/#family-name-value 2824 font-family-names: 2825 - match: '{{ident}}(?:\s+{{ident}}(?!\())*' 2826 scope: meta.string.css string.unquoted.css 2827 2828 # Language Ranges 2829 # https://drafts.csswg.org/selectors-4/#language-range 2830 language-ranges: 2831 - match: (?={{nmstart}}|\*) 2832 push: 2833 - meta_include_prototype: false 2834 - meta_scope: meta.string.css string.unquoted.css 2835 - include: string-content 2836 - match: \* 2837 scope: variable.language.wildcard.asterisk.css 2838 - match: (?!{{nmchar}}) 2839 pop: 1 2840 2841 # Named Grid Lines 2842 # https://drafts.csswg.org/css-grid/#named-lines 2843 line-names: 2844 - match: \[ 2845 scope: punctuation.section.brackets.begin.css 2846 push: line-names-content 2847 2848 line-names-content: 2849 - meta_scope: meta.line-names.css meta.brackets.css 2850 - match: \] 2851 scope: punctuation.section.brackets.end.css 2852 pop: 1 2853 - match: '{{ident}}' 2854 scope: meta.string.css string.unquoted.line-name.css 2855 - include: terminator-pop 2856 2857 quoted-strings: 2858 - match: \" 2859 scope: punctuation.definition.string.begin.css 2860 push: double-quoted-string-content 2861 - match: \' 2862 scope: punctuation.definition.string.begin.css 2863 push: single-quoted-string-content 2864 2865 quoted-string: 2866 - match: \" 2867 scope: punctuation.definition.string.begin.css 2868 set: double-quoted-string-content 2869 - match: \' 2870 scope: punctuation.definition.string.begin.css 2871 set: single-quoted-string-content 2872 2873 double-quoted-string-content: 2874 - meta_include_prototype: false 2875 - meta_scope: meta.string.css string.quoted.double.css 2876 - match: \" 2877 scope: punctuation.definition.string.end.css 2878 pop: 1 2879 - include: string-content 2880 2881 single-quoted-string-content: 2882 - meta_include_prototype: false 2883 - meta_scope: meta.string.css string.quoted.single.css 2884 - match: \' 2885 scope: punctuation.definition.string.end.css 2886 pop: 1 2887 - include: string-content 2888 2889 string-content: 2890 - meta_include_prototype: false 2891 - match: \n 2892 scope: invalid.illegal.newline.css 2893 pop: 1 2894 - match: \\\s*\n 2895 scope: constant.character.escape.newline.css 2896 - match: \\(?:\h{1,6}|.) 2897 scope: constant.character.escape.css 2898 2899 ###[ URL STRING CONSTANTS ]#################################################### 2900 2901 quoted-urls: 2902 - match: \" 2903 scope: 2904 meta.string.css string.quoted.double.css 2905 punctuation.definition.string.begin.css 2906 push: double-quoted-url-content 2907 - match: \' 2908 scope: 2909 meta.string.css string.quoted.single.css 2910 punctuation.definition.string.begin.css 2911 push: single-quoted-url-content 2912 2913 double-quoted-url-content: 2914 - meta_include_prototype: false 2915 - meta_content_scope: 2916 meta.path.url.css 2917 meta.string.css string.quoted.double.css 2918 - match: \" 2919 scope: 2920 meta.string.css string.quoted.double.css 2921 punctuation.definition.string.end.css 2922 pop: 1 2923 - include: string-content 2924 - include: url-content 2925 2926 single-quoted-url-content: 2927 - meta_include_prototype: false 2928 - meta_content_scope: 2929 meta.path.url.css 2930 meta.string.css string.quoted.single.css 2931 - match: \' 2932 scope: 2933 meta.string.css string.quoted.single.css 2934 punctuation.definition.string.end.css 2935 pop: 1 2936 - include: string-content 2937 - include: url-content 2938 2939 # Unquoted URL token 2940 # https://drafts.csswg.org/css-syntax-3/#consume-a-url-token 2941 unquoted-urls: 2942 - match: (?=[[:alnum:]/]) 2943 push: unquoted-url-content 2944 2945 unquoted-url-content: 2946 - meta_include_prototype: false 2947 - meta_content_scope: 2948 meta.path.url.css 2949 meta.string.css string.unquoted.css 2950 - match: '["''(]' 2951 scope: invalid.illegal.unexpected-token.css 2952 set: 2953 - meta_include_prototype: false 2954 - match: (?=\)) 2955 pop: 1 2956 - include: string-content 2957 - match: (?=\)) 2958 pop: 1 2959 - include: url-content 2960 2961 url-content: 2962 - include: string-content 2963 - match: (%)\h{2} 2964 scope: constant.character.escape.url.css 2965 captures: 2966 1: punctuation.definition.escape.css 2967 - match: '[/&?#]|://' 2968 scope: punctuation.separator.path.css 2969 2970 ###[ OPERATORS ]############################################################### 2971 2972 common-operators: 2973 - match: \!\s*(?i:important){{break}} 2974 scope: keyword.other.important.css 2975 - match: / 2976 scope: keyword.operator.arithmetic.css 2977 2978 color-adjuster-operators: 2979 - match: '[-+*](?=\s)' 2980 scope: keyword.operator.arithmetic.css 2981 - match: '[-+*/]' 2982 scope: invalid.illegal.operator.css 2983 2984 maybe-illegal-operator: 2985 - match: '[-+](?=\s*\d)' 2986 scope: invalid.illegal.operator.css 2987 pop: 1 2988 - match: \s*([-+])(?=\d) 2989 captures: 2990 1: invalid.illegal.operator.css 2991 pop: 1 2992 - include: immediately-pop 2993 2994 ###[ PUNCTUATION ]############################################################# 2995 2996 comma-delimiters: 2997 - match: ',' 2998 scope: punctuation.separator.sequence.css 2999 3000 block-end2: 3001 - match: \} 3002 scope: punctuation.section.block.end.css 3003 pop: 2 3004 3005 group-end: 3006 - match: \) 3007 scope: punctuation.section.group.end.css 3008 pop: 1 3009 3010 rule-terminators: 3011 - match: ; 3012 scope: punctuation.terminator.rule.css 3013 3014 illegal-blocks: 3015 # https://www.w3.org/TR/CSS22/syndata.html#parsing-errors 3016 - match: \{ 3017 scope: invalid.illegal.unexpected-token.css 3018 push: 3019 - match: \} 3020 scope: invalid.illegal.unexpected-token.css 3021 pop: 1 3022 - match: \} 3023 scope: invalid.illegal.unexpected-token.css 3024 3025 illegal-groups: 3026 # https://www.w3.org/TR/CSS22/syndata.html#parsing-errors 3027 - match: \( 3028 scope: invalid.illegal.unexpected-token.css 3029 push: 3030 - match: \) 3031 scope: invalid.illegal.unexpected-token.css 3032 pop: 1 3033 - match: \) 3034 scope: invalid.illegal.unexpected-token.css 3035 3036 ###[ PROTOTYPES ]############################################################## 3037 3038 else-pop: 3039 - match: (?=\S) 3040 pop: 1 3041 3042 immediately-pop: 3043 - match: '' 3044 pop: 1 3045 3046 terminator-pop: 3047 - match: (?=[;){}]) 3048 pop: 1