|
16 | 16 | (?=\\s|:|$)
|
17 | 17 | '''
|
18 | 18 | 'patterns': [
|
| 19 | + { |
| 20 | + 'include': '#commas' |
| 21 | + } |
19 | 22 | {
|
20 | 23 | 'include': '#comment-block'
|
21 | 24 | }
|
22 | 25 | {
|
23 | 26 | 'include': '#escapes'
|
24 | 27 | }
|
25 | 28 | {
|
26 |
| - 'include': '#combinators' |
| 29 | + 'include': '#combinator-invalid' |
27 | 30 | }
|
28 | 31 | {
|
29 | 32 | 'include': '#selector'
|
|
34 | 37 | {
|
35 | 38 | 'include': '#rule-list'
|
36 | 39 | }
|
37 |
| - { |
38 |
| - 'include': '#nesting-selector' |
39 |
| - } |
40 | 40 | ]
|
41 | 41 | 'repository':
|
42 | 42 | 'arithmetic-operators':
|
|
483 | 483 | 'name': 'punctuation.section.supports.end.bracket.curly.css'
|
484 | 484 | 'name': 'meta.at-rule.supports.body.css'
|
485 | 485 | 'patterns': [
|
| 486 | + { |
| 487 | + 'include': '#rule-list-innards' |
| 488 | + } |
486 | 489 | {
|
487 | 490 | 'include': '$self'
|
488 | 491 | }
|
|
701 | 704 | 'combinators':
|
702 | 705 | 'patterns': [
|
703 | 706 | {
|
704 |
| - 'match': '/deep/|>>>' |
705 |
| - 'name': 'invalid.deprecated.combinator.css' |
| 707 | + 'include': '#combinator-invalid' |
706 | 708 | }
|
707 | 709 | {
|
708 | 710 | 'match': '>>|>|\\+|~'
|
709 | 711 | 'name': 'keyword.operator.combinator.css'
|
710 | 712 | }
|
711 | 713 | ]
|
| 714 | + 'combinator-invalid': |
| 715 | + 'match': '/deep/|>>>' |
| 716 | + 'name': 'invalid.deprecated.combinator.css' |
712 | 717 | 'commas':
|
713 | 718 | 'match': ','
|
714 | 719 | 'name': 'punctuation.separator.list.comma.css'
|
|
1068 | 1073 | }
|
1069 | 1074 | ]
|
1070 | 1075 | 'function-nesting':
|
| 1076 | + 'begin': '\\(' |
| 1077 | + 'beginCaptures': |
| 1078 | + '0': |
| 1079 | + 'name': 'punctuation.definition.function.begin.bracket.round.css' |
| 1080 | + 'end': '\\)' |
| 1081 | + 'endCaptures': |
| 1082 | + '0': |
| 1083 | + 'name': 'punctuation.definition.function.end.bracket.round.css' |
1071 | 1084 | 'patterns': [
|
1072 | 1085 | {
|
1073 |
| - 'begin': '\\(' |
1074 |
| - 'beginCaptures': |
1075 |
| - '0': |
1076 |
| - 'name': 'punctuation.definition.begin.bracket.round.scss' |
1077 |
| - 'end': '\\)' |
1078 |
| - 'endCaptures': |
1079 |
| - '0': |
1080 |
| - 'name': 'punctuation.definition.end.bracket.round.scss' |
1081 |
| - 'patterns': [ |
1082 |
| - { |
1083 |
| - 'include': '#arithmetic-operators' |
1084 |
| - } |
1085 |
| - { |
1086 |
| - 'include': '#property-values' |
1087 |
| - }, |
1088 |
| - { |
1089 |
| - 'include': '#function-nesting' |
1090 |
| - } |
1091 |
| - ] |
| 1086 | + 'include': '#arithmetic-operators' |
| 1087 | + } |
| 1088 | + { |
| 1089 | + 'include': '#property-values' |
| 1090 | + }, |
| 1091 | + { |
| 1092 | + 'include': '#function-nesting' |
1092 | 1093 | }
|
1093 | 1094 | ]
|
1094 | 1095 | 'functional-pseudo-classes':
|
|
1394 | 1395 | 'include': '#comment-block'
|
1395 | 1396 | }
|
1396 | 1397 | {
|
1397 |
| - "include": "#functions" |
| 1398 | + 'include': '#functions' |
1398 | 1399 | }
|
1399 | 1400 | ]
|
1400 | 1401 | }
|
|
1424 | 1425 | )
|
1425 | 1426 | (?=$|[{,\\s;]|/\\*)
|
1426 | 1427 | '''
|
1427 |
| - 'nesting-selector': |
1428 |
| - 'match': '&' |
1429 |
| - 'name': 'entity.name.tag.nesting.selector.css' |
1430 | 1428 | 'numeric-values':
|
1431 | 1429 | 'patterns': [
|
1432 | 1430 | {
|
|
1629 | 1627 | )
|
1630 | 1628 | (?![\\w-])
|
1631 | 1629 | '''
|
1632 |
| - 'name': 'support.type.property-name.css' |
| 1630 | + 'name': 'meta.property-name.css support.type.property-name.css' |
1633 | 1631 | }
|
1634 | 1632 | {
|
1635 | 1633 | 'match': '(?<![\\w-])(?i:-(?:ah|apple|atsc|epub|hp|khtml|moz|ms|o|rim|ro|tc|wap|webkit|xv)|(?:mso|prince))-[a-zA-Z-]+'
|
1636 |
| - 'name': 'support.type.vendored.property-name.css' |
| 1634 | + 'name': 'meta.property-name.css support.type.vendored.property-name.css' |
1637 | 1635 | }
|
1638 | 1636 | ]
|
1639 | 1637 | 'property-values':
|
|
1760 | 1758 | 'name': 'variable.css'
|
1761 | 1759 | }
|
1762 | 1760 | {
|
1763 |
| - 'begin': '(?<![-a-zA-Z])(?=[-a-zA-Z])' |
1764 |
| - 'end': '$|(?![-a-zA-Z])' |
1765 |
| - 'name': 'meta.property-name.css' |
1766 |
| - 'patterns': [ |
1767 |
| - { |
1768 |
| - 'include': '#property-names' |
1769 |
| - } |
1770 |
| - ] |
| 1761 | + 'include': '#shared-names' |
1771 | 1762 | }
|
1772 | 1763 | {
|
1773 |
| - 'include': '#selector-innards' |
| 1764 | + 'include': '#property-names' |
| 1765 | + } |
| 1766 | + { |
| 1767 | + 'include': '#selector' |
1774 | 1768 | }
|
1775 | 1769 | {
|
1776 | 1770 | 'begin': '(:)\\s*'
|
1777 | 1771 | 'beginCaptures':
|
1778 | 1772 | '1':
|
1779 | 1773 | 'name': 'punctuation.separator.key-value.css'
|
1780 |
| - 'end': '\\s*(;)|\\s*(?=}|\\))' |
| 1774 | + 'end': '''(?x) |
| 1775 | + \\s* # Optional whitespaces, followed by: |
| 1776 | + (?: |
| 1777 | + (;) # A semicolon |
| 1778 | + | (?= |
| 1779 | + \\} # OR a closing curly brace |
| 1780 | + | \\) # OR a closing parenthesis |
| 1781 | + | (?: # OR an opening curly brace not enclosed by quotes |
| 1782 | + [^\\'\\"]? |
| 1783 | + \\{ |
| 1784 | + [^\\'\\"]? |
| 1785 | + ) |
| 1786 | + ) |
| 1787 | + ) |
| 1788 | + ''' |
1781 | 1789 | 'endCaptures':
|
1782 | 1790 | '1':
|
1783 | 1791 | 'name': 'punctuation.terminator.rule.css'
|
|
1795 | 1803 | 'match': ';'
|
1796 | 1804 | 'name': 'punctuation.terminator.rule.css'
|
1797 | 1805 | }
|
| 1806 | + { |
| 1807 | + 'begin': '(?<![-a-zA-Z])(?=[-a-zA-Z])' |
| 1808 | + 'end': '$|(?![-a-zA-Z])' |
| 1809 | + 'name': 'meta.property-name.css' |
| 1810 | + } |
1798 | 1811 | ]
|
1799 | 1812 | 'selector':
|
1800 |
| - 'begin': '''(?x) |
| 1813 | + 'begin': '''(?xi) |
| 1814 | + # Match must be preceded by one of the following: |
| 1815 | + (?<= |
| 1816 | + ^ # Start of line |
| 1817 | + | (^|[^\\:])\\s # Whitespace, after the start of a line or any character except a colon (which denotes a property) |
| 1818 | + | ; # Semicolon (condensed property list syntax) |
| 1819 | + | [{}] # Opening or closing brace (condensed property list syntax) |
| 1820 | + | \\*/ # Comment end |
| 1821 | + | \\\\(?:[0-9a-fA-F]{1,6}|.) # Escape sequence |
| 1822 | + ) |
| 1823 | +
|
| 1824 | + # Match may contain any of the following: |
1801 | 1825 | (?=
|
1802 |
| - (?:\\|)? # Possible anonymous namespace prefix |
1803 | 1826 | (?:
|
1804 |
| - [-\\[:.*\\#a-zA-Z_] # Valid selector character |
1805 |
| - | |
1806 |
| - [^\\x00-\\x7F] # Which can include non-ASCII symbols |
1807 |
| - | |
1808 |
| - \\\\ # Or an escape sequence |
1809 |
| - (?:[0-9a-fA-F]{1,6}|.) |
| 1827 | + # Match must start with one of the following: |
| 1828 | + & # Nesting selector |
| 1829 | + | \\* # Universal selector |
| 1830 | + | [>~+] # Selector combinator |
| 1831 | + | \\| # Selector namespace separator |
| 1832 | + | \\[ # Attribute selector opening bracket |
| 1833 | + | [a-zA-Z] # Letter |
| 1834 | + | [^\\x00-\\x7F] # Non-ASCII symbols |
| 1835 | + | \\\\(?:[0-9a-fA-F]{1,6}|.) # Escape sequence |
| 1836 | +
|
| 1837 | + # Or one of the following symbols, followed by a word character, hyphen, or escape sequence: |
| 1838 | + | (?: |
| 1839 | + \\. # Class selector |
| 1840 | + | \\# # ID selector |
| 1841 | + ) |
| 1842 | + (?: |
| 1843 | + [\\w-] # Word character or hyphen |
| 1844 | + | \\\\(?: # Escape sequence |
| 1845 | + [0-9a-fA-F]{1,6} |
| 1846 | + | . |
| 1847 | + ) |
| 1848 | + ) |
| 1849 | +
|
| 1850 | + # Or one of the following symbols, followed a letter or hyphen: |
| 1851 | + | (?: |
| 1852 | + \\: # Pseudo-class |
| 1853 | + | \\:\\: # Pseudo-element |
| 1854 | + ) |
| 1855 | + [a-zA-Z-] # Letter or hyphen |
1810 | 1856 | )
|
1811 | 1857 | )
|
1812 |
| - ''' |
1813 |
| - 'end': '(?=\\s*[/@{)])' |
| 1858 | +
|
| 1859 | + # Match must NOT contain any of the following: |
| 1860 | + (?! |
| 1861 | + [\\w-]*[\\:]+\\s # One or more colons immediately followed by a whitespace (denotes a property or invalid sequence) |
| 1862 | + | [^{]*; # Any characters and a semicolon before an opening bracket (denotes the end of a property) |
| 1863 | + | [^{]*} # A closing bracket before an opening bracket (denotes a property) |
| 1864 | + | [^\\:]+(\\:\\:):+ # More than two colons (invalid sequence) |
| 1865 | + ) |
| 1866 | + ''' |
| 1867 | + 'end': '''(?x) |
| 1868 | + # Match must end with: |
| 1869 | + (?= |
| 1870 | + \\s* # Optional whitespace and one of the following: |
| 1871 | + (?: |
| 1872 | + \\/ # Comment |
| 1873 | + | @ # At-rule |
| 1874 | + | { # Opening property list brace |
| 1875 | + | \\) # Closing function brace (for passing test on `some-edgy-new-function(`) |
| 1876 | + | $ # End of line |
| 1877 | + ) |
| 1878 | + ) |
| 1879 | + ''' |
1814 | 1880 | 'name': 'meta.selector.css'
|
1815 | 1881 | 'patterns': [
|
1816 | 1882 | {
|
|
1843 | 1909 | [-\\w*]+
|
1844 | 1910 | \\|
|
1845 | 1911 | (?!
|
1846 |
| - [-\\[:.*\\#a-zA-Z_] # Make sure there's a selector to match |
| 1912 | + [-\\[:.*&\\#a-zA-Z_] # Make sure there's a selector to match |
1847 | 1913 | | [^\\x00-\\x7F]
|
1848 | 1914 | )
|
1849 | 1915 | )
|
|
1861 | 1927 | {
|
1862 | 1928 | 'include': '#tag-names'
|
1863 | 1929 | }
|
| 1930 | + { |
| 1931 | + 'match': '&' |
| 1932 | + 'name': 'entity.name.tag.nesting.css' |
| 1933 | + } |
1864 | 1934 | {
|
1865 | 1935 | 'match': '\\*'
|
1866 | 1936 | 'name': 'entity.name.tag.wildcard.css'
|
|
2065 | 2135 | 'name': 'entity.name.tag.custom.css'
|
2066 | 2136 | }
|
2067 | 2137 | ]
|
| 2138 | + 'shared-names': |
| 2139 | + # Shared names are keywords that can be used as selector or property names. |
| 2140 | + # If the following conditions are met, the keyword is considered a selector: |
| 2141 | + 'begin': '''(?xi) |
| 2142 | + # Selector match must be preceded by one of the following: |
| 2143 | + (?<= |
| 2144 | + ^ # Start of line |
| 2145 | + | (^|[^\\:])\\s # Whitespace, after the start of a line or any character except a colon |
| 2146 | + | [{}] # Opening or closing brace (condensed property list syntax) |
| 2147 | + | \\*/ # Comment end |
| 2148 | + | \\\\(?:[0-9a-fA-F]{1,6}|.) # Escape sequence |
| 2149 | + ) |
| 2150 | +
|
| 2151 | + (?= |
| 2152 | + # Selector must match: |
| 2153 | + (?: |
| 2154 | + # HTML elements |
| 2155 | + content|font|header|image|label|mark|marquee|mask|nav|ruby|shadow|span|style |
| 2156 | + # SVG elements |
| 2157 | + |color-profile|cursor|filter|line|text |
| 2158 | + ) |
| 2159 | +
|
| 2160 | + # Selector must NOT be followed by any any of the following: |
| 2161 | + (?! |
| 2162 | + .*; # Any characters followed by a semicolon (denotes a property) |
| 2163 | + | .*} # Any characters followed by a closing bracket (denotes a property) |
| 2164 | + | - # A dash (denotes a property name) |
| 2165 | + # | \\s*\\: # A colon, unless it's with one of the following: |
| 2166 | + # (?! |
| 2167 | + # # A opening bracket before an closing bracket |
| 2168 | + # [^}]*{ |
| 2169 | + # # A pseudo-class selectors |
| 2170 | + # | active|any-link|checked|disabled|empty|enabled|first |
| 2171 | + # | (?:first|last|only)-(?:child|of-type)|focus|focus-visible|focus-within|fullscreen|host|hover |
| 2172 | + # | in-range|indeterminate|invalid|link|out-of-range |
| 2173 | + # | read-only|read-write|required|root|scope|target|unresolved |
| 2174 | + # | valid|visited |
| 2175 | +
|
| 2176 | + # # A functional pseudo-class selectors |
| 2177 | + # | (?: dir|lang |
| 2178 | + # | not|has|matches|where|is |
| 2179 | + # | nth-(?:last-)?(?:child|of-type) |
| 2180 | + # )\\( |
| 2181 | +
|
| 2182 | + # # A single-colon pseudo-element selectors |
| 2183 | + # | after |
| 2184 | + # | before |
| 2185 | + # | first-letter |
| 2186 | + # | first-line |
| 2187 | + # | (?: |
| 2188 | + # \\- |
| 2189 | + # (?: |
| 2190 | + # ah|apple|atsc|epub|hp|khtml|moz |
| 2191 | + # | ms|o|rim|ro|tc|wap|webkit|xv |
| 2192 | + # ) |
| 2193 | + # | (?: |
| 2194 | + # mso|prince |
| 2195 | + # ) |
| 2196 | + # ) |
| 2197 | + # -[a-z-]+ |
| 2198 | + # ) |
| 2199 | + ) |
| 2200 | + ) |
| 2201 | + ''' |
| 2202 | + 'end': '''(?xi) |
| 2203 | + # Selector match ends with one of the following: |
| 2204 | + (?= |
| 2205 | + \\s # Whitespace |
| 2206 | + | \\/\\* # Comment |
| 2207 | + | , # Comma |
| 2208 | + | { # Opening property list brace |
| 2209 | + | $ # End of line |
| 2210 | + ) |
| 2211 | + ''' |
| 2212 | + 'patterns': [ |
| 2213 | + { |
| 2214 | + 'include': '#selector' |
| 2215 | + } |
| 2216 | + ] |
2068 | 2217 | 'string':
|
2069 | 2218 | 'patterns': [
|
2070 | 2219 | {
|
|
2190 | 2339 | 'include': '#escapes'
|
2191 | 2340 | }
|
2192 | 2341 | ]
|
| 2342 | + |
0 commit comments