-
-
Notifications
You must be signed in to change notification settings - Fork 86
Expand file tree
/
Copy pathSublime CSS.sublime-syntax
More file actions
158 lines (135 loc) · 5.03 KB
/
Sublime CSS.sublime-syntax
File metadata and controls
158 lines (135 loc) · 5.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
%YAML 1.2
---
# https://www.sublimetext.com/docs/syntax.html
scope: source.css.sublime
version: 2
hidden: true
extends: Packages/CSS/CSS.sublime-syntax
contexts:
stylesheet:
# Note: ST doesn't support at-rules
- include: comments
- include: selectors
- include: property-lists
- include: rule-terminators
- include: illegal-commas
- include: illegal-groups
at-rules: []
nested-at-rules: []
property-list-body:
# Note: ST doesn't support nested selectors
- meta_include_prototype: false
- meta_scope: meta.property-list.css meta.block.css
- match: '{{block_end}}'
scope: punctuation.section.block.end.css
pop: 1
- include: comments
- include: property-identifiers
- include: property-values
- include: rule-terminators
- include: illegal-commas
- include: illegal-blocks
- include: illegal-groups
###[ BUILTIN FUNCTIONS ]#######################################################
builtin-functions:
# Note: ST only supports a limited subset of CSS functions
- include: color-adjuster-functions
###[ COLOR FUNCTIONS ]#########################################################
color-functions:
- meta_prepend: true
# proprietary color function supported by Sublime Text
- match: \b((?i:min-contrast))(\()
captures:
1: meta.function-call.identifier.css support.function.css
2: meta.function-call.arguments.css meta.group.css punctuation.section.group.begin.css
push: color-function-argument-list-body
color-function-argument-list-body:
- meta_content_scope: meta.function-call.arguments.css meta.group.css
- match: \)
scope: meta.function-call.arguments.css meta.group.css punctuation.section.group.end.css
pop: 1
- include: var-functions
- include: color-adjuster-functions
- include: color-values
- include: none-constants
- include: numeric-constants
- include: sublime-color-variables
- include: other-constants
color-adjuster-functions:
# color adjuster functions supported by Sublime Text
- match: \b((?i:blenda?|alpha|saturation|lightness|[asl]))(\()
captures:
1: meta.function-call.identifier.css support.function.css
2: meta.function-call.arguments.css meta.group.css punctuation.section.group.begin.css
push: color-adjuster-function-argument-list-body
color-adjuster-function-argument-list-body:
- meta_content_scope: meta.function-call.arguments.css meta.group.css
- match: \)
scope: meta.function-call.arguments.css meta.group.css punctuation.section.group.end.css
pop: 1
- include: var-functions
- include: color-adjuster-operators
- include: color-values
- include: none-constants
- include: numeric-constants
- include: sublime-color-variables
- match: \b(?i:rgb|hsl|hwb){{break}}
scope: keyword.other.color-space.css
- include: other-constants
var-functions:
- match: \b((?i:var))(\()
captures:
1: meta.function-call.identifier.css support.function.css
2: meta.function-call.arguments.css meta.group.css punctuation.section.group.begin.css
push: var-function-argument-list-body
var-function:
- match: \b((?i:var))(\()
captures:
1: meta.function-call.identifier.css support.function.css
2: meta.function-call.arguments.css meta.group.css punctuation.section.group.begin.css
push: var-function-argument-list-body
var-function-argument-list-body:
# ST's `var()` function does not support default values (e.g. `var(name #fff)`)
- meta_scope: meta.function-call.var.sublime-color-scheme
- meta_content_scope: meta.function-call.arguments.css meta.group.css
- match: \)
scope: meta.function-call.arguments.css meta.group.css punctuation.section.group.end.css
pop: 1
- include: sublime-color-variables
- include: sublime-other-variables
###[ IDENTIFIERS ]#############################################################
none-constants:
# Note: required until sublimehq/Packages/pulls/3717 (<ST4149)
- match: (?i:none){{break}}
scope: constant.language.null.css
sublime-color-variables:
- match: |-
(?x)
--(?:
background
| foreground
| accent
| bluish
| cyanish
| greenish
| orangish
| pinkish
| purplish
| redish
| yellowish
){{break}}
scope: variable.language.sublime-color-scheme
sublime-other-variables:
# Supports identifiers with and without leading `--`
- match: '{{ident}}'
scope: variable.other.sublime-color-scheme
###[ PUNCTUATION ]#############################################################
illegal-commas:
# Note: required until sublimehq/Packages/pulls/3831 (<ST4174)
- match: ','
scope: invalid.illegal.unexpected-token.css
###############################################################################
variables:
# Block punctuation
# Note: required until sublimehq/Packages/pulls/4055 (<ST4193)
block_end: \}