Skip to content

Commit 8903ecf

Browse files
committed
Official code starting point
1 parent 82b957f commit 8903ecf

File tree

2 files changed

+1871
-2368
lines changed

2 files changed

+1871
-2368
lines changed

src/vscode-css/grammars/css.cson

Lines changed: 8 additions & 249 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,8 @@
3434
{
3535
'include': '#rule-list'
3636
}
37-
{
38-
'include': '#nesting-selector'
39-
}
4037
]
4138
'repository':
42-
'arithmetic-operators':
43-
'match': '[*/]|(?<=\\s|^)[-+](?=\\s|$)'
44-
'name': 'keyword.operator.arithmetic.css'
4539
'at-rules':
4640
'patterns': [
4741
{
@@ -220,9 +214,6 @@
220214
'name': 'punctuation.section.media.end.bracket.curly.css'
221215
'name': 'meta.at-rule.media.body.css'
222216
'patterns': [
223-
{
224-
'include': '#nesting-at-rules'
225-
}
226217
{
227218
'include': '$self'
228219
}
@@ -641,9 +632,6 @@
641632
'name': 'punctuation.section.end.bracket.curly.css'
642633
'name': 'meta.at-rule.body.css'
643634
'patterns': [
644-
{
645-
'include': '#nesting-at-rules'
646-
}
647635
{
648636
'include': '$self'
649637
}
@@ -722,147 +710,6 @@
722710
'0':
723711
'name': 'punctuation.definition.comment.end.css'
724712
'name': 'comment.block.css'
725-
'container-condition':
726-
'begin': '\\G'
727-
'end': '(?=\\s*[{;])'
728-
'patterns': [
729-
{
730-
'include': '#comment-block'
731-
}
732-
{
733-
'include': '#escapes'
734-
}
735-
{
736-
'match': '(?xi)\n (?<=not.*)not\n # Only one `not` in allowed'
737-
'name': 'invalid.illegal.multiple-not.container.css'
738-
}
739-
{
740-
'match': '(?i)(?<=\\s|^|,|\\*/)(and|or|not)(?=\\s|{|/\\*|$)'
741-
'name': 'keyword.operator.logical.$1.container.css'
742-
}
743-
{
744-
'include': '#container-name'
745-
}
746-
{
747-
'include': '#container-query'
748-
}
749-
]
750-
'container-name':
751-
'begin': '\\G'
752-
'end': '(?xi)\n (?=(?:\\(|not)|style\\()\n # Ends when `(`, `not`, or `style(` is reached'
753-
'patterns': [
754-
{
755-
'include': '#comment-block'
756-
}
757-
{
758-
'captures':
759-
'1':
760-
'name': 'invalid.illegal.constant.container-name.container.css'
761-
'2':
762-
'name': 'support.constant.container-name.container.css'
763-
'match': '(?xi)\n (?<=^|\\s|\\*/)\n(?:\n # Invalid name\n (default|none)\n |\n # Valid names\n ([a-zA-Z0-9\\-_\\\\]+)\n )\n(?=$|[({\\s;]|/\\*)'
764-
}
765-
]
766-
'container-query':
767-
'begin': '((?<=\\s)\\()|(style)(\\()'
768-
'beginCaptures':
769-
'1':
770-
'name': 'punctuation.definition.parameters.begin.bracket.round.css'
771-
'2':
772-
'name': 'support.style-query.container.css'
773-
'3':
774-
'name': 'punctuation.definition.parameters.begin.bracket.round.css'
775-
'end': '\\)'
776-
'endCaptures':
777-
'0':
778-
'name': 'punctuation.definition.parameters.end.bracket.round.css'
779-
'patterns': [
780-
{
781-
'begin': '(?xi)\n (?<=\\s\\()\n # Rules for size <container-query>'
782-
'end': '(?=\\))'
783-
'patterns': [
784-
{
785-
'include': '#container-query-features'
786-
}
787-
{
788-
'include': '#container-size-features'
789-
}
790-
{
791-
'include': '#container-size-feature-keywords'
792-
}
793-
]
794-
}
795-
{
796-
'begin': '(?xi)\n (?<=style\\()\n # Rules for container-query <style-query>'
797-
'end': '(?=\\))'
798-
'name': 'style-query.container.css'
799-
'patterns': [
800-
{
801-
'include': '#container-query-features'
802-
}
803-
{
804-
'include': '#container-style-features'
805-
}
806-
{
807-
'include': '#container-style-feature-keywords'
808-
}
809-
]
810-
}
811-
]
812-
'container-query-features':
813-
'patterns': [
814-
{
815-
'match': ':'
816-
'name': 'punctuation.separator.key-value.css'
817-
}
818-
{
819-
'match': '>=|<=|=|<|>'
820-
'name': 'keyword.operator.comparison.css'
821-
}
822-
{
823-
'include': '#numeric-values'
824-
}
825-
{
826-
'include': '#comment-block'
827-
}
828-
]
829-
'container-size-features':
830-
'match': '(?xi)\n (?<=^|\\s|\\(|\\*/) # Preceded by whitespace, bracket or comment\n (?:\n # Standardised features\n (\n (?:min-|max-)? # Range features\n (?: aspect-ratio\n | block-size\n | height\n | inline-size\n | width\n )\n | orientation\n )\n )\n (?=\\s|$|[><:=]|\\)|/\\*) # Terminates cleanly'
831-
'name': 'support.size.property-name.container.css'
832-
'container-size-feature-keywords':
833-
'patterns': [
834-
{
835-
'match': '(?xi)\n (?<=^|\\s|:|\\*/)\n # Preceded by whitespace, colon, or comment\n (?: portrait\n | landscape\n # Orientation\n )\n (?=\\s|\\)|$)'
836-
'name': 'support.constant.property-value.container.css'
837-
}
838-
{
839-
'include': '#functions'
840-
}
841-
]
842-
'container-style-features':
843-
'match': '(?x)\n # Custom Property Name\n (?<=^|\\s|\\(|\\*/) # Preceded by whitespace, bracket or comment\n (?<![\\w-])\n --\n (?:[-a-zA-Z_] | [^\\x00-\\x7F]) # First letter\n (?:[-a-zA-Z0-9_] | [^\\x00-\\x7F] # Remainder of identifier\n |\\\\(?:[0-9a-fA-F]{1,6}|.)\n)*'
844-
'name': 'variable.style-query.container.css'
845-
'container-style-feature-keywords':
846-
'begin': '(?xi)\n (?<=[\\:\\s*|\\*/])\n # Preceded by colon and zero or more whitespaces, or a comment \n (?:(?!\\s)) # Ignore trailing whitespace'
847-
'end': '(?=[\\s|\\)|$])'
848-
'patterns': [
849-
{
850-
'match': '(true|false)'
851-
'name': 'support.constant.boolean.container.css'
852-
}
853-
{
854-
'include': '#functions'
855-
}
856-
{
857-
'include': '#property-keywords'
858-
}
859-
{
860-
'include': '#unicode-range'
861-
}
862-
{
863-
'include': '#color-keywords'
864-
}
865-
]
866713
'escapes':
867714
'patterns': [
868715
{
@@ -971,19 +818,17 @@
971818
'name': 'meta.function.calc.css'
972819
'patterns': [
973820
{
974-
'include': '#arithmetic-operators'
821+
'match': '[*/]|(?<=\\s|^)[-+](?=\\s|$)'
822+
'name': 'keyword.operator.arithmetic.css'
975823
}
976824
{
977825
'include': '#property-values'
978826
}
979-
{
980-
'include': '#function-nesting'
981-
}
982827
]
983828
}
984829
# Colours
985830
{
986-
'begin': '(?i)(?<![\\w-])(rgba?|rgb|hsla?|hsl|hwb|lab|oklab|lch|oklch|color|light-dark)(\\()'
831+
'begin': '(?i)(?<![\\w-])(rgba?|rgb|hsla?|hsl|hwb|lab|oklab|lch|oklch|color)(\\()'
987832
'beginCaptures':
988833
'1':
989834
'name': 'support.function.misc.css'
@@ -1092,9 +937,6 @@
1092937
'match': '(?i)(?<=[,\\s"]|\\*/|^)\\d+x(?=[\\s,"\')]|/\\*|$)'
1093938
'name': 'constant.numeric.other.density.css'
1094939
}
1095-
{
1096-
'include': '#arithmetic-operators'
1097-
}
1098940
{
1099941
'include': '#property-values'
1100942
}
@@ -1208,30 +1050,6 @@
12081050
]
12091051
}
12101052
]
1211-
'function-nesting':
1212-
'patterns': [
1213-
{
1214-
'begin': '\\('
1215-
'beginCaptures':
1216-
'0':
1217-
'name': 'punctuation.definition.begin.bracket.round.scss'
1218-
'end': '\\)'
1219-
'endCaptures':
1220-
'0':
1221-
'name': 'punctuation.definition.end.bracket.round.scss'
1222-
'patterns': [
1223-
{
1224-
'include': '#arithmetic-operators'
1225-
}
1226-
{
1227-
'include': '#property-values'
1228-
},
1229-
{
1230-
'include': '#function-nesting'
1231-
}
1232-
]
1233-
}
1234-
]
12351053
'functional-pseudo-classes':
12361054
'patterns': [
12371055
{
@@ -1534,9 +1352,6 @@
15341352
{
15351353
'include': '#comment-block'
15361354
}
1537-
{
1538-
"include": "#functions"
1539-
}
15401355
]
15411356
}
15421357
]
@@ -1565,53 +1380,6 @@
15651380
)
15661381
(?=$|[{,\\s;]|/\\*)
15671382
'''
1568-
'nesting-at-rules':
1569-
'patterns': [
1570-
{
1571-
'include': '#commas'
1572-
}
1573-
{
1574-
'include': '#nesting-rules'
1575-
}
1576-
{
1577-
'include': '#rule-list-innards'
1578-
}
1579-
]
1580-
'nesting-rules':
1581-
'patterns': [
1582-
{
1583-
'match': '(?xi) (?<![\\w:-])\n(?:\n header|label|mark|nav|ruby|span\n)\n(?=[+~>\\s,.\\#|&){:\\[]|/\\*|$)'
1584-
'name': 'entity.name.tag.css'
1585-
}
1586-
{
1587-
# Custom properties
1588-
'match': '''(?x) (?<![\\w-])
1589-
--
1590-
(?:[-a-zA-Z_] | [^\\x00-\\x7F]) # First letter
1591-
(?:[-a-zA-Z0-9_] | [^\\x00-\\x7F] # Remainder of identifier
1592-
|\\\\(?:[0-9a-fA-F]{1,6}|.)
1593-
)*
1594-
'''
1595-
'name': 'variable.css'
1596-
}
1597-
{
1598-
'begin': '(?<![-a-zA-Z])(?=[-a-zA-Z])'
1599-
'end': '$|(?![-a-zA-Z])'
1600-
'name': 'meta.property-name.css'
1601-
'patterns': [
1602-
{
1603-
'include': '#property-names'
1604-
}
1605-
]
1606-
}
1607-
1608-
{
1609-
'include': '#selector-innards'
1610-
}
1611-
]
1612-
'nesting-selector':
1613-
'match': '&'
1614-
'name': 'entity.name.tag.nesting.selector.css'
16151383
'numeric-values':
16161384
'patterns': [
16171385
{
@@ -1915,15 +1683,9 @@
19151683
'name': 'punctuation.section.property-list.end.bracket.curly.css'
19161684
'name': 'meta.property-list.css'
19171685
'patterns': [
1918-
{
1919-
'include': '#nesting-rules'
1920-
}
19211686
{
19221687
'include': '#rule-list-innards'
19231688
}
1924-
{
1925-
'include': '$self'
1926-
}
19271689
]
19281690
'rule-list-innards':
19291691
'patterns': [
@@ -2004,9 +1766,6 @@
20041766
]
20051767
'selector-innards':
20061768
'patterns': [
2007-
{
2008-
'include': '#nesting-selector'
2009-
}
20101769
{
20111770
'include': '#comment-block'
20121771
}
@@ -2074,7 +1833,7 @@
20741833
# Consists of a hyphen only
20751834
- # Terminated by either:
20761835
(?= $ # - End-of-line
2077-
| [\\s,.\\#)\\[:{>+~|&] # - Followed by another selector
1836+
| [\\s,.\\#)\\[:{>+~|] # - Followed by another selector
20781837
| /\\* # - Followed by a block comment
20791838
)
20801839
|
@@ -2084,7 +1843,7 @@
20841843
| \\\\(?:[0-9a-fA-F]{1,6}|.) # - Escape sequence
20851844
)*
20861845
(?: # Invalid punctuation
2087-
[!"'%(*;<?@^`|\\]}] # - NOTE: We exempt `)` from the list of checked
1846+
[!"'%&(*;<?@^`|\\]}] # - NOTE: We exempt `)` from the list of checked
20881847
| # symbols to avoid matching `:not(.invalid)`
20891848
/ (?!\\*) # - Avoid invalidating the start of a comment
20901849
)+
@@ -2115,7 +1874,7 @@
21151874
)+
21161875
) # Followed by either:
21171876
(?= $ # - End of the line
2118-
| [\\s,.\\#)\\[:{>+~|&] # - Another selector
1877+
| [\\s,.\\#)\\[:{>+~|] # - Another selector
21191878
| /\\* # - A block comment
21201879
)
21211880
'''
@@ -2138,7 +1897,7 @@
21381897
(?![0-9])
21391898
(?:[-a-zA-Z0-9_]|[^\\x00-\\x7F]|\\\\(?:[0-9a-fA-F]{1,6}|.))+
21401899
)
2141-
(?=$|[\\s,.\\#)\\[:{>+~|&]|/\\*)
1900+
(?=$|[\\s,.\\#)\\[:{>+~|]|/\\*)
21421901
'''
21431902
'name': 'entity.other.attribute-name.id.css'
21441903
}
@@ -2341,7 +2100,7 @@
23412100
| mrow|ms|mscarries|mscarry|msgroup|msline|mspace|msqrt|msrow|mstack|mstyle|msub|msubsup
23422101
| msup|mtable|mtd|mtext|mtr|munder|munderover|semantics
23432102
)
2344-
(?=[+~>\\s,.\\#|&){:\\[]|/\\*|$)
2103+
(?=[+~>\\s,.\\#|){:\\[]|/\\*|$)
23452104
'''
23462105
'name': 'entity.name.tag.css'
23472106
'unicode-range':

0 commit comments

Comments
 (0)