@jesscss/css-parser 1.0.8-alpha.6 → 2.0.0-alpha.1
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
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { CssParser, CstNode, IToken } from '../cssParser';
|
|
2
|
-
export interface Declaration extends CstNode {
|
|
3
|
-
name: 'declaration';
|
|
4
|
-
children: [
|
|
5
|
-
name: IToken,
|
|
6
|
-
postNameWs: IToken,
|
|
7
|
-
assign: IToken,
|
|
8
|
-
preValueWs: IToken,
|
|
9
|
-
value: CstNode,
|
|
10
|
-
important: CstNode,
|
|
11
|
-
semi: IToken
|
|
12
|
-
];
|
|
13
|
-
}
|
|
14
|
-
export default function (this: CssParser, $: CssParser): void;
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
function default_1($) {
|
|
4
|
-
/**
|
|
5
|
-
* e.g.
|
|
6
|
-
* color: red
|
|
7
|
-
*/
|
|
8
|
-
$.declaration = $.RULE('declaration', () => ({
|
|
9
|
-
name: 'declaration',
|
|
10
|
-
children: [
|
|
11
|
-
$.SUBRULE($.property),
|
|
12
|
-
$._(0),
|
|
13
|
-
$.CONSUME($.T.Assign),
|
|
14
|
-
$._(1),
|
|
15
|
-
$.SUBRULE($.expressionList),
|
|
16
|
-
$.OPTION(() => ({
|
|
17
|
-
name: 'important',
|
|
18
|
-
children: [
|
|
19
|
-
$.CONSUME($.T.Important),
|
|
20
|
-
$._(2)
|
|
21
|
-
]
|
|
22
|
-
})),
|
|
23
|
-
$.OPTION2(() => $.CONSUME($.T.SemiColon))
|
|
24
|
-
]
|
|
25
|
-
}));
|
|
26
|
-
/**
|
|
27
|
-
* e.g.
|
|
28
|
-
* --color: { ;red }
|
|
29
|
-
*/
|
|
30
|
-
$.customDeclaration = $.RULE('customDeclaration', () => ({
|
|
31
|
-
name: 'declaration',
|
|
32
|
-
children: [
|
|
33
|
-
$.SUBRULE($.customProperty),
|
|
34
|
-
$._(0),
|
|
35
|
-
$.CONSUME($.T.Assign),
|
|
36
|
-
$._(1),
|
|
37
|
-
$.SUBRULE($.customValue),
|
|
38
|
-
/** !important can be part of customValue */
|
|
39
|
-
undefined,
|
|
40
|
-
$.OPTION(() => $.CONSUME($.T.SemiColon))
|
|
41
|
-
]
|
|
42
|
-
}));
|
|
43
|
-
/** "color" in "color: red" */
|
|
44
|
-
$.property = $.RULE('property', () => ({
|
|
45
|
-
name: 'property',
|
|
46
|
-
children: $.OR([
|
|
47
|
-
{ ALT: () => [$.CONSUME($.T.Ident)] },
|
|
48
|
-
{
|
|
49
|
-
/** Legacy - remove? */
|
|
50
|
-
ALT: () => [
|
|
51
|
-
$.CONSUME($.T.Star),
|
|
52
|
-
$.CONSUME2($.T.Ident)
|
|
53
|
-
]
|
|
54
|
-
}
|
|
55
|
-
])
|
|
56
|
-
}));
|
|
57
|
-
$.customProperty = $.RULE('customProperty', () => $.CONSUME($.T.CustomProperty));
|
|
58
|
-
}
|
|
59
|
-
exports.default = default_1;
|
package/lib/productions/root.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const chevrotain_1 = require("chevrotain");
|
|
4
|
-
function default_1($) {
|
|
5
|
-
/** Optional whitespace */
|
|
6
|
-
$._ = function (idx = 0, options) {
|
|
7
|
-
// +10 to avoid conflicts with other OPTION in the calling rule.
|
|
8
|
-
return $.option(idx + 10, () => $.consume(idx + 10, $.T.WS, options));
|
|
9
|
-
};
|
|
10
|
-
/** Stylesheet */
|
|
11
|
-
$.root = $.RULE('root', () => ({
|
|
12
|
-
name: 'root',
|
|
13
|
-
children: $.SUBRULE($.primary)
|
|
14
|
-
}));
|
|
15
|
-
/** List of rules */
|
|
16
|
-
$.primary = $.RULE('primary', () => {
|
|
17
|
-
const rules = [];
|
|
18
|
-
$.MANY(() => rules.push($.SUBRULE($.rule)));
|
|
19
|
-
const ws = $._();
|
|
20
|
-
if (ws) {
|
|
21
|
-
rules.push(ws);
|
|
22
|
-
}
|
|
23
|
-
return rules;
|
|
24
|
-
});
|
|
25
|
-
/** Rule with leading ws / comments */
|
|
26
|
-
$.rule = $.RULE('rule', () => {
|
|
27
|
-
const children = [$._()];
|
|
28
|
-
const rule = $.OR([
|
|
29
|
-
{ ALT: () => $.SUBRULE($.atRule) },
|
|
30
|
-
{ ALT: () => $.SUBRULE($.customDeclaration) },
|
|
31
|
-
{
|
|
32
|
-
GATE: $.BACKTRACK($.testQualifiedRule),
|
|
33
|
-
ALT: () => $.SUBRULE($.qualifiedRule)
|
|
34
|
-
},
|
|
35
|
-
{ ALT: () => $.SUBRULE($.declaration) },
|
|
36
|
-
/** Capture any isolated / redundant semi-colons */
|
|
37
|
-
{ ALT: () => $.CONSUME($.T.SemiColon) },
|
|
38
|
-
{ ALT: () => chevrotain_1.EMPTY_ALT }
|
|
39
|
-
]);
|
|
40
|
-
if (rule !== chevrotain_1.EMPTY_ALT) {
|
|
41
|
-
children.push(rule);
|
|
42
|
-
}
|
|
43
|
-
return {
|
|
44
|
-
name: 'rule',
|
|
45
|
-
children
|
|
46
|
-
};
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
exports.default = default_1;
|
|
@@ -1,231 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
function default_1($) {
|
|
4
|
-
/** A comma-separated list of selectors */
|
|
5
|
-
$.selectorList = $.RULE('selectorList', () => {
|
|
6
|
-
const children = [
|
|
7
|
-
$.SUBRULE($.complexSelector)
|
|
8
|
-
];
|
|
9
|
-
$.MANY(() => {
|
|
10
|
-
children.push({
|
|
11
|
-
name: 'delimiter',
|
|
12
|
-
children: [
|
|
13
|
-
$.CONSUME($.T.Comma),
|
|
14
|
-
$._(1)
|
|
15
|
-
]
|
|
16
|
-
}, $.SUBRULE2($.complexSelector));
|
|
17
|
-
});
|
|
18
|
-
return {
|
|
19
|
-
name: 'selectorList',
|
|
20
|
-
children
|
|
21
|
-
};
|
|
22
|
-
});
|
|
23
|
-
/**
|
|
24
|
-
* "A complex selector is a sequence of one or more compound selectors
|
|
25
|
-
* separated by combinators. It represents a set of simultaneous
|
|
26
|
-
* conditions on a set of elements in the particular relationships
|
|
27
|
-
* described by its combinators."
|
|
28
|
-
*
|
|
29
|
-
* For simplicity, this is returned as a stream of selectors
|
|
30
|
-
* and combinators.
|
|
31
|
-
*
|
|
32
|
-
* @see https://www.w3.org/TR/selectors-4/#structure
|
|
33
|
-
*/
|
|
34
|
-
$.complexSelector = $.RULE('complexSelector', () => {
|
|
35
|
-
const children = [
|
|
36
|
-
$.SUBRULE($.compoundSelector)
|
|
37
|
-
];
|
|
38
|
-
$.MANY(() => children.push($.SUBRULE($.combinatorSelector)));
|
|
39
|
-
children.push($._());
|
|
40
|
-
return {
|
|
41
|
-
name: 'complexSelector',
|
|
42
|
-
children
|
|
43
|
-
};
|
|
44
|
-
});
|
|
45
|
-
/**
|
|
46
|
-
* A combinator, then a compound selector
|
|
47
|
-
* e.g. `> div.class`
|
|
48
|
-
*/
|
|
49
|
-
$.combinatorSelector = $.RULE('combinatorSelector', () => ({
|
|
50
|
-
name: 'combinatorSelector',
|
|
51
|
-
children: $.OR([
|
|
52
|
-
{
|
|
53
|
-
ALT: () => [
|
|
54
|
-
/**
|
|
55
|
-
* Combinator with optional whitespace
|
|
56
|
-
*/
|
|
57
|
-
{
|
|
58
|
-
name: 'combinator',
|
|
59
|
-
children: [
|
|
60
|
-
undefined,
|
|
61
|
-
$.CONSUME($.T.Combinator),
|
|
62
|
-
$.OPTION(() => $.CONSUME($.T.WS))
|
|
63
|
-
]
|
|
64
|
-
},
|
|
65
|
-
$.SUBRULE2($.compoundSelector)
|
|
66
|
-
]
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
/**
|
|
70
|
-
* Whitespace with optional combinator,
|
|
71
|
-
* (or we treat as trailing ws)
|
|
72
|
-
*/
|
|
73
|
-
ALT: () => {
|
|
74
|
-
const children = [
|
|
75
|
-
$.CONSUME2($.T.WS)
|
|
76
|
-
];
|
|
77
|
-
let sel;
|
|
78
|
-
$.OPTION2(() => {
|
|
79
|
-
$.OPTION3(() => {
|
|
80
|
-
children.push($.CONSUME2($.T.Combinator));
|
|
81
|
-
$.OPTION4(() => children.push($.CONSUME3($.T.WS)));
|
|
82
|
-
});
|
|
83
|
-
sel = $.SUBRULE3($.compoundSelector);
|
|
84
|
-
});
|
|
85
|
-
if (sel) {
|
|
86
|
-
return [
|
|
87
|
-
{
|
|
88
|
-
name: 'combinator',
|
|
89
|
-
children: children.length === 1 ? [undefined, children[0]] : children
|
|
90
|
-
},
|
|
91
|
-
sel
|
|
92
|
-
];
|
|
93
|
-
}
|
|
94
|
-
return children;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
])
|
|
98
|
-
}));
|
|
99
|
-
/**
|
|
100
|
-
* "A compound selector is a sequence of simple selectors that are not separated by a combinator,
|
|
101
|
-
* and represents a set of simultaneous conditions on a single element. If it contains a type
|
|
102
|
-
* selector or universal selector, that selector must come first in the sequence."
|
|
103
|
-
*
|
|
104
|
-
* @see https://www.w3.org/TR/selectors-4/#structure
|
|
105
|
-
*/
|
|
106
|
-
$.compoundSelector = $.RULE('compoundSelector', () => ({
|
|
107
|
-
name: 'compoundSelector',
|
|
108
|
-
children: $.OR([
|
|
109
|
-
{
|
|
110
|
-
ALT: () => {
|
|
111
|
-
const children = [
|
|
112
|
-
$.CONSUME($.T.Star)
|
|
113
|
-
];
|
|
114
|
-
$.MANY(() => children.push($.SUBRULE($.simpleSelector)));
|
|
115
|
-
return children;
|
|
116
|
-
}
|
|
117
|
-
},
|
|
118
|
-
{
|
|
119
|
-
ALT: () => {
|
|
120
|
-
const children = [];
|
|
121
|
-
$.AT_LEAST_ONE(() => children.push($.SUBRULE2($.simpleSelector)));
|
|
122
|
-
return children;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
])
|
|
126
|
-
}));
|
|
127
|
-
/**
|
|
128
|
-
* "A simple selector is a single condition on an element. A type selector,
|
|
129
|
-
* universal selector, attribute selector, class selector, ID selector,
|
|
130
|
-
* or pseudo-class is a simple selector."
|
|
131
|
-
*
|
|
132
|
-
* @see https://www.w3.org/TR/selectors-4/#structure
|
|
133
|
-
*/
|
|
134
|
-
$.simpleSelector = $.RULE('simpleSelector', () => $.OR([
|
|
135
|
-
{ ALT: () => $.SUBRULE($.pseudoSelector) },
|
|
136
|
-
{ ALT: () => $.SUBRULE($.attrSelector) },
|
|
137
|
-
{ ALT: () => $.SUBRULE($.nameSelector) },
|
|
138
|
-
/** Used in keyframes as a selector */
|
|
139
|
-
{ ALT: () => $.CONSUME($.T.Dimension) }
|
|
140
|
-
]));
|
|
141
|
-
/** e.g. `:pseudo` | `::pseudo` | `:pseudo()` */
|
|
142
|
-
$.pseudoSelector = $.RULE('pseudoSelector', () => {
|
|
143
|
-
const pseudoName = [$.CONSUME($.T.Colon)];
|
|
144
|
-
$.OPTION(() => pseudoName.push($.CONSUME2($.T.Colon)));
|
|
145
|
-
const getName = () => ({
|
|
146
|
-
name: 'pseudoName',
|
|
147
|
-
children: pseudoName
|
|
148
|
-
});
|
|
149
|
-
let args;
|
|
150
|
-
let R;
|
|
151
|
-
$.OR2([
|
|
152
|
-
{
|
|
153
|
-
ALT: () => {
|
|
154
|
-
pseudoName.push($.CONSUME($.T.Ident));
|
|
155
|
-
/** Handle functions parsed as idents (like `not`) */
|
|
156
|
-
$.OPTION2(() => {
|
|
157
|
-
pseudoName.push($.CONSUME($.T.LParen));
|
|
158
|
-
args = $.SUBRULE($.expressionList),
|
|
159
|
-
R = $.CONSUME($.T.RParen);
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
},
|
|
163
|
-
{
|
|
164
|
-
/** e.g. :pseudo(...) */
|
|
165
|
-
ALT: () => {
|
|
166
|
-
pseudoName.push($.CONSUME($.T.Function));
|
|
167
|
-
args = $.SUBRULE2($.expressionList),
|
|
168
|
-
R = $.CONSUME2($.T.RParen);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
]);
|
|
172
|
-
return {
|
|
173
|
-
name: 'pseudoSelector',
|
|
174
|
-
children: [
|
|
175
|
-
getName(),
|
|
176
|
-
args,
|
|
177
|
-
R
|
|
178
|
-
]
|
|
179
|
-
};
|
|
180
|
-
});
|
|
181
|
-
/** e.g. [id^="bar"] [*|ns|="foo"] */
|
|
182
|
-
$.attrSelector = $.RULE('attrSelector', () => {
|
|
183
|
-
const attr = [];
|
|
184
|
-
const L = $.CONSUME($.T.LSquare);
|
|
185
|
-
let eq, value;
|
|
186
|
-
$.OR([
|
|
187
|
-
{ ALT: () => {
|
|
188
|
-
$.OPTION(() => attr.push($.CONSUME($.T.Star)));
|
|
189
|
-
attr.push($.CONSUME($.T.Pipe), $.SUBRULE($.attrIdent));
|
|
190
|
-
} },
|
|
191
|
-
{ ALT: () => {
|
|
192
|
-
attr.push($.SUBRULE2($.attrIdent));
|
|
193
|
-
$.OPTION2(() => {
|
|
194
|
-
attr.push($.CONSUME2($.T.Pipe), $.SUBRULE3($.attrIdent));
|
|
195
|
-
});
|
|
196
|
-
} }
|
|
197
|
-
]);
|
|
198
|
-
$.OPTION4(() => {
|
|
199
|
-
eq = $.OR2([
|
|
200
|
-
{ ALT: () => $.CONSUME($.T.Eq) },
|
|
201
|
-
{ ALT: () => $.CONSUME($.T.AttrMatch) }
|
|
202
|
-
]);
|
|
203
|
-
value = $.OR3([
|
|
204
|
-
{ ALT: () => $.SUBRULE4($.attrIdent) },
|
|
205
|
-
{ ALT: () => $.CONSUME3($.T.Dimension) },
|
|
206
|
-
{ ALT: () => $.CONSUME($.T.StringLiteral) }
|
|
207
|
-
]);
|
|
208
|
-
});
|
|
209
|
-
const R = $.CONSUME($.T.RSquare);
|
|
210
|
-
return {
|
|
211
|
-
name: 'attrSelector',
|
|
212
|
-
children: [
|
|
213
|
-
L,
|
|
214
|
-
{
|
|
215
|
-
name: 'attr',
|
|
216
|
-
children: attr
|
|
217
|
-
},
|
|
218
|
-
eq,
|
|
219
|
-
value,
|
|
220
|
-
R
|
|
221
|
-
]
|
|
222
|
-
};
|
|
223
|
-
});
|
|
224
|
-
/** Separated out for Less overriding */
|
|
225
|
-
$.attrIdent = $.RULE('attrIdent', () => $.CONSUME($.T.Ident));
|
|
226
|
-
$.nameSelector = $.RULE('nameSelector', () => $.OR([
|
|
227
|
-
{ ALT: () => $.CONSUME($.T.Selector) },
|
|
228
|
-
{ ALT: () => $.CONSUME($.T.Ident) }
|
|
229
|
-
]));
|
|
230
|
-
}
|
|
231
|
-
exports.default = default_1;
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
function default_1($) {
|
|
4
|
-
/**
|
|
5
|
-
* A custom property's (or unknown at-rule's) outer value
|
|
6
|
-
*/
|
|
7
|
-
$.customValue = $.RULE('customValue', () => {
|
|
8
|
-
const children = [];
|
|
9
|
-
$.MANY(() => children.push($.OR([
|
|
10
|
-
{ ALT: () => $.SUBRULE($.anyToken) },
|
|
11
|
-
{ ALT: () => $.SUBRULE($.extraTokens) },
|
|
12
|
-
{ ALT: () => $.SUBRULE($.customBlock) }
|
|
13
|
-
])));
|
|
14
|
-
return {
|
|
15
|
-
name: 'customValue',
|
|
16
|
-
children
|
|
17
|
-
};
|
|
18
|
-
});
|
|
19
|
-
$.customPrelude = $.RULE('customPrelude', () => {
|
|
20
|
-
const children = [];
|
|
21
|
-
$.MANY(() => children.push($.OR([
|
|
22
|
-
{ ALT: () => $.SUBRULE($.anyToken) },
|
|
23
|
-
{ ALT: () => $.SUBRULE($.extraTokens) },
|
|
24
|
-
{ ALT: () => $.SUBRULE($.customPreludeBlock) }
|
|
25
|
-
])));
|
|
26
|
-
return {
|
|
27
|
-
name: 'customPrelude',
|
|
28
|
-
children
|
|
29
|
-
};
|
|
30
|
-
});
|
|
31
|
-
/**
|
|
32
|
-
* A custom value within a block
|
|
33
|
-
*/
|
|
34
|
-
$.customValueOrSemi = $.RULE('customValueOrSemi', () => {
|
|
35
|
-
const children = [];
|
|
36
|
-
$.MANY(() => children.push($.OR([
|
|
37
|
-
{ ALT: () => $.CONSUME($.T.SemiColon) },
|
|
38
|
-
{ ALT: () => $.SUBRULE($.anyToken) },
|
|
39
|
-
{ ALT: () => $.SUBRULE($.extraTokens) },
|
|
40
|
-
{ ALT: () => $.SUBRULE($.customBlock) }
|
|
41
|
-
])));
|
|
42
|
-
return {
|
|
43
|
-
name: 'customValue',
|
|
44
|
-
children
|
|
45
|
-
};
|
|
46
|
-
});
|
|
47
|
-
/**
|
|
48
|
-
* Expressions separated by commas
|
|
49
|
-
* e.g. `one, two, three`
|
|
50
|
-
*/
|
|
51
|
-
$.expressionList = $.RULE('expressionList', () => {
|
|
52
|
-
const children = [$.SUBRULE($.expression)];
|
|
53
|
-
$.MANY(() => {
|
|
54
|
-
children.push($.CONSUME($.T.Comma), $.SUBRULE2($.expression));
|
|
55
|
-
});
|
|
56
|
-
if (children.length === 1) {
|
|
57
|
-
return children[0];
|
|
58
|
-
}
|
|
59
|
-
return {
|
|
60
|
-
name: 'expressionList',
|
|
61
|
-
children
|
|
62
|
-
};
|
|
63
|
-
});
|
|
64
|
-
/**
|
|
65
|
-
* An expression contains values and spaces
|
|
66
|
-
*/
|
|
67
|
-
$.expression = $.RULE('expression', () => {
|
|
68
|
-
const children = [];
|
|
69
|
-
$.MANY(() => children.push($.SUBRULE($.value)));
|
|
70
|
-
if (children.length === 1) {
|
|
71
|
-
return children[0];
|
|
72
|
-
}
|
|
73
|
-
return {
|
|
74
|
-
name: 'expression',
|
|
75
|
-
children
|
|
76
|
-
};
|
|
77
|
-
});
|
|
78
|
-
/**
|
|
79
|
-
* According to a reading of the spec, whitespace is a valid
|
|
80
|
-
* value in a CSS list, e.g. in the custom properties spec,
|
|
81
|
-
* `--custom: ;` has a value of ' '
|
|
82
|
-
*
|
|
83
|
-
* However, a property's grammar may discard whitespace between values.
|
|
84
|
-
* e.g. for `color: black`, the value in the browser will resolve to `black`
|
|
85
|
-
* and not ` black`. The CSS spec is rather hand-wavy about whitespace,
|
|
86
|
-
* sometimes mentioning it specifically, sometimes not representing it
|
|
87
|
-
* in grammar even though it's expected to be present.
|
|
88
|
-
*
|
|
89
|
-
* Strictly speaking, though, a property's value begins _immediately_
|
|
90
|
-
* following a ':' and ends at ';' (or until automatically closed by
|
|
91
|
-
* '}', ']', ')' or the end of a file).
|
|
92
|
-
*/
|
|
93
|
-
$.value = $.RULE('value', () => $.OR([
|
|
94
|
-
{ ALT: () => $.SUBRULE($.block) },
|
|
95
|
-
{ ALT: () => $.SUBRULE($.anyToken) }
|
|
96
|
-
]));
|
|
97
|
-
$.anyToken = $.RULE('anyToken', () => $.OR([
|
|
98
|
-
{ ALT: () => $.CONSUME($.T.Value) },
|
|
99
|
-
/** Can be in a var() function */
|
|
100
|
-
{ ALT: () => $.CONSUME($.T.CustomProperty) },
|
|
101
|
-
{ ALT: () => $.CONSUME($.T.Colon) },
|
|
102
|
-
{ ALT: () => $.CONSUME($.T.WS) }
|
|
103
|
-
]));
|
|
104
|
-
/**
|
|
105
|
-
* Extra tokens in a custom property. Should include any
|
|
106
|
-
* and every token possible, including unknown tokens.
|
|
107
|
-
*/
|
|
108
|
-
$.extraTokens = $.RULE('extraTokens', () => $.OR([
|
|
109
|
-
{ ALT: () => $.CONSUME($.T.AtName) },
|
|
110
|
-
{ ALT: () => $.CONSUME($.T.Comma) },
|
|
111
|
-
{ ALT: () => $.CONSUME($.T.Important) }
|
|
112
|
-
]));
|
|
113
|
-
}
|
|
114
|
-
exports.default = default_1;
|