@projectwallace/css-parser 0.6.7 → 0.7.0

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.
@@ -1,5 +1,9 @@
1
- import { L as Lexer, T as TOKEN_IDENT, h as TOKEN_DELIM, k as TOKEN_DIMENSION, i as TOKEN_NUMBER } from './lexer-CtBKgfVv.js';
2
- import { ao as CHAR_MINUS_HYPHEN, a5 as CHAR_PLUS, am as skip_whitespace_forward, I as NODE_SELECTOR_NTH, C as CSSNode, Z as CSSDataArena } from './css-node-GOEvp2OO.js';
1
+ import { Lexer } from './lexer.js';
2
+ import { NTH_SELECTOR, CSSDataArena } from './arena.js';
3
+ import { TOKEN_IDENT, TOKEN_DELIM, TOKEN_DIMENSION, TOKEN_NUMBER } from './token-types.js';
4
+ import { CHAR_MINUS_HYPHEN, CHAR_PLUS } from './string-utils.js';
5
+ import { skip_whitespace_forward } from './parse-utils.js';
6
+ import { CSSNode } from './css-node.js';
3
7
 
4
8
  class ANplusBParser {
5
9
  lexer;
@@ -20,7 +24,6 @@ class ANplusBParser {
20
24
  this.expr_end = end;
21
25
  this.lexer.pos = start;
22
26
  this.lexer.line = line;
23
- let a = null;
24
27
  let b = null;
25
28
  let a_start = start;
26
29
  let a_end = start;
@@ -35,10 +38,9 @@ class ANplusBParser {
35
38
  if (this.lexer.token_type === TOKEN_IDENT) {
36
39
  const text = this.source.substring(this.lexer.token_start, this.lexer.token_end).toLowerCase();
37
40
  if (text === "odd" || text === "even") {
38
- a = this.source.substring(this.lexer.token_start, this.lexer.token_end);
39
41
  a_start = this.lexer.token_start;
40
42
  a_end = this.lexer.token_end;
41
- return this.create_anplusb_node(node_start, a, null, a_start, a_end, 0, 0);
43
+ return this.create_anplusb_node(node_start, a_start, a_end, 0, 0);
42
44
  }
43
45
  const first_char = this.source.charCodeAt(this.lexer.token_start);
44
46
  const second_char = this.lexer.token_end > this.lexer.token_start + 1 ? this.source.charCodeAt(this.lexer.token_start + 1) : 0;
@@ -46,16 +48,14 @@ class ANplusBParser {
46
48
  if (this.lexer.token_end > this.lexer.token_start + 2) {
47
49
  const third_char = this.source.charCodeAt(this.lexer.token_start + 2);
48
50
  if (third_char === CHAR_MINUS_HYPHEN) {
49
- a = "-n";
50
51
  a_start = this.lexer.token_start;
51
52
  a_end = this.lexer.token_start + 2;
52
53
  b = this.source.substring(this.lexer.token_start + 2, this.lexer.token_end);
53
54
  b_start = this.lexer.token_start + 2;
54
55
  b_end = this.lexer.token_end;
55
- return this.create_anplusb_node(node_start, a, b, a_start, a_end, b_start, b_end);
56
+ return this.create_anplusb_node(node_start, a_start, a_end, b_start, b_end);
56
57
  }
57
58
  }
58
- a = "-n";
59
59
  a_start = this.lexer.token_start;
60
60
  a_end = this.lexer.token_start + 2;
61
61
  b = this.parse_b_part();
@@ -63,22 +63,20 @@ class ANplusBParser {
63
63
  b_start = this.lexer.token_start;
64
64
  b_end = this.lexer.token_end;
65
65
  }
66
- return this.create_anplusb_node(node_start, a, b, a_start, a_end, b_start, b_end);
66
+ return this.create_anplusb_node(node_start, a_start, a_end, b !== null ? b_start : 0, b !== null ? b_end : 0);
67
67
  }
68
68
  if (first_char === 110) {
69
69
  if (this.lexer.token_end > this.lexer.token_start + 1) {
70
70
  const second_char2 = this.source.charCodeAt(this.lexer.token_start + 1);
71
71
  if (second_char2 === CHAR_MINUS_HYPHEN) {
72
- a = "n";
73
72
  a_start = this.lexer.token_start;
74
73
  a_end = this.lexer.token_start + 1;
75
74
  b = this.source.substring(this.lexer.token_start + 1, this.lexer.token_end);
76
75
  b_start = this.lexer.token_start + 1;
77
76
  b_end = this.lexer.token_end;
78
- return this.create_anplusb_node(node_start, a, b, a_start, a_end, b_start, b_end);
77
+ return this.create_anplusb_node(node_start, a_start, a_end, b_start, b_end);
79
78
  }
80
79
  }
81
- a = "n";
82
80
  a_start = this.lexer.token_start;
83
81
  a_end = this.lexer.token_start + 1;
84
82
  b = this.parse_b_part();
@@ -86,7 +84,7 @@ class ANplusBParser {
86
84
  b_start = this.lexer.token_start;
87
85
  b_end = this.lexer.token_end;
88
86
  }
89
- return this.create_anplusb_node(node_start, a, b, a_start, a_end, b_start, b_end);
87
+ return this.create_anplusb_node(node_start, a_start, a_end, b !== null ? b_start : 0, b !== null ? b_end : 0);
90
88
  }
91
89
  return null;
92
90
  }
@@ -97,7 +95,6 @@ class ANplusBParser {
97
95
  const text = this.source.substring(this.lexer.token_start, this.lexer.token_end);
98
96
  const first_char = text.charCodeAt(0);
99
97
  if (first_char === 110) {
100
- a = "+n";
101
98
  a_start = saved.pos - 1;
102
99
  a_end = this.lexer.token_start + 1;
103
100
  if (this.lexer.token_end > this.lexer.token_start + 1) {
@@ -106,7 +103,7 @@ class ANplusBParser {
106
103
  b = this.source.substring(this.lexer.token_start + 1, this.lexer.token_end);
107
104
  b_start = this.lexer.token_start + 1;
108
105
  b_end = this.lexer.token_end;
109
- return this.create_anplusb_node(node_start, a, b, a_start, a_end, b_start, b_end);
106
+ return this.create_anplusb_node(node_start, a_start, a_end, b_start, b_end);
110
107
  }
111
108
  }
112
109
  b = this.parse_b_part();
@@ -114,7 +111,7 @@ class ANplusBParser {
114
111
  b_start = this.lexer.token_start;
115
112
  b_end = this.lexer.token_end;
116
113
  }
117
- return this.create_anplusb_node(node_start, a, b, a_start, a_end, b_start, b_end);
114
+ return this.create_anplusb_node(node_start, a_start, a_end, b !== null ? b_start : 0, b !== null ? b_end : 0);
118
115
  }
119
116
  }
120
117
  this.lexer.restore_position(saved);
@@ -123,7 +120,6 @@ class ANplusBParser {
123
120
  const token_text = this.source.substring(this.lexer.token_start, this.lexer.token_end);
124
121
  const n_index = token_text.toLowerCase().indexOf("n");
125
122
  if (n_index !== -1) {
126
- a = token_text.substring(0, n_index + 1);
127
123
  a_start = this.lexer.token_start;
128
124
  a_end = this.lexer.token_start + n_index + 1;
129
125
  if (n_index + 1 < token_text.length) {
@@ -132,7 +128,7 @@ class ANplusBParser {
132
128
  b = remainder;
133
129
  b_start = this.lexer.token_start + n_index + 1;
134
130
  b_end = this.lexer.token_end;
135
- return this.create_anplusb_node(node_start, a, b, a_start, a_end, b_start, b_end);
131
+ return this.create_anplusb_node(node_start, a_start, a_end, b_start, b_end);
136
132
  }
137
133
  }
138
134
  b = this.parse_b_part();
@@ -140,7 +136,7 @@ class ANplusBParser {
140
136
  b_start = this.lexer.token_start;
141
137
  b_end = this.lexer.token_end;
142
138
  }
143
- return this.create_anplusb_node(node_start, a, b, a_start, a_end, b_start, b_end);
139
+ return this.create_anplusb_node(node_start, a_start, a_end, b_start, b_end);
144
140
  }
145
141
  }
146
142
  if (this.lexer.token_type === TOKEN_NUMBER) {
@@ -148,7 +144,7 @@ class ANplusBParser {
148
144
  b = num_text;
149
145
  b_start = this.lexer.token_start;
150
146
  b_end = this.lexer.token_end;
151
- return this.create_anplusb_node(node_start, a, b, a_start, a_end, b_start, b_end);
147
+ return this.create_anplusb_node(node_start, 0, 0, b_start, b_end);
152
148
  }
153
149
  return null;
154
150
  }
@@ -192,18 +188,20 @@ class ANplusBParser {
192
188
  skip_whitespace() {
193
189
  this.lexer.pos = skip_whitespace_forward(this.source, this.lexer.pos, this.expr_end);
194
190
  }
195
- create_anplusb_node(start, a, b, a_start, a_end, b_start, b_end) {
196
- const node = this.arena.create_node();
197
- this.arena.set_type(node, NODE_SELECTOR_NTH);
198
- this.arena.set_start_offset(node, start);
199
- this.arena.set_length(node, this.lexer.pos - start);
200
- this.arena.set_start_line(node, this.lexer.line);
201
- if (a !== null) {
202
- this.arena.set_content_start(node, a_start);
191
+ create_anplusb_node(start, a_start, a_end, b_start, b_end) {
192
+ const node = this.arena.create_node(
193
+ NTH_SELECTOR,
194
+ start,
195
+ this.lexer.pos - start,
196
+ this.lexer.line,
197
+ 1
198
+ );
199
+ if (a_end > a_start) {
200
+ this.arena.set_content_start_delta(node, a_start - start);
203
201
  this.arena.set_content_length(node, a_end - a_start);
204
202
  }
205
- if (b !== null) {
206
- this.arena.set_value_start(node, b_start);
203
+ if (b_end > b_start) {
204
+ this.arena.set_value_start_delta(node, b_start - start);
207
205
  this.arena.set_value_length(node, b_end - b_start);
208
206
  }
209
207
  return node;
@@ -1,29 +1,4 @@
1
- import { CSSDataArena } from './arena';
2
1
  import { CSSNode } from './css-node';
3
- export declare class AtRulePreludeParser {
4
- private lexer;
5
- private arena;
6
- private source;
7
- private prelude_end;
8
- constructor(arena: CSSDataArena, source: string);
9
- parse_prelude(at_rule_name: string, start: number, end: number, line?: number, column?: number): number[];
10
- private parse_media_query_list;
11
- private create_node;
12
- private is_and_or_not;
13
- private parse_single_media_query;
14
- private parse_media_feature;
15
- private parse_container_query;
16
- private parse_supports_query;
17
- private parse_layer_names;
18
- private parse_identifier;
19
- private parse_import_prelude;
20
- private parse_import_url;
21
- private parse_import_layer;
22
- private parse_import_supports;
23
- private skip_whitespace;
24
- private peek_token_type;
25
- private next_token;
26
- }
27
2
  /**
28
3
  * Parse an at-rule prelude string and return an array of AST nodes
29
4
  * @param at_rule_name - The name of the at-rule (e.g., "media", "supports", "layer")
@@ -1,5 +1,9 @@
1
- import { L as Lexer, q as TOKEN_COMMA, T as TOKEN_IDENT, t as TOKEN_LEFT_PAREN, u as TOKEN_RIGHT_PAREN, l as TOKEN_WHITESPACE, f as TOKEN_URL, a as TOKEN_FUNCTION, d as TOKEN_STRING, y as TOKEN_EOF } from './lexer-CtBKgfVv.js';
2
- import { Z as CSSDataArena, C as CSSNode, an as str_equals, U as NODE_PRELUDE_OPERATOR, O as NODE_PRELUDE_MEDIA_TYPE, L as NODE_PRELUDE_MEDIA_QUERY, M as NODE_PRELUDE_MEDIA_FEATURE, a3 as trim_boundaries, S as NODE_PRELUDE_IDENTIFIER, P as NODE_PRELUDE_CONTAINER_QUERY, Q as NODE_PRELUDE_SUPPORTS_QUERY, R as NODE_PRELUDE_LAYER_NAME, V as NODE_PRELUDE_IMPORT_URL, W as NODE_PRELUDE_IMPORT_LAYER, X as NODE_PRELUDE_IMPORT_SUPPORTS, am as skip_whitespace_forward } from './css-node-GOEvp2OO.js';
1
+ import { Lexer } from './lexer.js';
2
+ import { CSSDataArena, PRELUDE_OPERATOR, MEDIA_TYPE, MEDIA_QUERY, MEDIA_FEATURE, IDENTIFIER, CONTAINER_QUERY, SUPPORTS_QUERY, LAYER_NAME, URL } from './arena.js';
3
+ import { TOKEN_COMMA, TOKEN_IDENT, TOKEN_LEFT_PAREN, TOKEN_RIGHT_PAREN, TOKEN_WHITESPACE, TOKEN_URL, TOKEN_FUNCTION, TOKEN_STRING, TOKEN_EOF } from './token-types.js';
4
+ import { str_equals } from './string-utils.js';
5
+ import { trim_boundaries, skip_whitespace_forward } from './parse-utils.js';
6
+ import { CSSNode } from './css-node.js';
3
7
 
4
8
  class AtRulePreludeParser {
5
9
  lexer;
@@ -46,29 +50,29 @@ class AtRulePreludeParser {
46
50
  nodes.push(query);
47
51
  }
48
52
  this.skip_whitespace();
49
- if (this.peek_token_type() === TOKEN_COMMA) {
50
- this.next_token();
53
+ const saved = this.lexer.save_position();
54
+ this.next_token();
55
+ if (this.lexer.token_type !== TOKEN_COMMA) {
56
+ this.lexer.restore_position(saved);
51
57
  }
52
58
  }
53
59
  return nodes;
54
60
  }
55
61
  create_node(type, start, end) {
56
- let node = this.arena.create_node();
57
- this.arena.set_type(node, type);
58
- this.arena.set_start_offset(node, start);
59
- this.arena.set_length(node, end - start);
60
- this.arena.set_start_line(node, this.lexer.token_line);
61
- this.arena.set_start_column(node, this.lexer.token_column);
62
- return node;
62
+ return this.arena.create_node(
63
+ type,
64
+ start,
65
+ end - start,
66
+ this.lexer.token_line,
67
+ this.lexer.token_column
68
+ );
63
69
  }
64
70
  is_and_or_not(str) {
65
- if (str.length > 3 || str.length < 2) return false;
66
71
  return str_equals("and", str) || str_equals("or", str) || str_equals("not", str);
67
72
  }
68
73
  // Parse a single media query: screen and (min-width: 768px)
69
74
  parse_single_media_query() {
70
75
  let query_start = this.lexer.pos;
71
- this.lexer.line;
72
76
  this.skip_whitespace();
73
77
  if (this.lexer.pos >= this.prelude_end) return null;
74
78
  let token_start = this.lexer.pos;
@@ -96,10 +100,10 @@ class AtRulePreludeParser {
96
100
  } else if (token_type === TOKEN_IDENT) {
97
101
  let text = this.source.substring(this.lexer.token_start, this.lexer.token_end);
98
102
  if (this.is_and_or_not(text)) {
99
- let op = this.create_node(NODE_PRELUDE_OPERATOR, this.lexer.token_start, this.lexer.token_end);
103
+ let op = this.create_node(PRELUDE_OPERATOR, this.lexer.token_start, this.lexer.token_end);
100
104
  components.push(op);
101
105
  } else {
102
- let media_type = this.create_node(NODE_PRELUDE_MEDIA_TYPE, this.lexer.token_start, this.lexer.token_end);
106
+ let media_type = this.create_node(MEDIA_TYPE, this.lexer.token_start, this.lexer.token_end);
103
107
  components.push(media_type);
104
108
  }
105
109
  } else {
@@ -107,16 +111,13 @@ class AtRulePreludeParser {
107
111
  }
108
112
  }
109
113
  if (components.length === 0) return null;
110
- let query_node = this.create_node(NODE_PRELUDE_MEDIA_QUERY, query_start, this.lexer.pos);
111
- for (let component of components) {
112
- this.arena.append_child(query_node, component);
113
- }
114
+ let query_node = this.create_node(MEDIA_QUERY, query_start, this.lexer.pos);
115
+ this.arena.append_children(query_node, components);
114
116
  return query_node;
115
117
  }
116
118
  // Parse media feature: (min-width: 768px)
117
119
  parse_media_feature() {
118
120
  let feature_start = this.lexer.token_start;
119
- this.lexer.token_line;
120
121
  let depth = 1;
121
122
  let content_start = this.lexer.pos;
122
123
  while (this.lexer.pos < this.prelude_end && depth > 0) {
@@ -131,10 +132,10 @@ class AtRulePreludeParser {
131
132
  if (depth !== 0) return null;
132
133
  let content_end = this.lexer.token_start;
133
134
  let feature_end = this.lexer.token_end;
134
- let feature = this.create_node(NODE_PRELUDE_MEDIA_FEATURE, feature_start, feature_end);
135
+ let feature = this.create_node(MEDIA_FEATURE, feature_start, feature_end);
135
136
  let trimmed = trim_boundaries(this.source, content_start, content_end);
136
137
  if (trimmed) {
137
- this.arena.set_value_start(feature, trimmed[0]);
138
+ this.arena.set_value_start_delta(feature, trimmed[0] - feature_start);
138
139
  this.arena.set_value_length(feature, trimmed[1] - trimmed[0]);
139
140
  }
140
141
  return feature;
@@ -143,7 +144,6 @@ class AtRulePreludeParser {
143
144
  parse_container_query() {
144
145
  let nodes = [];
145
146
  let query_start = this.lexer.pos;
146
- this.lexer.line;
147
147
  let components = [];
148
148
  while (this.lexer.pos < this.prelude_end) {
149
149
  this.skip_whitespace();
@@ -158,19 +158,17 @@ class AtRulePreludeParser {
158
158
  } else if (token_type === TOKEN_IDENT) {
159
159
  let text = this.source.substring(this.lexer.token_start, this.lexer.token_end);
160
160
  if (this.is_and_or_not(text)) {
161
- let op = this.create_node(NODE_PRELUDE_OPERATOR, this.lexer.token_start, this.lexer.token_end);
161
+ let op = this.create_node(PRELUDE_OPERATOR, this.lexer.token_start, this.lexer.token_end);
162
162
  components.push(op);
163
163
  } else {
164
- let name = this.create_node(NODE_PRELUDE_IDENTIFIER, this.lexer.token_start, this.lexer.token_end);
164
+ let name = this.create_node(IDENTIFIER, this.lexer.token_start, this.lexer.token_end);
165
165
  components.push(name);
166
166
  }
167
167
  }
168
168
  }
169
169
  if (components.length === 0) return [];
170
- let query_node = this.create_node(NODE_PRELUDE_CONTAINER_QUERY, query_start, this.lexer.pos);
171
- for (let component of components) {
172
- this.arena.append_child(query_node, component);
173
- }
170
+ let query_node = this.create_node(CONTAINER_QUERY, query_start, this.lexer.pos);
171
+ this.arena.append_children(query_node, components);
174
172
  nodes.push(query_node);
175
173
  return nodes;
176
174
  }
@@ -184,7 +182,6 @@ class AtRulePreludeParser {
184
182
  let token_type = this.lexer.token_type;
185
183
  if (token_type === TOKEN_LEFT_PAREN) {
186
184
  let feature_start = this.lexer.token_start;
187
- this.lexer.token_line;
188
185
  let depth = 1;
189
186
  let content_start = this.lexer.pos;
190
187
  while (this.lexer.pos < this.prelude_end && depth > 0) {
@@ -199,10 +196,10 @@ class AtRulePreludeParser {
199
196
  if (depth === 0) {
200
197
  let content_end = this.lexer.token_start;
201
198
  let feature_end = this.lexer.token_end;
202
- let query = this.create_node(NODE_PRELUDE_SUPPORTS_QUERY, feature_start, feature_end);
199
+ let query = this.create_node(SUPPORTS_QUERY, feature_start, feature_end);
203
200
  let trimmed = trim_boundaries(this.source, content_start, content_end);
204
201
  if (trimmed) {
205
- this.arena.set_value_start(query, trimmed[0]);
202
+ this.arena.set_value_start_delta(query, trimmed[0] - feature_start);
206
203
  this.arena.set_value_length(query, trimmed[1] - trimmed[0]);
207
204
  }
208
205
  nodes.push(query);
@@ -210,7 +207,7 @@ class AtRulePreludeParser {
210
207
  } else if (token_type === TOKEN_IDENT) {
211
208
  let text = this.source.substring(this.lexer.token_start, this.lexer.token_end);
212
209
  if (this.is_and_or_not(text)) {
213
- let op = this.create_node(NODE_PRELUDE_OPERATOR, this.lexer.token_start, this.lexer.token_end);
210
+ let op = this.create_node(PRELUDE_OPERATOR, this.lexer.token_start, this.lexer.token_end);
214
211
  nodes.push(op);
215
212
  }
216
213
  }
@@ -226,7 +223,7 @@ class AtRulePreludeParser {
226
223
  this.next_token();
227
224
  let token_type = this.lexer.token_type;
228
225
  if (token_type === TOKEN_IDENT) {
229
- let layer = this.create_node(NODE_PRELUDE_LAYER_NAME, this.lexer.token_start, this.lexer.token_end);
226
+ let layer = this.create_node(LAYER_NAME, this.lexer.token_start, this.lexer.token_end);
230
227
  nodes.push(layer);
231
228
  } else if (token_type === TOKEN_COMMA) {
232
229
  continue;
@@ -242,7 +239,7 @@ class AtRulePreludeParser {
242
239
  if (this.lexer.pos >= this.prelude_end) return [];
243
240
  this.next_token();
244
241
  if (this.lexer.token_type !== TOKEN_IDENT) return [];
245
- let ident = this.create_node(NODE_PRELUDE_IDENTIFIER, this.lexer.token_start, this.lexer.token_end);
242
+ let ident = this.create_node(IDENTIFIER, this.lexer.token_start, this.lexer.token_end);
246
243
  return [ident];
247
244
  }
248
245
  // Parse @import prelude: url() [layer] [supports()] [media-query-list]
@@ -283,7 +280,6 @@ class AtRulePreludeParser {
283
280
  }
284
281
  let url_start = this.lexer.token_start;
285
282
  let url_end = this.lexer.token_end;
286
- this.lexer.token_line;
287
283
  if (this.lexer.token_type === TOKEN_FUNCTION) {
288
284
  let paren_depth = 1;
289
285
  while (this.lexer.pos < this.prelude_end && paren_depth > 0) {
@@ -300,7 +296,7 @@ class AtRulePreludeParser {
300
296
  }
301
297
  }
302
298
  }
303
- let url_node = this.create_node(NODE_PRELUDE_IMPORT_URL, url_start, url_end);
299
+ let url_node = this.create_node(URL, url_start, url_end);
304
300
  return url_node;
305
301
  }
306
302
  // Parse import layer: layer or layer(name)
@@ -315,7 +311,6 @@ class AtRulePreludeParser {
315
311
  if (str_equals("layer", text)) {
316
312
  let layer_start = this.lexer.token_start;
317
313
  let layer_end = this.lexer.token_end;
318
- this.lexer.token_line;
319
314
  let content_start = 0;
320
315
  let content_length = 0;
321
316
  if (this.lexer.token_type === TOKEN_FUNCTION) {
@@ -336,11 +331,11 @@ class AtRulePreludeParser {
336
331
  }
337
332
  }
338
333
  }
339
- let layer_node = this.create_node(NODE_PRELUDE_IMPORT_LAYER, layer_start, layer_end);
334
+ let layer_node = this.create_node(LAYER_NAME, layer_start, layer_end);
340
335
  if (content_length > 0) {
341
336
  let trimmed = trim_boundaries(this.source, content_start, content_start + content_length);
342
337
  if (trimmed) {
343
- this.arena.set_content_start(layer_node, trimmed[0]);
338
+ this.arena.set_content_start_delta(layer_node, trimmed[0] - layer_start);
344
339
  this.arena.set_content_length(layer_node, trimmed[1] - trimmed[0]);
345
340
  }
346
341
  }
@@ -358,7 +353,6 @@ class AtRulePreludeParser {
358
353
  let text = this.source.substring(this.lexer.token_start, this.lexer.token_end - 1);
359
354
  if (str_equals("supports", text)) {
360
355
  let supports_start = this.lexer.token_start;
361
- this.lexer.token_line;
362
356
  let paren_depth = 1;
363
357
  let supports_end = this.lexer.token_end;
364
358
  while (this.lexer.pos < this.prelude_end && paren_depth > 0) {
@@ -374,7 +368,7 @@ class AtRulePreludeParser {
374
368
  break;
375
369
  }
376
370
  }
377
- let supports_node = this.create_node(NODE_PRELUDE_IMPORT_SUPPORTS, supports_start, supports_end);
371
+ let supports_node = this.create_node(SUPPORTS_QUERY, supports_start, supports_end);
378
372
  return supports_node;
379
373
  }
380
374
  }
@@ -1,34 +1,4 @@
1
- import { CSSDataArena } from './arena';
2
1
  import { CSSNode } from './css-node';
3
- export declare class SelectorParser {
4
- private lexer;
5
- private arena;
6
- private source;
7
- private selector_end;
8
- constructor(arena: CSSDataArena, source: string);
9
- parse_selector(start: number, end: number, line?: number, column?: number, allow_relative?: boolean): number | null;
10
- private parse_selector_list;
11
- private parse_complex_selector;
12
- private parse_compound_selector;
13
- private parse_simple_selector;
14
- private parse_namespace_local_part;
15
- private parse_type_or_namespace_selector;
16
- private parse_universal_or_namespace_selector;
17
- private parse_empty_namespace_selector;
18
- private try_parse_combinator;
19
- private parse_class_selector;
20
- private parse_attribute_selector;
21
- private parse_attribute_content;
22
- private parse_pseudo;
23
- private parse_pseudo_function;
24
- private parse_pseudo_function_after_colon;
25
- private is_nth_pseudo;
26
- private parse_lang_identifiers;
27
- private parse_nth_expression;
28
- private find_of_keyword;
29
- private create_node;
30
- private skip_whitespace;
31
- }
32
2
  /**
33
3
  * Parse a CSS selector string and return an AST
34
4
  * @param source - The CSS selector to parse (e.g., "div.class > p#id")