@jesscss/css-parser 1.0.8-alpha.6 → 2.0.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/advancedActionsParser.d.ts +60 -0
- package/lib/advancedActionsParser.js +203 -0
- package/lib/advancedActionsParser.js.map +1 -0
- package/lib/cssActionsParser.d.ts +155 -0
- package/lib/cssActionsParser.js +376 -0
- package/lib/cssActionsParser.js.map +1 -0
- package/lib/cssErrorMessageProvider.d.ts +14 -0
- package/lib/cssErrorMessageProvider.js +40 -0
- package/lib/cssErrorMessageProvider.js.map +1 -0
- package/lib/cssParser.d.ts +36 -103
- package/lib/cssParser.js +75 -58
- package/lib/cssParser.js.map +1 -0
- package/lib/cssTokens.d.ts +539 -5
- package/lib/cssTokens.js +488 -232
- package/lib/cssTokens.js.map +1 -0
- package/lib/index.d.ts +8 -16
- package/lib/index.js +9 -41
- package/lib/index.js.map +1 -0
- package/lib/productions.d.ts +273 -0
- package/lib/productions.js +3499 -0
- package/lib/productions.js.map +1 -0
- package/lib/test/ast-serialize.test.d.ts +1 -0
- package/lib/test/ast-serialize.test.js +157 -0
- package/lib/test/ast-serialize.test.js.map +1 -0
- package/lib/test/container.test.d.ts +1 -0
- package/lib/test/container.test.js +369 -0
- package/lib/test/container.test.js.map +1 -0
- package/lib/test/css-files.test.d.ts +1 -0
- package/lib/test/css-files.test.js +21 -0
- package/lib/test/css-files.test.js.map +1 -0
- package/lib/test/less-output.test.d.ts +1 -0
- package/lib/test/less-output.test.js +52 -0
- package/lib/test/less-output.test.js.map +1 -0
- package/lib/util/cst.d.ts +7 -2
- package/lib/util/cst.js +5 -9
- package/lib/util/cst.js.map +1 -0
- package/lib/util/index.d.ts +19 -13
- package/lib/util/index.js +98 -87
- package/lib/util/index.js.map +1 -0
- package/package.json +43 -20
- package/lib/productions/atRules.d.ts +0 -2
- package/lib/productions/atRules.js +0 -196
- package/lib/productions/blocks.d.ts +0 -2
- package/lib/productions/blocks.js +0 -181
- package/lib/productions/declarations.d.ts +0 -14
- package/lib/productions/declarations.js +0 -59
- package/lib/productions/root.d.ts +0 -2
- package/lib/productions/root.js +0 -49
- package/lib/productions/selectors.d.ts +0 -2
- package/lib/productions/selectors.js +0 -231
- package/lib/productions/values.d.ts +0 -2
- package/lib/productions/values.js +0 -114
package/lib/cssTokens.d.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LexerType } from './util/index.js';
|
|
2
2
|
/**
|
|
3
3
|
* references:
|
|
4
4
|
* https://github.com/antlr/grammars-v4/blob/master/css3/css3.g4
|
|
5
5
|
* https://www.lifewire.com/css2-vs-css3-3466978
|
|
6
6
|
* https://www.w3.org/TR/css-syntax-3/
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* @todo
|
|
9
|
+
* XRegExp should accept an object rather than an array of arrays,
|
|
10
|
+
* which would make extending easier.
|
|
10
11
|
*/
|
|
11
|
-
export declare const
|
|
12
|
+
export declare const rawCssFragments: () => readonly [readonly ["newline", "\\n|\\r\\n?|\\f"], readonly ["whitespace", "[ ]|\\t|{{newline}}"], readonly ["sepws", "(?:[ ]|\\t)*{{newline}}|(?:[ ]|\\t)+"], readonly ["ws", "{{whitespace}}+"], readonly ["comment", "\\/\\*[^*]*\\*+(?:[^/*][^*]*\\*+)*\\/"], readonly ["hex", "[\\da-fA-F]"], readonly ["unicode", "\\\\{{hex}}{1,6}{{whitespace}}?"], readonly ["escape", "{{unicode}}|\\\\[^\\r\\n\\f0-9a-fA-F]"], readonly ["nonascii", "[\\u0240-\\uffff]"], readonly ["nmstart", "[_a-zA-Z]|{{nonascii}}|{{escape}}"], readonly ["nmchar", "[_a-zA-Z0-9-]|{{nonascii}}|{{escape}}"], readonly ["ident", "-?{{nmstart}}{{nmchar}}*"], readonly ["unit", "(?:[a-zA-Z]|{{nonascii}}|{{escape}})+"], readonly ["string1", "\\\"(\\\\\"|\\\\{{newline}}|[^\\n\\r\\f\\\"]|{{newline}}|{{escape}})*\\\""], readonly ["string2", "\\'(\\\\'|\\\\{{newline}}|[^\\n\\r\\f\\']|{{newline}}|{{escape}})*\\'"], readonly ["integer", "[+-]?\\d+"], readonly ["number", "(?:\\d*\\.\\d+(?:[eE][+-]\\d+)?|\\d+(?:[eE][+-]\\d+))"], readonly ["wsorcomment", "({{ws}})|({{comment}})"]];
|
|
12
13
|
/**
|
|
13
14
|
* When bound to a Regular Expression, it will aggregrate capture groups onto the payload
|
|
14
15
|
*/
|
|
@@ -16,5 +17,538 @@ export declare function groupCapture(this: RegExp, text: string, startOffset: nu
|
|
|
16
17
|
/**
|
|
17
18
|
* Anything that is not 'BlockMarker' will be parsed as a generic 'Value',
|
|
18
19
|
* so 'Value' can be considered `!BlockMarker`
|
|
20
|
+
*
|
|
21
|
+
* @todo Change to Map implementation? May allow easier replacement of
|
|
22
|
+
* tokens, in extended parsers, as well as easier TokenMap.
|
|
19
23
|
*/
|
|
20
|
-
export declare const
|
|
24
|
+
export declare const rawCssTokens: () => {
|
|
25
|
+
readonly modes: {
|
|
26
|
+
readonly Default: readonly [{
|
|
27
|
+
readonly name: "Value";
|
|
28
|
+
readonly pattern: LexerType.NA;
|
|
29
|
+
}, {
|
|
30
|
+
readonly name: "NonIdent";
|
|
31
|
+
readonly pattern: LexerType.NA;
|
|
32
|
+
}, {
|
|
33
|
+
readonly name: "AtName";
|
|
34
|
+
readonly pattern: LexerType.NA;
|
|
35
|
+
}, {
|
|
36
|
+
readonly name: "MfLt";
|
|
37
|
+
readonly pattern: LexerType.NA;
|
|
38
|
+
}, {
|
|
39
|
+
readonly name: "MfGt";
|
|
40
|
+
readonly pattern: LexerType.NA;
|
|
41
|
+
}, {
|
|
42
|
+
readonly name: "Unknown";
|
|
43
|
+
readonly pattern: RegExp;
|
|
44
|
+
}, {
|
|
45
|
+
readonly name: "BlockMarker";
|
|
46
|
+
readonly pattern: LexerType.NA;
|
|
47
|
+
}, {
|
|
48
|
+
readonly name: "ListMarker";
|
|
49
|
+
readonly pattern: LexerType.NA;
|
|
50
|
+
}, {
|
|
51
|
+
readonly name: "CompareOperator";
|
|
52
|
+
readonly pattern: LexerType.NA;
|
|
53
|
+
}, {
|
|
54
|
+
readonly name: "Slash";
|
|
55
|
+
readonly pattern: LexerType.NA;
|
|
56
|
+
}, {
|
|
57
|
+
readonly name: "Selector";
|
|
58
|
+
readonly pattern: LexerType.NA;
|
|
59
|
+
}, {
|
|
60
|
+
readonly name: "Combinator";
|
|
61
|
+
readonly pattern: LexerType.NA;
|
|
62
|
+
}, {
|
|
63
|
+
readonly name: "Color";
|
|
64
|
+
readonly pattern: LexerType.NA;
|
|
65
|
+
}, {
|
|
66
|
+
readonly name: "FunctionStart";
|
|
67
|
+
readonly pattern: LexerType.NA;
|
|
68
|
+
}, {
|
|
69
|
+
readonly name: "FunctionalPseudoClass";
|
|
70
|
+
readonly pattern: LexerType.NA;
|
|
71
|
+
}, {
|
|
72
|
+
readonly name: "Assign";
|
|
73
|
+
readonly pattern: LexerType.NA;
|
|
74
|
+
}, {
|
|
75
|
+
readonly name: "QuoteStart";
|
|
76
|
+
readonly pattern: LexerType.NA;
|
|
77
|
+
}, {
|
|
78
|
+
readonly name: "Gt";
|
|
79
|
+
readonly pattern: RegExp;
|
|
80
|
+
readonly categories: readonly ["CompareOperator", "Combinator", "MfGt"];
|
|
81
|
+
}, {
|
|
82
|
+
readonly name: "Lt";
|
|
83
|
+
readonly pattern: RegExp;
|
|
84
|
+
readonly categories: readonly ["CompareOperator", "MfLt"];
|
|
85
|
+
}, {
|
|
86
|
+
readonly name: "GtEq";
|
|
87
|
+
readonly pattern: RegExp;
|
|
88
|
+
readonly categories: readonly ["CompareOperator", "MfGt"];
|
|
89
|
+
}, {
|
|
90
|
+
readonly name: "LtEq";
|
|
91
|
+
readonly pattern: RegExp;
|
|
92
|
+
readonly categories: readonly ["CompareOperator", "MfGt"];
|
|
93
|
+
}, {
|
|
94
|
+
readonly name: "LCurly";
|
|
95
|
+
readonly pattern: RegExp;
|
|
96
|
+
readonly categories: readonly ["BlockMarker"];
|
|
97
|
+
}, {
|
|
98
|
+
readonly name: "RCurly";
|
|
99
|
+
readonly pattern: RegExp;
|
|
100
|
+
readonly categories: readonly ["BlockMarker"];
|
|
101
|
+
}, {
|
|
102
|
+
readonly name: "LParen";
|
|
103
|
+
readonly pattern: RegExp;
|
|
104
|
+
readonly categories: readonly ["BlockMarker"];
|
|
105
|
+
}, {
|
|
106
|
+
readonly name: "RParen";
|
|
107
|
+
readonly pattern: RegExp;
|
|
108
|
+
readonly categories: readonly ["BlockMarker"];
|
|
109
|
+
}, {
|
|
110
|
+
readonly name: "LSquare";
|
|
111
|
+
readonly pattern: RegExp;
|
|
112
|
+
readonly categories: readonly ["BlockMarker"];
|
|
113
|
+
}, {
|
|
114
|
+
readonly name: "RSquare";
|
|
115
|
+
readonly pattern: RegExp;
|
|
116
|
+
readonly categories: readonly ["BlockMarker"];
|
|
117
|
+
}, {
|
|
118
|
+
readonly name: "Semi";
|
|
119
|
+
readonly pattern: RegExp;
|
|
120
|
+
readonly categories: readonly ["BlockMarker"];
|
|
121
|
+
}, {
|
|
122
|
+
readonly name: "AdditionOperator";
|
|
123
|
+
readonly pattern: LexerType.NA;
|
|
124
|
+
}, {
|
|
125
|
+
readonly name: "MultiplicationOperator";
|
|
126
|
+
readonly pattern: LexerType.NA;
|
|
127
|
+
}, {
|
|
128
|
+
readonly name: "Plus";
|
|
129
|
+
readonly pattern: RegExp;
|
|
130
|
+
readonly categories: readonly ["AdditionOperator", "Combinator"];
|
|
131
|
+
}, {
|
|
132
|
+
readonly name: "Minus";
|
|
133
|
+
readonly pattern: RegExp;
|
|
134
|
+
readonly categories: readonly ["AdditionOperator"];
|
|
135
|
+
}, {
|
|
136
|
+
readonly name: "Divide";
|
|
137
|
+
readonly pattern: RegExp;
|
|
138
|
+
readonly categories: readonly ["MultiplicationOperator", "Slash"];
|
|
139
|
+
}, {
|
|
140
|
+
readonly name: "Comma";
|
|
141
|
+
readonly pattern: RegExp;
|
|
142
|
+
readonly categories: readonly ["BlockMarker"];
|
|
143
|
+
}, {
|
|
144
|
+
readonly name: "Colon";
|
|
145
|
+
readonly pattern: RegExp;
|
|
146
|
+
readonly categories: readonly ["BlockMarker", "Assign"];
|
|
147
|
+
}, {
|
|
148
|
+
readonly name: "AttrMatchOperator";
|
|
149
|
+
readonly pattern: LexerType.NA;
|
|
150
|
+
}, {
|
|
151
|
+
readonly name: "Eq";
|
|
152
|
+
readonly pattern: RegExp;
|
|
153
|
+
readonly categories: readonly ["CompareOperator", "AttrMatchOperator"];
|
|
154
|
+
}, {
|
|
155
|
+
readonly name: "Star";
|
|
156
|
+
readonly pattern: RegExp;
|
|
157
|
+
readonly categories: readonly ["MultiplicationOperator"];
|
|
158
|
+
}, {
|
|
159
|
+
readonly name: "Tilde";
|
|
160
|
+
readonly pattern: RegExp;
|
|
161
|
+
readonly categories: readonly ["Combinator"];
|
|
162
|
+
}, {
|
|
163
|
+
readonly name: "Pipe";
|
|
164
|
+
readonly pattern: RegExp;
|
|
165
|
+
readonly categories: readonly ["Combinator"];
|
|
166
|
+
}, {
|
|
167
|
+
readonly name: "Column";
|
|
168
|
+
readonly pattern: RegExp;
|
|
169
|
+
readonly categories: readonly ["Combinator"];
|
|
170
|
+
}, {
|
|
171
|
+
readonly name: "AttrMatch";
|
|
172
|
+
readonly pattern: RegExp;
|
|
173
|
+
readonly categories: readonly ["AttrMatchOperator"];
|
|
174
|
+
}, {
|
|
175
|
+
readonly name: "Ident";
|
|
176
|
+
readonly pattern: LexerType.NA;
|
|
177
|
+
}, {
|
|
178
|
+
readonly name: "PlainIdent";
|
|
179
|
+
readonly pattern: "{{ident}}";
|
|
180
|
+
readonly categories: readonly ["Ident"];
|
|
181
|
+
}, {
|
|
182
|
+
readonly name: "LegacyPropIdent";
|
|
183
|
+
readonly pattern: "(?:\\*|_){{ident}}";
|
|
184
|
+
}, {
|
|
185
|
+
readonly name: "CustomProperty";
|
|
186
|
+
readonly pattern: "--{{ident}}";
|
|
187
|
+
readonly categories: readonly ["BlockMarker"];
|
|
188
|
+
}, {
|
|
189
|
+
readonly name: "CDOToken";
|
|
190
|
+
readonly pattern: RegExp;
|
|
191
|
+
readonly group: LexerType.SKIPPED;
|
|
192
|
+
}, {
|
|
193
|
+
readonly name: "CDCToken";
|
|
194
|
+
readonly pattern: RegExp;
|
|
195
|
+
readonly group: LexerType.SKIPPED;
|
|
196
|
+
}, {
|
|
197
|
+
readonly name: "UnicodeBOM";
|
|
198
|
+
readonly pattern: RegExp;
|
|
199
|
+
readonly group: LexerType.SKIPPED;
|
|
200
|
+
}, {
|
|
201
|
+
readonly name: "AttrFlag";
|
|
202
|
+
readonly pattern: RegExp;
|
|
203
|
+
readonly longer_alt: "PlainIdent";
|
|
204
|
+
readonly categories: readonly ["Ident"];
|
|
205
|
+
}, {
|
|
206
|
+
readonly name: "MathConstant";
|
|
207
|
+
readonly pattern: RegExp;
|
|
208
|
+
readonly longer_alt: "PlainIdent";
|
|
209
|
+
readonly categories: readonly ["Ident"];
|
|
210
|
+
}, {
|
|
211
|
+
readonly name: "Only";
|
|
212
|
+
readonly pattern: RegExp;
|
|
213
|
+
readonly longer_alt: "PlainIdent";
|
|
214
|
+
readonly categories: readonly ["Ident"];
|
|
215
|
+
}, {
|
|
216
|
+
readonly name: "Screen";
|
|
217
|
+
readonly pattern: RegExp;
|
|
218
|
+
readonly longer_alt: "PlainIdent";
|
|
219
|
+
readonly categories: readonly ["Ident"];
|
|
220
|
+
}, {
|
|
221
|
+
readonly name: "Print";
|
|
222
|
+
readonly pattern: RegExp;
|
|
223
|
+
readonly longer_alt: "PlainIdent";
|
|
224
|
+
readonly categories: readonly ["Ident"];
|
|
225
|
+
}, {
|
|
226
|
+
readonly name: "All";
|
|
227
|
+
readonly pattern: RegExp;
|
|
228
|
+
readonly longer_alt: "PlainIdent";
|
|
229
|
+
readonly categories: readonly ["Ident"];
|
|
230
|
+
}, {
|
|
231
|
+
readonly name: "GenericFunctionStart";
|
|
232
|
+
readonly pattern: "{{ident}}\\(";
|
|
233
|
+
readonly categories: readonly ["BlockMarker", "FunctionStart"];
|
|
234
|
+
}, {
|
|
235
|
+
readonly name: "And";
|
|
236
|
+
readonly pattern: RegExp;
|
|
237
|
+
readonly longer_alt: "PlainIdent";
|
|
238
|
+
readonly categories: readonly ["Ident"];
|
|
239
|
+
}, {
|
|
240
|
+
readonly name: "Or";
|
|
241
|
+
readonly pattern: RegExp;
|
|
242
|
+
readonly longer_alt: "PlainIdent";
|
|
243
|
+
readonly categories: readonly ["Ident"];
|
|
244
|
+
}, {
|
|
245
|
+
readonly name: "Layer";
|
|
246
|
+
readonly pattern: RegExp;
|
|
247
|
+
readonly categories: readonly ["BlockMarker", "FunctionStart"];
|
|
248
|
+
}, {
|
|
249
|
+
readonly name: "Supports";
|
|
250
|
+
readonly pattern: RegExp;
|
|
251
|
+
readonly categories: readonly ["BlockMarker", "FunctionStart"];
|
|
252
|
+
}, {
|
|
253
|
+
readonly name: "Var";
|
|
254
|
+
readonly pattern: RegExp;
|
|
255
|
+
readonly categories: readonly ["BlockMarker", "FunctionStart"];
|
|
256
|
+
}, {
|
|
257
|
+
readonly name: "Calc";
|
|
258
|
+
readonly pattern: RegExp;
|
|
259
|
+
readonly categories: readonly ["BlockMarker", "FunctionStart"];
|
|
260
|
+
}, {
|
|
261
|
+
readonly name: "From";
|
|
262
|
+
readonly pattern: RegExp;
|
|
263
|
+
readonly longer_alt: "PlainIdent";
|
|
264
|
+
readonly categories: readonly ["Ident"];
|
|
265
|
+
}, {
|
|
266
|
+
readonly name: "To";
|
|
267
|
+
readonly pattern: RegExp;
|
|
268
|
+
readonly longer_alt: "PlainIdent";
|
|
269
|
+
readonly categories: readonly ["Ident"];
|
|
270
|
+
}, {
|
|
271
|
+
readonly name: "AtKeyword";
|
|
272
|
+
readonly pattern: "@{{ident}}";
|
|
273
|
+
readonly categories: readonly ["BlockMarker", "AtName"];
|
|
274
|
+
}, {
|
|
275
|
+
readonly name: "UrlStart";
|
|
276
|
+
readonly pattern: RegExp;
|
|
277
|
+
readonly push_mode: "Url";
|
|
278
|
+
readonly categories: readonly ["BlockMarker", "FunctionStart"];
|
|
279
|
+
}, {
|
|
280
|
+
readonly name: "LegacyMSFilter";
|
|
281
|
+
readonly pattern: RegExp;
|
|
282
|
+
readonly categories: readonly ["BlockMarker"];
|
|
283
|
+
}, {
|
|
284
|
+
readonly name: "SingleQuoteStart";
|
|
285
|
+
readonly pattern: RegExp;
|
|
286
|
+
readonly push_mode: "SingleQuoteString";
|
|
287
|
+
readonly categories: readonly ["BlockMarker", "QuoteStart"];
|
|
288
|
+
}, {
|
|
289
|
+
readonly name: "DoubleQuoteStart";
|
|
290
|
+
readonly pattern: RegExp;
|
|
291
|
+
readonly push_mode: "DoubleQuoteString";
|
|
292
|
+
readonly categories: readonly ["BlockMarker", "QuoteStart"];
|
|
293
|
+
}, {
|
|
294
|
+
readonly name: "Important";
|
|
295
|
+
readonly pattern: "!(?:{{ws}}|{{comment}})*important";
|
|
296
|
+
readonly categories: readonly ["BlockMarker"];
|
|
297
|
+
}, {
|
|
298
|
+
readonly name: "AtImport";
|
|
299
|
+
readonly pattern: RegExp;
|
|
300
|
+
readonly longer_alt: "AtKeyword";
|
|
301
|
+
readonly categories: readonly ["BlockMarker", "AtName"];
|
|
302
|
+
}, {
|
|
303
|
+
readonly name: "AtMedia";
|
|
304
|
+
readonly pattern: RegExp;
|
|
305
|
+
readonly longer_alt: "AtKeyword";
|
|
306
|
+
readonly categories: readonly ["BlockMarker", "AtName"];
|
|
307
|
+
}, {
|
|
308
|
+
readonly name: "AtSupports";
|
|
309
|
+
readonly pattern: RegExp;
|
|
310
|
+
readonly longer_alt: "AtKeyword";
|
|
311
|
+
readonly categories: readonly ["BlockMarker", "AtName"];
|
|
312
|
+
}, {
|
|
313
|
+
readonly name: "AtLayer";
|
|
314
|
+
readonly pattern: RegExp;
|
|
315
|
+
readonly longer_alt: "AtKeyword";
|
|
316
|
+
readonly categories: readonly ["BlockMarker", "AtName"];
|
|
317
|
+
}, {
|
|
318
|
+
readonly name: "AtContainer";
|
|
319
|
+
readonly pattern: RegExp;
|
|
320
|
+
readonly longer_alt: "AtKeyword";
|
|
321
|
+
readonly categories: readonly ["BlockMarker", "AtName"];
|
|
322
|
+
}, {
|
|
323
|
+
readonly name: "AtScope";
|
|
324
|
+
readonly pattern: RegExp;
|
|
325
|
+
readonly longer_alt: "AtKeyword";
|
|
326
|
+
readonly categories: readonly ["BlockMarker", "AtName"];
|
|
327
|
+
}, {
|
|
328
|
+
readonly name: "AtDocument";
|
|
329
|
+
readonly pattern: RegExp;
|
|
330
|
+
readonly longer_alt: "AtKeyword";
|
|
331
|
+
readonly categories: readonly ["BlockMarker", "AtName"];
|
|
332
|
+
}, {
|
|
333
|
+
readonly name: "AtPage";
|
|
334
|
+
readonly pattern: RegExp;
|
|
335
|
+
readonly longer_alt: "AtKeyword";
|
|
336
|
+
readonly categories: readonly ["BlockMarker", "AtName"];
|
|
337
|
+
}, {
|
|
338
|
+
readonly name: "AtFontFace";
|
|
339
|
+
readonly pattern: RegExp;
|
|
340
|
+
readonly categories: readonly ["BlockMarker", "AtName"];
|
|
341
|
+
}, {
|
|
342
|
+
readonly name: "AtKeyframes";
|
|
343
|
+
readonly pattern: RegExp;
|
|
344
|
+
readonly longer_alt: "AtKeyword";
|
|
345
|
+
readonly categories: readonly ["BlockMarker", "AtName"];
|
|
346
|
+
}, {
|
|
347
|
+
readonly name: "AtNested";
|
|
348
|
+
readonly pattern: RegExp;
|
|
349
|
+
readonly longer_alt: "AtKeyword";
|
|
350
|
+
readonly categories: readonly ["BlockMarker", "AtName"];
|
|
351
|
+
}, {
|
|
352
|
+
readonly name: "AtNonNested";
|
|
353
|
+
readonly pattern: RegExp;
|
|
354
|
+
readonly longer_alt: "AtKeyword";
|
|
355
|
+
readonly categories: readonly ["BlockMarker", "AtName"];
|
|
356
|
+
}, {
|
|
357
|
+
readonly name: "Charset";
|
|
358
|
+
readonly pattern: "@charset{{ws}}?(?:{{string1}}|{{string2}});";
|
|
359
|
+
}, {
|
|
360
|
+
readonly name: "UnicodeRange";
|
|
361
|
+
readonly pattern: RegExp;
|
|
362
|
+
}, {
|
|
363
|
+
readonly name: "Ampersand";
|
|
364
|
+
readonly pattern: RegExp;
|
|
365
|
+
readonly categories: readonly ["Selector"];
|
|
366
|
+
}, {
|
|
367
|
+
readonly name: "DotName";
|
|
368
|
+
readonly pattern: "\\.{{ident}}";
|
|
369
|
+
readonly categories: readonly ["Selector"];
|
|
370
|
+
}, {
|
|
371
|
+
readonly name: "HashName";
|
|
372
|
+
readonly pattern: "#{{ident}}";
|
|
373
|
+
readonly categories: readonly ["Selector"];
|
|
374
|
+
}, {
|
|
375
|
+
readonly name: "NthPseudoClass";
|
|
376
|
+
readonly pattern: RegExp;
|
|
377
|
+
readonly categories: readonly ["BlockMarker", "FunctionalPseudoClass"];
|
|
378
|
+
}, {
|
|
379
|
+
readonly name: "SelectorPseudoClass";
|
|
380
|
+
readonly pattern: RegExp;
|
|
381
|
+
readonly categories: readonly ["BlockMarker", "FunctionalPseudoClass"];
|
|
382
|
+
}, {
|
|
383
|
+
readonly name: "PagePseudoClassKeywords";
|
|
384
|
+
readonly pattern: RegExp;
|
|
385
|
+
readonly categories: readonly ["Ident"];
|
|
386
|
+
readonly longer_alt: "PlainIdent";
|
|
387
|
+
}, {
|
|
388
|
+
readonly name: "NthOdd";
|
|
389
|
+
readonly pattern: RegExp;
|
|
390
|
+
readonly longer_alt: "PlainIdent";
|
|
391
|
+
readonly categories: readonly ["Ident"];
|
|
392
|
+
}, {
|
|
393
|
+
readonly name: "NthEven";
|
|
394
|
+
readonly pattern: RegExp;
|
|
395
|
+
readonly longer_alt: "PlainIdent";
|
|
396
|
+
readonly categories: readonly ["Ident"];
|
|
397
|
+
}, {
|
|
398
|
+
readonly name: "Of";
|
|
399
|
+
readonly pattern: RegExp;
|
|
400
|
+
readonly longer_alt: "PlainIdent";
|
|
401
|
+
readonly categories: readonly ["Ident"];
|
|
402
|
+
}, {
|
|
403
|
+
readonly name: "ColorIntStart";
|
|
404
|
+
readonly pattern: RegExp;
|
|
405
|
+
readonly categories: readonly ["Color"];
|
|
406
|
+
}, {
|
|
407
|
+
readonly name: "ColorIdentStart";
|
|
408
|
+
readonly pattern: RegExp;
|
|
409
|
+
readonly longer_alt: "HashName";
|
|
410
|
+
readonly categories: readonly ["Color", "Selector"];
|
|
411
|
+
}, {
|
|
412
|
+
readonly name: "Number";
|
|
413
|
+
readonly pattern: LexerType.NA;
|
|
414
|
+
}, {
|
|
415
|
+
readonly name: "Dimension";
|
|
416
|
+
readonly pattern: LexerType.NA;
|
|
417
|
+
}, {
|
|
418
|
+
readonly name: "Integer";
|
|
419
|
+
readonly pattern: LexerType.NA;
|
|
420
|
+
}, {
|
|
421
|
+
readonly name: "Signed";
|
|
422
|
+
readonly pattern: LexerType.NA;
|
|
423
|
+
}, {
|
|
424
|
+
readonly name: "DimensionNum";
|
|
425
|
+
readonly pattern: readonly ["({{number}})({{unit}}|%)", typeof groupCapture];
|
|
426
|
+
readonly start_chars_hint: readonly ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "."];
|
|
427
|
+
readonly line_breaks: false;
|
|
428
|
+
readonly categories: readonly ["Dimension", "Selector"];
|
|
429
|
+
}, {
|
|
430
|
+
readonly name: "DimensionInt";
|
|
431
|
+
readonly pattern: readonly ["({{integer}})({{unit}}|%)", typeof groupCapture];
|
|
432
|
+
readonly start_chars_hint: readonly ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"];
|
|
433
|
+
readonly line_breaks: false;
|
|
434
|
+
readonly categories: readonly ["Dimension", "Integer", "Selector"];
|
|
435
|
+
}, {
|
|
436
|
+
readonly name: "SignedDimensionNum";
|
|
437
|
+
readonly pattern: readonly ["([+-]{{number}})({{unit}}|%)", typeof groupCapture];
|
|
438
|
+
readonly start_chars_hint: readonly ["-", "+"];
|
|
439
|
+
readonly line_breaks: false;
|
|
440
|
+
readonly categories: readonly ["Dimension", "Signed"];
|
|
441
|
+
}, {
|
|
442
|
+
readonly name: "SignedDimensionInt";
|
|
443
|
+
readonly pattern: readonly ["([+-]{{integer}})({{unit}}|%)", typeof groupCapture];
|
|
444
|
+
readonly start_chars_hint: readonly ["-", "+"];
|
|
445
|
+
readonly line_breaks: false;
|
|
446
|
+
readonly categories: readonly ["Dimension", "Integer", "Signed"];
|
|
447
|
+
}, {
|
|
448
|
+
readonly name: "SignedInt";
|
|
449
|
+
readonly pattern: RegExp;
|
|
450
|
+
readonly longer_alt: "SignedDimensionInt";
|
|
451
|
+
readonly categories: readonly ["Integer", "Number", "Signed"];
|
|
452
|
+
}, {
|
|
453
|
+
readonly name: "UnsignedInt";
|
|
454
|
+
readonly pattern: RegExp;
|
|
455
|
+
readonly longer_alt: "DimensionInt";
|
|
456
|
+
readonly categories: readonly ["Integer", "Number"];
|
|
457
|
+
}, {
|
|
458
|
+
readonly name: "SignedNum";
|
|
459
|
+
readonly pattern: "[+-]{{number}}";
|
|
460
|
+
readonly longer_alt: "SignedDimensionNum";
|
|
461
|
+
readonly categories: readonly ["Integer", "Number", "Signed"];
|
|
462
|
+
}, {
|
|
463
|
+
readonly name: "UnsignedNum";
|
|
464
|
+
readonly pattern: "{{number}}";
|
|
465
|
+
readonly longer_alt: "DimensionNum";
|
|
466
|
+
readonly categories: readonly ["Number"];
|
|
467
|
+
}, {
|
|
468
|
+
readonly name: "NthSignedDimension";
|
|
469
|
+
readonly pattern: RegExp;
|
|
470
|
+
readonly longer_alt: "SignedDimensionInt";
|
|
471
|
+
readonly line_breaks: false;
|
|
472
|
+
readonly categories: readonly ["Dimension", "Signed"];
|
|
473
|
+
}, {
|
|
474
|
+
readonly name: "NthUnsignedDimension";
|
|
475
|
+
readonly pattern: RegExp;
|
|
476
|
+
readonly longer_alt: "DimensionNum";
|
|
477
|
+
readonly line_breaks: false;
|
|
478
|
+
readonly categories: readonly ["Dimension"];
|
|
479
|
+
}, {
|
|
480
|
+
readonly name: "NthSignedPlus";
|
|
481
|
+
readonly pattern: RegExp;
|
|
482
|
+
readonly line_breaks: false;
|
|
483
|
+
}, {
|
|
484
|
+
readonly name: "NthIdent";
|
|
485
|
+
readonly pattern: "-?n(?!{{nmchar}})";
|
|
486
|
+
readonly longer_alt: "PlainIdent";
|
|
487
|
+
readonly line_breaks: false;
|
|
488
|
+
readonly categories: readonly ["Ident"];
|
|
489
|
+
}, {
|
|
490
|
+
readonly name: "Not";
|
|
491
|
+
readonly pattern: RegExp;
|
|
492
|
+
readonly longer_alt: "PlainIdent";
|
|
493
|
+
readonly categories: readonly ["Ident"];
|
|
494
|
+
}, {
|
|
495
|
+
readonly name: "WS";
|
|
496
|
+
readonly pattern: "{{ws}}";
|
|
497
|
+
readonly line_breaks: true;
|
|
498
|
+
readonly label: "Skipped";
|
|
499
|
+
}, {
|
|
500
|
+
readonly name: "Comment";
|
|
501
|
+
readonly pattern: "{{comment}}";
|
|
502
|
+
readonly line_breaks: true;
|
|
503
|
+
readonly label: "Skipped";
|
|
504
|
+
}];
|
|
505
|
+
readonly SingleQuoteString: readonly [{
|
|
506
|
+
readonly name: "SingleQuoteStringContents";
|
|
507
|
+
readonly pattern: "(?:[\\u0000-\\u0026\\u0028-\\u005B\\u005D-\\uFFFF]|\\\\'|\\\\{{newline}}|{{newline}}|{{escape}})+";
|
|
508
|
+
}, {
|
|
509
|
+
readonly name: "SingleQuoteEnd";
|
|
510
|
+
readonly pattern: RegExp;
|
|
511
|
+
readonly pop_mode: true;
|
|
512
|
+
}];
|
|
513
|
+
readonly DoubleQuoteString: readonly [{
|
|
514
|
+
readonly name: "DoubleQuoteStringContents";
|
|
515
|
+
readonly pattern: "(?:[\\u0000-\\u0021\\u0023-\\u005B\\u005D-\\uFFFF]|\\\\\"|\\\\{{newline}}|{{newline}}|{{escape}})+";
|
|
516
|
+
}, {
|
|
517
|
+
readonly name: "DoubleQuoteEnd";
|
|
518
|
+
readonly pattern: RegExp;
|
|
519
|
+
readonly pop_mode: true;
|
|
520
|
+
}];
|
|
521
|
+
readonly Url: readonly [{
|
|
522
|
+
readonly name: "NonQuotedUrl";
|
|
523
|
+
/**
|
|
524
|
+
* Equivalent to: /[^)(\'"]+/ but a-lot less clear :(
|
|
525
|
+
* @see https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT
|
|
526
|
+
*
|
|
527
|
+
* Note that:
|
|
528
|
+
* - "\u0022" === `"`
|
|
529
|
+
* - "\u0027" === `'`
|
|
530
|
+
* - "\u0028" === `(`
|
|
531
|
+
* - "\u0029" === `)`
|
|
532
|
+
* - "\u005C" === `\`
|
|
533
|
+
*/
|
|
534
|
+
readonly pattern: "(?:[\\u0000-\\u0021\\u0023-\\u0026\\u002A-\\u005B\\u005D-\\uFFFF]|{{escape}})+";
|
|
535
|
+
}, {
|
|
536
|
+
readonly name: "UrlEnd";
|
|
537
|
+
readonly pattern: RegExp;
|
|
538
|
+
readonly pop_mode: true;
|
|
539
|
+
}, "SingleQuoteStart", "DoubleQuoteStart", "WS"];
|
|
540
|
+
};
|
|
541
|
+
readonly defaultMode: "Default";
|
|
542
|
+
};
|
|
543
|
+
type TokenModes = ReturnType<typeof rawCssTokens>['modes'];
|
|
544
|
+
export type TokenNameMap<T extends readonly any[]> = {
|
|
545
|
+
[P in keyof T]: T[P] extends {
|
|
546
|
+
name: string;
|
|
547
|
+
} ? T[P]['name'] : T[P];
|
|
548
|
+
};
|
|
549
|
+
export type TokenNames<T extends readonly any[]> = TokenNameMap<T>[number];
|
|
550
|
+
/** Join all modes to get strong indexing */
|
|
551
|
+
export type CssTokenType = TokenNames<TokenModes[keyof TokenModes]>;
|
|
552
|
+
export declare const cssFragments: Record<string, RegExp>;
|
|
553
|
+
export declare const cssLexer: import("./index.js").ILexer;
|
|
554
|
+
export {};
|