@projectwallace/css-parser 0.18.9 → 0.18.12
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/README.md +186 -18
- package/dist/{arena-e9O_g2AN.js → arena-Bsf96CQK.js} +27 -19
- package/dist/{arena-BGvFdbj5.d.ts → arena-DvT75bvK.d.ts} +2 -0
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +1 -1
- package/dist/{css-node-DfJEsKN0.js → css-node-yoUdFtNg.js} +101 -100
- package/dist/index.d.ts +6 -20
- package/dist/index.js +9 -146
- package/dist/{node-types-YnOKcNfU.d.ts → node-types-CY0JK9_a.d.ts} +9 -55
- package/dist/node-types.d.ts +2 -0
- package/dist/node-types.js +142 -0
- package/dist/parse-anplusb.d.ts +2 -2
- package/dist/parse-anplusb.js +5 -4
- package/dist/parse-atrule-prelude.d.ts +2 -2
- package/dist/parse-atrule-prelude.js +62 -61
- package/dist/parse-declaration.d.ts +3 -3
- package/dist/parse-declaration.js +20 -19
- package/dist/parse-dimension.js +47 -1
- package/dist/{parse-selector-rTXB4IN2.js → parse-selector-CqIpnBrQ.js} +74 -81
- package/dist/parse-selector.d.ts +2 -2
- package/dist/parse-selector.js +1 -1
- package/dist/parse-value.d.ts +2 -2
- package/dist/parse-value.js +8 -8
- package/dist/parse.d.ts +3 -3
- package/dist/parse.js +67 -46
- package/dist/string-helpers-BMWJduts.d.ts +18 -0
- package/dist/string-helpers.d.ts +2 -0
- package/dist/string-helpers.js +1 -0
- package/dist/{parse-dimension-CIaPOmBc.js → string-utils-DiRRd28d.js} +5 -49
- package/dist/token-types-Bqsf5FX-.d.ts +38 -0
- package/dist/token-types.d.ts +2 -0
- package/dist/token-types.js +30 -0
- package/dist/{tokenize-0ADWAELW.js → tokenize-Ccg58Z_k.js} +67 -96
- package/dist/tokenize.d.ts +97 -2
- package/dist/tokenize.js +1 -1
- package/dist/{value-node-parser-DizbcN1a.js → value-node-parser-BBwBxFR_.js} +133 -135
- package/dist/walk.d.ts +3 -2
- package/dist/walk.js +2 -2
- package/package.json +17 -4
- package/dist/tokenize-CaWtrHw_.d.ts +0 -134
package/dist/parse.js
CHANGED
|
@@ -1,14 +1,35 @@
|
|
|
1
|
-
import { t as Lexer } from "./tokenize-
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { t as Lexer } from "./tokenize-Ccg58Z_k.js";
|
|
2
|
+
import "./token-types.js";
|
|
3
|
+
import { l as CSSDataArena } from "./arena-Bsf96CQK.js";
|
|
4
|
+
import { t as CSSNode } from "./css-node-yoUdFtNg.js";
|
|
5
|
+
import { a as skip_whitespace_and_comments_backward, o as skip_whitespace_and_comments_forward, t as SelectorParser } from "./parse-selector-CqIpnBrQ.js";
|
|
5
6
|
import { AtRulePreludeParser } from "./parse-atrule-prelude.js";
|
|
6
7
|
import { DeclarationParser } from "./parse-declaration.js";
|
|
7
8
|
//#region src/parse.ts
|
|
8
|
-
|
|
9
|
+
const DECLARATION_AT_RULES = /* @__PURE__ */ new Set([
|
|
9
10
|
"font-face",
|
|
10
|
-
"
|
|
11
|
-
"
|
|
11
|
+
"styleset",
|
|
12
|
+
"stylistic",
|
|
13
|
+
"character-variant",
|
|
14
|
+
"swash",
|
|
15
|
+
"ornaments",
|
|
16
|
+
"annotation",
|
|
17
|
+
"top-left-corner",
|
|
18
|
+
"top-left",
|
|
19
|
+
"top-center",
|
|
20
|
+
"top-right",
|
|
21
|
+
"top-right-corner",
|
|
22
|
+
"bottom-left-corner",
|
|
23
|
+
"bottom-left",
|
|
24
|
+
"bottom-center",
|
|
25
|
+
"bottom-right",
|
|
26
|
+
"bottom-right-corner",
|
|
27
|
+
"left-top",
|
|
28
|
+
"left-middle",
|
|
29
|
+
"left-bottom",
|
|
30
|
+
"right-top",
|
|
31
|
+
"right-middle",
|
|
32
|
+
"right-bottom",
|
|
12
33
|
"property",
|
|
13
34
|
"counter-style",
|
|
14
35
|
"color-profile",
|
|
@@ -29,12 +50,12 @@ var Parser = class {
|
|
|
29
50
|
parse_atrule_preludes_enabled;
|
|
30
51
|
constructor(source, options) {
|
|
31
52
|
this.source = source;
|
|
32
|
-
|
|
53
|
+
const opts = options || {};
|
|
33
54
|
this.parse_values_enabled = opts.parse_values ?? true;
|
|
34
55
|
this.parse_selectors_enabled = opts.parse_selectors ?? true;
|
|
35
56
|
this.parse_atrule_preludes_enabled = opts.parse_atrule_preludes ?? true;
|
|
36
57
|
this.lexer = new Lexer(source, opts.on_comment);
|
|
37
|
-
|
|
58
|
+
const capacity = CSSDataArena.capacity_for_source(source.length);
|
|
38
59
|
this.arena = new CSSDataArena(capacity);
|
|
39
60
|
this.selector_parser = this.parse_selectors_enabled ? new SelectorParser(this.arena, source) : null;
|
|
40
61
|
this.prelude_parser = this.parse_atrule_preludes_enabled ? new AtRulePreludeParser(this.arena, source) : null;
|
|
@@ -57,11 +78,11 @@ var Parser = class {
|
|
|
57
78
|
}
|
|
58
79
|
parse() {
|
|
59
80
|
this.next_token();
|
|
60
|
-
|
|
81
|
+
const stylesheet = this.arena.create_node(1, 0, this.source.length, 1, 1);
|
|
61
82
|
let first_rule = 0;
|
|
62
83
|
let last_rule = 0;
|
|
63
84
|
while (!this.is_eof()) {
|
|
64
|
-
|
|
85
|
+
const rule = this.parse_rule();
|
|
65
86
|
if (rule === null) this.next_token();
|
|
66
87
|
else {
|
|
67
88
|
if (first_rule === 0) first_rule = rule;
|
|
@@ -82,7 +103,7 @@ var Parser = class {
|
|
|
82
103
|
let first_child = 0;
|
|
83
104
|
let last_child = 0;
|
|
84
105
|
while (!this.is_eof()) {
|
|
85
|
-
|
|
106
|
+
const token_type = this.peek_type();
|
|
86
107
|
if (token_type === 24) break;
|
|
87
108
|
let child = null;
|
|
88
109
|
if (!declarations_only && token_type === 3) {
|
|
@@ -107,19 +128,19 @@ var Parser = class {
|
|
|
107
128
|
}
|
|
108
129
|
parse_style_rule() {
|
|
109
130
|
if (this.is_eof()) return null;
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
131
|
+
const rule_start = this.lexer.token_start;
|
|
132
|
+
const rule_line = this.lexer.token_line;
|
|
133
|
+
const rule_column = this.lexer.token_column;
|
|
134
|
+
const style_rule = this.arena.create_node(2, rule_start, 0, rule_line, rule_column);
|
|
135
|
+
const selector = this.parse_selector();
|
|
115
136
|
if (this.peek_type() !== 23) return null;
|
|
116
|
-
|
|
137
|
+
const block_start = this.lexer.token_end;
|
|
117
138
|
this.next_token();
|
|
118
139
|
this.arena.set_flag(style_rule, 8);
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
140
|
+
const block_line = this.lexer.token_line;
|
|
141
|
+
const block_column = this.lexer.token_column;
|
|
142
|
+
const block_node = this.arena.create_node(7, block_start, 0, block_line, block_column);
|
|
143
|
+
const first_child = this.parse_block_children(style_rule, false);
|
|
123
144
|
let block_end = this.lexer.token_start;
|
|
124
145
|
let rule_end = this.lexer.token_end;
|
|
125
146
|
if (this.peek_type() === 24) {
|
|
@@ -139,9 +160,9 @@ var Parser = class {
|
|
|
139
160
|
}
|
|
140
161
|
parse_selector() {
|
|
141
162
|
if (this.is_eof()) return null;
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
163
|
+
const selector_start = this.lexer.token_start;
|
|
164
|
+
const selector_line = this.lexer.token_line;
|
|
165
|
+
const selector_column = this.lexer.token_column;
|
|
145
166
|
let last_end = this.lexer.token_end;
|
|
146
167
|
if (this.peek_type() !== 23) {
|
|
147
168
|
this.lexer.skip_to_unquoted(123);
|
|
@@ -149,10 +170,10 @@ var Parser = class {
|
|
|
149
170
|
this.next_token();
|
|
150
171
|
}
|
|
151
172
|
if (this.parse_selectors_enabled && this.selector_parser) {
|
|
152
|
-
|
|
173
|
+
const selector = this.selector_parser.parse_selector(selector_start, last_end, selector_line, selector_column);
|
|
153
174
|
if (selector !== null) return selector;
|
|
154
175
|
}
|
|
155
|
-
|
|
176
|
+
const node_type = this.parse_selectors_enabled ? 20 : 8;
|
|
156
177
|
return this.arena.create_node(node_type, selector_start, last_end - selector_start, selector_line, selector_column);
|
|
157
178
|
}
|
|
158
179
|
parse_declaration() {
|
|
@@ -165,21 +186,21 @@ var Parser = class {
|
|
|
165
186
|
}
|
|
166
187
|
parse_atrule() {
|
|
167
188
|
if (this.peek_type() !== 3) return null;
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
189
|
+
const at_rule_start = this.lexer.token_start;
|
|
190
|
+
const at_rule_line = this.lexer.token_line;
|
|
191
|
+
const at_rule_column = this.lexer.token_column;
|
|
192
|
+
const name_start = this.lexer.token_start + 1;
|
|
193
|
+
const name_length = this.lexer.token_end - name_start;
|
|
194
|
+
const at_rule_name = this.source.substring(name_start, this.lexer.token_end);
|
|
174
195
|
this.next_token();
|
|
175
|
-
|
|
196
|
+
const at_rule = this.arena.create_node(3, at_rule_start, 0, at_rule_line, at_rule_column);
|
|
176
197
|
this.arena.set_content_start_delta(at_rule, name_start - at_rule_start);
|
|
177
198
|
this.arena.set_content_length(at_rule, name_length);
|
|
178
|
-
|
|
199
|
+
const prelude_start = this.lexer.token_start;
|
|
179
200
|
let prelude_end = prelude_start;
|
|
180
201
|
let paren_depth = 0;
|
|
181
202
|
while (!this.is_eof()) {
|
|
182
|
-
|
|
203
|
+
const token_type = this.peek_type();
|
|
183
204
|
if (token_type === 21 || token_type === 2) paren_depth++;
|
|
184
205
|
else if (token_type === 22) paren_depth--;
|
|
185
206
|
if (token_type === 23 && paren_depth === 0) break;
|
|
@@ -187,12 +208,12 @@ var Parser = class {
|
|
|
187
208
|
prelude_end = this.lexer.token_end;
|
|
188
209
|
this.next_token();
|
|
189
210
|
}
|
|
190
|
-
|
|
191
|
-
|
|
211
|
+
const trimmed_start = skip_whitespace_and_comments_forward(this.source, prelude_start, prelude_end);
|
|
212
|
+
const trimmed_end = skip_whitespace_and_comments_backward(this.source, prelude_end, trimmed_start);
|
|
192
213
|
let prelude_wrapper = null;
|
|
193
214
|
if (trimmed_start < trimmed_end) {
|
|
194
215
|
if (this.prelude_parser) {
|
|
195
|
-
|
|
216
|
+
const prelude_nodes = this.prelude_parser.parse_prelude(at_rule_name, trimmed_start, trimmed_end, at_rule_line, at_rule_column);
|
|
196
217
|
if (prelude_nodes.length > 0) {
|
|
197
218
|
prelude_wrapper = this.arena.create_node(40, trimmed_start, trimmed_end - trimmed_start, at_rule_line, at_rule_column);
|
|
198
219
|
this.arena.append_children(prelude_wrapper, prelude_nodes);
|
|
@@ -201,16 +222,16 @@ var Parser = class {
|
|
|
201
222
|
}
|
|
202
223
|
let last_end = this.lexer.token_end;
|
|
203
224
|
if (this.peek_type() === 23) {
|
|
204
|
-
|
|
225
|
+
const block_start = this.lexer.token_end;
|
|
205
226
|
this.next_token();
|
|
206
227
|
this.arena.set_flag(at_rule, 8);
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
228
|
+
const block_line = this.lexer.token_line;
|
|
229
|
+
const block_column = this.lexer.token_column;
|
|
230
|
+
const block_node = this.arena.create_node(7, block_start, 0, block_line, block_column);
|
|
231
|
+
const declarations_only = this.atrule_has_declarations(at_rule_name);
|
|
232
|
+
const first_child = this.parse_block_children(at_rule, declarations_only);
|
|
212
233
|
if (this.peek_type() === 24) {
|
|
213
|
-
|
|
234
|
+
const block_end = this.lexer.token_start;
|
|
214
235
|
last_end = this.lexer.token_end;
|
|
215
236
|
this.next_token();
|
|
216
237
|
this.arena.set_length(block_node, block_end - block_start);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//#region src/string-utils.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* @param a Base string, MUST be lowercase!
|
|
4
|
+
* @param b Compare string
|
|
5
|
+
*/
|
|
6
|
+
declare function str_equals(a: string, b: string): boolean;
|
|
7
|
+
/** Case-insensitive ASCII prefix check without allocations. `prefix` MUST be lowercase. */
|
|
8
|
+
declare function str_starts_with(str: string, prefix: string): boolean;
|
|
9
|
+
/** Case-insensitive substring search without allocations, or -1 if not found. `searchChar` MUST be lowercase. */
|
|
10
|
+
declare function str_index_of(str: string, searchChar: string): number;
|
|
11
|
+
/** True if the string/range is vendor-prefixed (-webkit-, -moz-, -ms-, -o-). `--custom-property` is not. */
|
|
12
|
+
declare function is_vendor_prefixed(text: string): boolean;
|
|
13
|
+
declare function is_vendor_prefixed(source: string, start: number, end: number): boolean;
|
|
14
|
+
/** True if the string is a CSS custom property (starts with `--`). */
|
|
15
|
+
declare function is_custom(str: string): boolean;
|
|
16
|
+
declare function strip_vendor_prefix(str: string): string;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { str_starts_with as a, str_index_of as i, is_vendor_prefixed as n, strip_vendor_prefix as o, str_equals as r, is_custom as t };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as str_starts_with, i as str_index_of, n as is_vendor_prefixed, o as strip_vendor_prefix, r as str_equals, t as is_custom } from "./string-helpers-BMWJduts.js";
|
|
2
|
+
export { is_custom, is_vendor_prefixed, str_equals, str_index_of, str_starts_with, strip_vendor_prefix };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { r as is_custom, a as is_vendor_prefixed, s as str_equals, l as str_index_of, u as str_starts_with, d as strip_vendor_prefix } from "./string-utils-DiRRd28d.js";
|
|
@@ -15,7 +15,7 @@ function is_digit(ch) {
|
|
|
15
15
|
function str_equals(a, b) {
|
|
16
16
|
if (a.length !== b.length) return false;
|
|
17
17
|
for (let i = 0; i < a.length; i++) {
|
|
18
|
-
|
|
18
|
+
const ca = a.charCodeAt(i);
|
|
19
19
|
let cb = b.charCodeAt(i);
|
|
20
20
|
cb |= 32;
|
|
21
21
|
if (ca !== cb) return false;
|
|
@@ -32,7 +32,7 @@ function str_equals_range(source, start, end, literal) {
|
|
|
32
32
|
return true;
|
|
33
33
|
}
|
|
34
34
|
function is_and_or_not_range(source, start, end) {
|
|
35
|
-
|
|
35
|
+
const length = end - start;
|
|
36
36
|
if (length === 3) return str_equals_range(source, start, end, "and") || str_equals_range(source, start, end, "not");
|
|
37
37
|
return length === 2 && str_equals_range(source, start, end, "or");
|
|
38
38
|
}
|
|
@@ -41,7 +41,7 @@ function str_starts_with(str, prefix) {
|
|
|
41
41
|
if (str.length < prefix.length) return false;
|
|
42
42
|
for (let i = 0; i < prefix.length; i++) {
|
|
43
43
|
let ca = str.charCodeAt(i);
|
|
44
|
-
|
|
44
|
+
const cb = prefix.charCodeAt(i);
|
|
45
45
|
if (ca >= 65 && ca <= 90) ca |= 32;
|
|
46
46
|
if (ca !== cb) return false;
|
|
47
47
|
}
|
|
@@ -63,7 +63,7 @@ function str_index_of(str, searchChar) {
|
|
|
63
63
|
let match = true;
|
|
64
64
|
for (let j = 0; j < searchChar.length; j++) {
|
|
65
65
|
let ca = str.charCodeAt(i + j);
|
|
66
|
-
|
|
66
|
+
const cb = searchChar.charCodeAt(j);
|
|
67
67
|
if (ca >= 65 && ca <= 90) ca |= 32;
|
|
68
68
|
if (ca !== cb) {
|
|
69
69
|
match = false;
|
|
@@ -96,48 +96,4 @@ function strip_vendor_prefix(str) {
|
|
|
96
96
|
return str;
|
|
97
97
|
}
|
|
98
98
|
//#endregion
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Find where a dimension's numeric part ends, e.g. 3 for "100px" or 2 for "2%".
|
|
102
|
-
* No allocation — callers that only need `value` or only `unit` can slice just
|
|
103
|
-
* the part they want instead of going through `parse_dimension`'s object + two
|
|
104
|
-
* substrings for both.
|
|
105
|
-
* @internal
|
|
106
|
-
*/
|
|
107
|
-
function dimension_number_end(text) {
|
|
108
|
-
let num_end = 0;
|
|
109
|
-
for (let i = 0; i < text.length; i++) {
|
|
110
|
-
let ch = text.charCodeAt(i);
|
|
111
|
-
if (ch === 101 || ch === 69) {
|
|
112
|
-
if (i + 1 < text.length) {
|
|
113
|
-
let next_ch = text.charCodeAt(i + 1);
|
|
114
|
-
if (is_digit(next_ch)) {
|
|
115
|
-
num_end = i + 1;
|
|
116
|
-
continue;
|
|
117
|
-
}
|
|
118
|
-
if ((next_ch === 43 || next_ch === 45) && i + 2 < text.length) {
|
|
119
|
-
if (is_digit(text.charCodeAt(i + 2))) {
|
|
120
|
-
num_end = i + 1;
|
|
121
|
-
continue;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
break;
|
|
126
|
-
}
|
|
127
|
-
if (is_digit(ch) || ch === 46 || ch === 45 || ch === 43) num_end = i + 1;
|
|
128
|
-
else break;
|
|
129
|
-
}
|
|
130
|
-
return num_end;
|
|
131
|
-
}
|
|
132
|
-
/** Parse a dimension string into value and unit, e.g. "100px" → { value: 100, unit: "px" } or "2%" → { value: 2, unit: "%" } */
|
|
133
|
-
function parse_dimension(text) {
|
|
134
|
-
let num_end = dimension_number_end(text);
|
|
135
|
-
let num_str = text.substring(0, num_end);
|
|
136
|
-
let unit = text.substring(num_end);
|
|
137
|
-
return {
|
|
138
|
-
value: num_str ? Number.parseFloat(num_str) : 0,
|
|
139
|
-
unit
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
//#endregion
|
|
143
|
-
export { is_custom as a, str_equals as c, str_starts_with as d, strip_vendor_prefix as f, is_combinator as i, str_equals_range as l, parse_dimension as n, is_vendor_prefixed as o, is_and_or_not_range as r, is_whitespace as s, dimension_number_end as t, str_index_of as u };
|
|
99
|
+
export { is_vendor_prefixed as a, str_equals_range as c, strip_vendor_prefix as d, is_digit as i, str_index_of as l, is_combinator as n, is_whitespace as o, is_custom as r, str_equals as s, is_and_or_not_range as t, str_starts_with as u };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
//#region src/token-types.d.ts
|
|
2
|
+
declare const TOKEN_IDENT = 1;
|
|
3
|
+
declare const TOKEN_FUNCTION = 2;
|
|
4
|
+
declare const TOKEN_AT_KEYWORD = 3;
|
|
5
|
+
declare const TOKEN_HASH = 4;
|
|
6
|
+
declare const TOKEN_STRING = 5;
|
|
7
|
+
declare const TOKEN_BAD_STRING = 6;
|
|
8
|
+
declare const TOKEN_URL = 7;
|
|
9
|
+
declare const TOKEN_BAD_URL = 8;
|
|
10
|
+
declare const TOKEN_DELIM = 9;
|
|
11
|
+
declare const TOKEN_NUMBER = 10;
|
|
12
|
+
declare const TOKEN_PERCENTAGE = 11;
|
|
13
|
+
declare const TOKEN_DIMENSION = 12;
|
|
14
|
+
declare const TOKEN_WHITESPACE = 13;
|
|
15
|
+
declare const TOKEN_CDO = 14;
|
|
16
|
+
declare const TOKEN_CDC = 15;
|
|
17
|
+
declare const TOKEN_COLON = 16;
|
|
18
|
+
declare const TOKEN_SEMICOLON = 17;
|
|
19
|
+
declare const TOKEN_COMMA = 18;
|
|
20
|
+
declare const TOKEN_LEFT_BRACKET = 19;
|
|
21
|
+
declare const TOKEN_RIGHT_BRACKET = 20;
|
|
22
|
+
declare const TOKEN_LEFT_PAREN = 21;
|
|
23
|
+
declare const TOKEN_RIGHT_PAREN = 22;
|
|
24
|
+
declare const TOKEN_LEFT_BRACE = 23;
|
|
25
|
+
declare const TOKEN_RIGHT_BRACE = 24;
|
|
26
|
+
declare const TOKEN_COMMENT = 25;
|
|
27
|
+
declare const TOKEN_EOF = 26;
|
|
28
|
+
declare const TOKEN_UNICODE_RANGE = 27;
|
|
29
|
+
type TokenType = typeof TOKEN_IDENT | typeof TOKEN_FUNCTION | typeof TOKEN_AT_KEYWORD | typeof TOKEN_HASH | typeof TOKEN_STRING | typeof TOKEN_BAD_STRING | typeof TOKEN_URL | typeof TOKEN_BAD_URL | typeof TOKEN_DELIM | typeof TOKEN_NUMBER | typeof TOKEN_PERCENTAGE | typeof TOKEN_DIMENSION | typeof TOKEN_WHITESPACE | typeof TOKEN_CDO | typeof TOKEN_CDC | typeof TOKEN_COLON | typeof TOKEN_SEMICOLON | typeof TOKEN_COMMA | typeof TOKEN_LEFT_BRACKET | typeof TOKEN_RIGHT_BRACKET | typeof TOKEN_LEFT_PAREN | typeof TOKEN_RIGHT_PAREN | typeof TOKEN_LEFT_BRACE | typeof TOKEN_RIGHT_BRACE | typeof TOKEN_COMMENT | typeof TOKEN_EOF | typeof TOKEN_UNICODE_RANGE;
|
|
30
|
+
type Token = {
|
|
31
|
+
type: TokenType;
|
|
32
|
+
start: number;
|
|
33
|
+
end: number;
|
|
34
|
+
line: number;
|
|
35
|
+
column: number;
|
|
36
|
+
};
|
|
37
|
+
//#endregion
|
|
38
|
+
export { TOKEN_SEMICOLON as C, TOKEN_WHITESPACE as D, TOKEN_URL as E, Token as O, TOKEN_RIGHT_PAREN as S, TOKEN_UNICODE_RANGE as T, TOKEN_LEFT_PAREN as _, TOKEN_CDO as a, TOKEN_RIGHT_BRACE as b, TOKEN_COMMENT as c, TOKEN_EOF as d, TOKEN_FUNCTION as f, TOKEN_LEFT_BRACKET as g, TOKEN_LEFT_BRACE as h, TOKEN_CDC as i, TokenType as k, TOKEN_DELIM as l, TOKEN_IDENT as m, TOKEN_BAD_STRING as n, TOKEN_COLON as o, TOKEN_HASH as p, TOKEN_BAD_URL as r, TOKEN_COMMA as s, TOKEN_AT_KEYWORD as t, TOKEN_DIMENSION as u, TOKEN_NUMBER as v, TOKEN_STRING as w, TOKEN_RIGHT_BRACKET as x, TOKEN_PERCENTAGE as y };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { C as TOKEN_SEMICOLON, D as TOKEN_WHITESPACE, E as TOKEN_URL, O as Token, S as TOKEN_RIGHT_PAREN, T as TOKEN_UNICODE_RANGE, _ as TOKEN_LEFT_PAREN, a as TOKEN_CDO, b as TOKEN_RIGHT_BRACE, c as TOKEN_COMMENT, d as TOKEN_EOF, f as TOKEN_FUNCTION, g as TOKEN_LEFT_BRACKET, h as TOKEN_LEFT_BRACE, i as TOKEN_CDC, k as TokenType, l as TOKEN_DELIM, m as TOKEN_IDENT, n as TOKEN_BAD_STRING, o as TOKEN_COLON, p as TOKEN_HASH, r as TOKEN_BAD_URL, s as TOKEN_COMMA, t as TOKEN_AT_KEYWORD, u as TOKEN_DIMENSION, v as TOKEN_NUMBER, w as TOKEN_STRING, x as TOKEN_RIGHT_BRACKET, y as TOKEN_PERCENTAGE } from "./token-types-Bqsf5FX-.js";
|
|
2
|
+
export { TOKEN_AT_KEYWORD, TOKEN_BAD_STRING, TOKEN_BAD_URL, TOKEN_CDC, TOKEN_CDO, TOKEN_COLON, TOKEN_COMMA, TOKEN_COMMENT, TOKEN_DELIM, TOKEN_DIMENSION, TOKEN_EOF, TOKEN_FUNCTION, TOKEN_HASH, TOKEN_IDENT, TOKEN_LEFT_BRACE, TOKEN_LEFT_BRACKET, TOKEN_LEFT_PAREN, TOKEN_NUMBER, TOKEN_PERCENTAGE, TOKEN_RIGHT_BRACE, TOKEN_RIGHT_BRACKET, TOKEN_RIGHT_PAREN, TOKEN_SEMICOLON, TOKEN_STRING, TOKEN_UNICODE_RANGE, TOKEN_URL, TOKEN_WHITESPACE, Token, TokenType };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//#region src/token-types.ts
|
|
2
|
+
const TOKEN_IDENT = 1;
|
|
3
|
+
const TOKEN_FUNCTION = 2;
|
|
4
|
+
const TOKEN_AT_KEYWORD = 3;
|
|
5
|
+
const TOKEN_HASH = 4;
|
|
6
|
+
const TOKEN_STRING = 5;
|
|
7
|
+
const TOKEN_BAD_STRING = 6;
|
|
8
|
+
const TOKEN_URL = 7;
|
|
9
|
+
const TOKEN_BAD_URL = 8;
|
|
10
|
+
const TOKEN_DELIM = 9;
|
|
11
|
+
const TOKEN_NUMBER = 10;
|
|
12
|
+
const TOKEN_PERCENTAGE = 11;
|
|
13
|
+
const TOKEN_DIMENSION = 12;
|
|
14
|
+
const TOKEN_WHITESPACE = 13;
|
|
15
|
+
const TOKEN_CDO = 14;
|
|
16
|
+
const TOKEN_CDC = 15;
|
|
17
|
+
const TOKEN_COLON = 16;
|
|
18
|
+
const TOKEN_SEMICOLON = 17;
|
|
19
|
+
const TOKEN_COMMA = 18;
|
|
20
|
+
const TOKEN_LEFT_BRACKET = 19;
|
|
21
|
+
const TOKEN_RIGHT_BRACKET = 20;
|
|
22
|
+
const TOKEN_LEFT_PAREN = 21;
|
|
23
|
+
const TOKEN_RIGHT_PAREN = 22;
|
|
24
|
+
const TOKEN_LEFT_BRACE = 23;
|
|
25
|
+
const TOKEN_RIGHT_BRACE = 24;
|
|
26
|
+
const TOKEN_COMMENT = 25;
|
|
27
|
+
const TOKEN_EOF = 26;
|
|
28
|
+
const TOKEN_UNICODE_RANGE = 27;
|
|
29
|
+
//#endregion
|
|
30
|
+
export { TOKEN_AT_KEYWORD, TOKEN_BAD_STRING, TOKEN_BAD_URL, TOKEN_CDC, TOKEN_CDO, TOKEN_COLON, TOKEN_COMMA, TOKEN_COMMENT, TOKEN_DELIM, TOKEN_DIMENSION, TOKEN_EOF, TOKEN_FUNCTION, TOKEN_HASH, TOKEN_IDENT, TOKEN_LEFT_BRACE, TOKEN_LEFT_BRACKET, TOKEN_LEFT_PAREN, TOKEN_NUMBER, TOKEN_PERCENTAGE, TOKEN_RIGHT_BRACE, TOKEN_RIGHT_BRACKET, TOKEN_RIGHT_PAREN, TOKEN_SEMICOLON, TOKEN_STRING, TOKEN_UNICODE_RANGE, TOKEN_URL, TOKEN_WHITESPACE };
|