crass 0.2.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +4 -0
  3. data/HISTORY.md +22 -1
  4. data/LICENSE +1 -1
  5. data/README.md +64 -72
  6. data/Rakefile +4 -0
  7. data/crass.gemspec +2 -2
  8. data/lib/crass.rb +1 -1
  9. data/lib/crass/parser.rb +231 -96
  10. data/lib/crass/scanner.rb +21 -21
  11. data/lib/crass/token-scanner.rb +8 -1
  12. data/lib/crass/tokenizer.rb +133 -131
  13. data/lib/crass/version.rb +1 -1
  14. data/test/css-parsing-tests/An+B.json +156 -0
  15. data/test/css-parsing-tests/LICENSE +8 -0
  16. data/test/css-parsing-tests/README.rst +301 -0
  17. data/test/css-parsing-tests/color3.json +142 -0
  18. data/test/css-parsing-tests/color3_hsl.json +3890 -0
  19. data/test/css-parsing-tests/color3_keywords.json +803 -0
  20. data/test/css-parsing-tests/component_value_list.json +432 -0
  21. data/test/css-parsing-tests/declaration_list.json +44 -0
  22. data/test/css-parsing-tests/make_color3_hsl.py +17 -0
  23. data/test/css-parsing-tests/make_color3_keywords.py +191 -0
  24. data/test/css-parsing-tests/one_component_value.json +27 -0
  25. data/test/css-parsing-tests/one_declaration.json +46 -0
  26. data/test/css-parsing-tests/one_rule.json +36 -0
  27. data/test/css-parsing-tests/rule_list.json +48 -0
  28. data/test/css-parsing-tests/stylesheet.json +44 -0
  29. data/test/css-parsing-tests/stylesheet_bytes.json +146 -0
  30. data/test/shared/parse_rules.rb +377 -434
  31. data/test/support/common.rb +124 -0
  32. data/test/support/serialization/animate.css +3158 -0
  33. data/test/support/serialization/html5-boilerplate.css +268 -0
  34. data/test/support/serialization/misc.css +9 -0
  35. data/test/test_css_parsing_tests.rb +150 -0
  36. data/test/test_parse_properties.rb +136 -211
  37. data/test/test_parse_rules.rb +0 -52
  38. data/test/test_parse_stylesheet.rb +0 -39
  39. data/test/test_serialization.rb +13 -4
  40. metadata +44 -7
  41. data/test/test_tokenizer.rb +0 -1562
@@ -0,0 +1,432 @@
1
+ [
2
+
3
+ "", [],
4
+
5
+ "/*/*///** /* **/*//* ", [
6
+ "/", "*", "/"
7
+ ],
8
+
9
+ "red", [
10
+ ["ident", "red"]
11
+ ],
12
+
13
+ " \t\t\r\n\nRed ", [
14
+ " ", ["ident", "Red"], " "
15
+ ],
16
+
17
+ "red/* CDC */-->", [
18
+ ["ident", "red"], "-->"
19
+ ],
20
+
21
+ "red-->/* Not CDC */", [
22
+ ["ident", "red--"], ">"
23
+ ],
24
+
25
+ "\\- red0 -red --red -\\-red\\ blue 0red -0red \u0000red _Red .red rêd r\\êd \u007F\u0080\u0081", [
26
+ ["ident", "-"], " ",
27
+ ["ident", "red0"], " ",
28
+ ["ident", "-red"], " ",
29
+ ["ident", "--red"], " ",
30
+ ["ident", "--red blue"], " ",
31
+ ["dimension", "0", 0, "integer", "red"], " ",
32
+ ["dimension", "-0", 0, "integer", "red"], " ",
33
+ ["ident", "\uFFFDred"], " ",
34
+ ["ident", "_Red"], " ",
35
+ ".", ["ident", "red"], " ",
36
+ ["ident", "rêd"], " ",
37
+ ["ident", "rêd"], " ",
38
+ "\u007F", ["ident", "\u0080\u0081"]
39
+ ],
40
+
41
+ "\\30red \\00030 red \\30\r\nred \\0000000red \\1100000red \\red \\r ed \\.red \\ red \\\nred \\376\\37 6\\000376\\0000376\\", [
42
+ ["ident", "0red"], " ",
43
+ ["ident", "0red"], " ",
44
+ ["ident", "0red"], " ",
45
+ ["ident", "\uFFFD0red"], " ",
46
+ ["ident", "\uFFFD0red"], " ",
47
+ ["ident", "red"], " ",
48
+ ["ident", "r"], " ", ["ident", "ed"], " ",
49
+ ["ident", ".red"], " ",
50
+ ["ident", " red"], " ",
51
+ "\\", " ", ["ident", "red"], " ",
52
+ ["ident", "Ͷ76Ͷ76\uFFFD"]
53
+ ],
54
+
55
+ "rgba0() -rgba() --rgba() -\\-rgba() 0rgba() -0rgba() _rgba() .rgba() rgbâ() \\30rgba() rgba () @rgba() #rgba()", [
56
+ ["function", "rgba0"], " ",
57
+ ["function", "-rgba"], " ",
58
+ ["function", "--rgba"], " ",
59
+ ["function", "--rgba"], " ",
60
+ ["dimension", "0", 0, "integer", "rgba"], ["()"], " ",
61
+ ["dimension", "-0", 0, "integer", "rgba"], ["()"], " ",
62
+ ["function", "_rgba"], " ",
63
+ ".", ["function", "rgba"], " ",
64
+ ["function", "rgbâ"], " ",
65
+ ["function", "0rgba"], " ",
66
+ ["ident", "rgba"], " ", ["()"], " ",
67
+ ["at-keyword", "rgba"], ["()"], " ",
68
+ ["hash", "rgba", "id"], ["()"]
69
+ ],
70
+
71
+ "@media0 @-Media @--media @-\\-media @0media @-0media @_media @.media @medİa @\\30 media\\", [
72
+ ["at-keyword", "media0"], " ",
73
+ ["at-keyword", "-Media"], " ",
74
+ ["at-keyword", "--media"], " ",
75
+ ["at-keyword", "--media"], " ",
76
+ "@", ["dimension", "0", 0, "integer", "media"], " ",
77
+ "@", ["dimension", "-0", 0, "integer", "media"], " ",
78
+ ["at-keyword", "_media"], " ",
79
+ "@", ".", ["ident", "media"], " ",
80
+ ["at-keyword", "medİa"], " ",
81
+ ["at-keyword", "0media\uFFFD"]
82
+ ],
83
+
84
+ "#red0 #-Red #--red #-\\-red #0red #-0red #_Red #.red #rêd #êrd #\\.red\\", [
85
+ ["hash", "red0", "id"], " ",
86
+ ["hash", "-Red", "id"], " ",
87
+ ["hash", "--red", "id"], " ",
88
+ ["hash", "--red", "id"], " ",
89
+ ["hash", "0red", "unrestricted"], " ",
90
+ ["hash", "-0red", "unrestricted"], " ",
91
+ ["hash", "_Red", "id"], " ",
92
+ "#", ".", ["ident", "red"], " ",
93
+ ["hash", "rêd", "id"], " ",
94
+ ["hash", "êrd", "id"], " ",
95
+ ["hash", ".red\uFFFD", "id"]
96
+ ],
97
+
98
+ "p[example=\"\\\nfoo(int x) {\\\n this.x = x;\\\n}\\\n\"]", [
99
+ ["ident", "p"], ["[]",
100
+ ["ident", "example"], "=", ["string", "foo(int x) { this.x = x;}"]
101
+ ]
102
+ ],
103
+
104
+ "'' 'Lorem \"îpsum\"' 'a\\\nb' 'a\nb 'eof", [
105
+ ["string", ""], " ",
106
+ ["string", "Lorem \"îpsum\""], " ",
107
+ ["string", "ab"], " ",
108
+ ["error", "bad-string"], " ", ["ident", "b"], " ",
109
+ ["string", "eof"]
110
+ ],
111
+
112
+ "\"\" \"Lorem 'îpsum'\" \"a\\\nb\" \"a\nb \"eof", [
113
+ ["string", ""], " ",
114
+ ["string", "Lorem 'îpsum'"], " ",
115
+ ["string", "ab"], " ",
116
+ ["error", "bad-string"], " ", ["ident", "b"], " ",
117
+ ["string", "eof"]
118
+ ],
119
+
120
+ "\"Lo\\rem \\130 ps\\u m\" '\\376\\37 6\\000376\\0000376\\", [
121
+ ["string", "Lorem İpsu m"], " ",
122
+ ["string", "Ͷ76Ͷ76"]
123
+ ],
124
+
125
+ "url( '') url('Lorem \"îpsum\"'\n) url('a\\\nb' ) url('a\nb) url('eof", [
126
+ ["function", "url", " ", ["string", ""]], " ",
127
+ ["function", "url", ["string", "Lorem \"îpsum\""], " "], " ",
128
+ ["function", "url", ["string", "ab"], " "], " ",
129
+ ["function", "url", ["error", "bad-string"], " ", ["ident", "b"]], " ",
130
+ ["function", "url", ["string", "eof"]]
131
+ ],
132
+
133
+ "url(", [
134
+ ["url", ""]
135
+ ],
136
+
137
+ "url( \t", [
138
+ ["url", ""]
139
+ ],
140
+
141
+ "url(\"\") url(\"Lorem 'îpsum'\"\n) url(\"a\\\nb\" ) url(\"a\nb) url(\"eof", [
142
+ ["function", "url", ["string", ""]], " ",
143
+ ["function", "url", ["string", "Lorem 'îpsum'"], " "], " ",
144
+ ["function", "url", ["string", "ab"], " "], " ",
145
+ ["function", "url", ["error", "bad-string"], " ", ["ident", "b"]], " ",
146
+ ["function", "url", ["string", "eof"]]
147
+ ],
148
+
149
+ "url(\"Lo\\rem \\130 ps\\u m\") url('\\376\\37 6\\000376\\0000376\\", [
150
+ ["function", "url", ["string", "Lorem İpsu m"]], " ",
151
+ ["function", "url", ["string", "Ͷ76Ͷ76"]]
152
+ ],
153
+
154
+ "URL(foo) Url(foo) ûrl(foo) url (foo) url\\ (foo) url(\t 'foo' ", [
155
+ ["url", "foo"], " ",
156
+ ["url", "foo"], " ",
157
+ ["function", "ûrl", ["ident", "foo"]], " ",
158
+ ["ident", "url"], " ", ["()", ["ident", "foo"]], " ",
159
+ ["function", "url ", ["ident", "foo"]], " ",
160
+ ["function", "url", " ", ["string", "foo"], " "]
161
+ ],
162
+
163
+ "url('a' b) url('c' d)", [
164
+ ["function", "url", ["string", "a"], " ", ["ident", "b"]], " ",
165
+ ["function", "url", ["string", "c"], " ", ["ident", "d"]]
166
+ ],
167
+
168
+ "url('a\nb) url('c\n", [
169
+ ["function", "url", ["error", "bad-string"], " ", ["ident", "b"]], " ",
170
+ ["function", "url", ["error", "bad-string"], " "]
171
+ ],
172
+
173
+ "url() url( \t) url(\n Foô\\030\n!\n) url(\na\nb\n) url(a\\ b) url(a(b) url(a\\(b) url(a'b) url(a\\'b) url(a\"b) url(a\\\"b) url(a\nb) url(a\\\nb) url(a\\a b) url(a\\", [
174
+ ["url", ""], " ",
175
+ ["url", ""], " ",
176
+ ["url", "Foô0!"], " ",
177
+ ["error", "bad-url"], " ",
178
+ ["url", "a b"], " ",
179
+ ["error", "bad-url"], " ",
180
+ ["url", "a(b"], " ",
181
+ ["error", "bad-url"], " ",
182
+ ["url", "a'b"], " ",
183
+ ["error", "bad-url"], " ",
184
+ ["url", "a\"b"], " ",
185
+ ["error", "bad-url"], " ",
186
+ ["error", "bad-url"], " ",
187
+ ["url", "a\nb"], " ",
188
+ ["url", "a\uFFFD"]
189
+ ],
190
+
191
+ "url(\u0000!#$%&*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~\u0080\u0081\u009e\u009f\u00a0\u00a1\u00a2", [
192
+ ["url", "\uFFFD!#$%&*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~\u0080\u0081\u009e\u009f\u00a0¡¢"]
193
+ ],
194
+
195
+ "url(\u0001) url(\u0002) url(\u0003) url(\u0004) url(\u0005) url(\u0006) url(\u0007) url(\u0008) url(\u000b) url(\u000e) url(\u000f) url(\u0010) url(\u0011) url(\u0012) url(\u0013) url(\u0014) url(\u0015) url(\u0016) url(\u0017) url(\u0018) url(\u0019) url(\u001a) url(\u001b) url(\u001c) url(\u001d) url(\u001e) url(\u001f) url(\u007f)", [
196
+ ["error", "bad-url"], " ",
197
+ ["error", "bad-url"], " ",
198
+ ["error", "bad-url"], " ",
199
+ ["error", "bad-url"], " ",
200
+ ["error", "bad-url"], " ",
201
+ ["error", "bad-url"], " ",
202
+ ["error", "bad-url"], " ",
203
+ ["error", "bad-url"], " ",
204
+ ["error", "bad-url"], " ",
205
+ ["error", "bad-url"], " ",
206
+ ["error", "bad-url"], " ",
207
+ ["error", "bad-url"], " ",
208
+ ["error", "bad-url"], " ",
209
+ ["error", "bad-url"], " ",
210
+ ["error", "bad-url"], " ",
211
+ ["error", "bad-url"], " ",
212
+ ["error", "bad-url"], " ",
213
+ ["error", "bad-url"], " ",
214
+ ["error", "bad-url"], " ",
215
+ ["error", "bad-url"], " ",
216
+ ["error", "bad-url"], " ",
217
+ ["error", "bad-url"], " ",
218
+ ["error", "bad-url"], " ",
219
+ ["error", "bad-url"], " ",
220
+ ["error", "bad-url"], " ",
221
+ ["error", "bad-url"], " ",
222
+ ["error", "bad-url"], " ",
223
+ ["error", "bad-url"]
224
+ ],
225
+
226
+ "12 +34 -45 .67 +.89 -.01 2.3 +45.0 -0.67", [
227
+ ["number", "12", 12, "integer"], " ",
228
+ ["number", "+34", 34, "integer"], " ",
229
+ ["number", "-45", -45, "integer"], " ",
230
+ ["number", ".67", 0.67, "number"], " ",
231
+ ["number", "+.89", 0.89, "number"], " ",
232
+ ["number", "-.01", -0.01, "number"], " ",
233
+ ["number", "2.3", 2.3, "number"], " ",
234
+ ["number", "+45.0", 45, "number"], " ",
235
+ ["number", "-0.67", -0.67, "number"]
236
+ ],
237
+
238
+ "12e2 +34e+1 -45E-0 .68e+3 +.79e-1 -.01E2 2.3E+1 +45.0e6 -0.67e0", [
239
+ ["number", "12e2", 1200, "number"], " ",
240
+ ["number", "+34e+1", 340, "number"], " ",
241
+ ["number", "-45E-0", -45, "number"], " ",
242
+ ["number", ".68e+3", 680, "number"], " ",
243
+ ["number", "+.79e-1", 0.079, "number"], " ",
244
+ ["number", "-.01E2", -1, "number"], " ",
245
+ ["number", "2.3E+1", 23, "number"], " ",
246
+ ["number", "+45.0e6", 45000000, "number"], " ",
247
+ ["number", "-0.67e0", -0.67, "number"]
248
+ ],
249
+
250
+ "3. /* Decimal point must have following digits */", [
251
+ ["number", "3", 3, "integer"], ".", " "
252
+ ],
253
+
254
+ "3\\65-2 /* Scientific notation E can not be escaped */", [
255
+ ["dimension", "3", 3, "integer", "e-2"], " "
256
+ ],
257
+
258
+ "3e-2.1 /* Integer exponents only */", [
259
+ ["number", "3e-2", 0.03, "number"],
260
+ ["number", ".1", 0.1, "number"], " "
261
+ ],
262
+
263
+ "12% +34% -45% .67% +.89% -.01% 2.3% +45.0% -0.67%", [
264
+ ["percentage", "12", 12, "integer"], " ",
265
+ ["percentage", "+34", 34, "integer"], " ",
266
+ ["percentage", "-45", -45, "integer"], " ",
267
+ ["percentage", ".67", 0.67, "number"], " ",
268
+ ["percentage", "+.89", 0.89, "number"], " ",
269
+ ["percentage", "-.01", -0.01, "number"], " ",
270
+ ["percentage", "2.3", 2.3, "number"], " ",
271
+ ["percentage", "+45.0", 45, "number"], " ",
272
+ ["percentage", "-0.67", -0.67, "number"]
273
+ ],
274
+
275
+ "12e2% +34e+1% -45E-0% .68e+3% +.79e-1% -.01E2% 2.3E+1% +45.0e6% -0.67e0%", [
276
+ ["percentage", "12e2", 1200, "number"], " ",
277
+ ["percentage", "+34e+1", 340, "number"], " ",
278
+ ["percentage", "-45E-0", -45, "number"], " ",
279
+ ["percentage", ".68e+3", 680, "number"], " ",
280
+ ["percentage", "+.79e-1", 0.079, "number"], " ",
281
+ ["percentage", "-.01E2", -1, "number"], " ",
282
+ ["percentage", "2.3E+1", 23, "number"], " ",
283
+ ["percentage", "+45.0e6", 45000000, "number"], " ",
284
+ ["percentage", "-0.67e0", -0.67, "number"]
285
+ ],
286
+
287
+ "12\\% /* Percent sign can not be escaped */", [
288
+ ["dimension", "12", 12, "integer", "%"], " "
289
+ ],
290
+
291
+ "12px +34px -45px .67px +.89px -.01px 2.3px +45.0px -0.67px", [
292
+ ["dimension", "12", 12, "integer", "px"], " ",
293
+ ["dimension", "+34", 34, "integer", "px"], " ",
294
+ ["dimension", "-45", -45, "integer", "px"], " ",
295
+ ["dimension", ".67", 0.67, "number", "px"], " ",
296
+ ["dimension", "+.89", 0.89, "number", "px"], " ",
297
+ ["dimension", "-.01", -0.01, "number", "px"], " ",
298
+ ["dimension", "2.3", 2.3, "number", "px"], " ",
299
+ ["dimension", "+45.0", 45, "number", "px"], " ",
300
+ ["dimension", "-0.67", -0.67, "number", "px"]
301
+ ],
302
+
303
+ "12e2px +34e+1px -45E-0px .68e+3px +.79e-1px -.01E2px 2.3E+1px +45.0e6px -0.67e0px", [
304
+ ["dimension", "12e2", 1200, "number", "px"], " ",
305
+ ["dimension", "+34e+1", 340, "number", "px"], " ",
306
+ ["dimension", "-45E-0", -45, "number", "px"], " ",
307
+ ["dimension", ".68e+3", 680, "number", "px"], " ",
308
+ ["dimension", "+.79e-1", 0.079, "number", "px"], " ",
309
+ ["dimension", "-.01E2", -1, "number", "px"], " ",
310
+ ["dimension", "2.3E+1", 23, "number", "px"], " ",
311
+ ["dimension", "+45.0e6", 45000000, "number", "px"], " ",
312
+ ["dimension", "-0.67e0", -0.67, "number", "px"]
313
+ ],
314
+
315
+ "12red0 12.0-red 12--red 12-\\-red 120red 12-0red 12\u0000red 12_Red 12.red 12rêd", [
316
+ ["dimension", "12", 12, "integer", "red0"], " ",
317
+ ["dimension", "12.0", 12, "number", "-red"], " ",
318
+ ["dimension", "12", 12, "integer", "--red"], " ",
319
+ ["dimension", "12", 12, "integer", "--red"], " ",
320
+ ["dimension", "120", 120, "integer", "red"], " ",
321
+ ["number", "12", 12, "integer"], ["dimension", "-0", 0, "integer", "red"], " ",
322
+ ["dimension", "12", 12, "integer", "\uFFFDred"], " ",
323
+ ["dimension", "12", 12, "integer", "_Red"], " ",
324
+ ["number", "12", 12, "integer"], ".", ["ident", "red"], " ",
325
+ ["dimension", "12", 12, "integer", "rêd"]
326
+ ],
327
+
328
+ "u+1 U+10 U+100 U+1000 U+10000 U+100000 U+1000000", [
329
+ ["unicode-range", 1, 1], " ",
330
+ ["unicode-range", 16, 16], " ",
331
+ ["unicode-range", 256, 256], " ",
332
+ ["unicode-range", 4096, 4096], " ",
333
+ ["unicode-range", 65536, 65536], " ",
334
+ ["unicode-range", 1048576, 1048576], " ",
335
+ ["unicode-range", 1048576, 1048576], ["number", "0", 0, "integer"]
336
+ ],
337
+
338
+ "u+? u+1? U+10? U+100? U+1000? U+10000? U+100000?", [
339
+ ["unicode-range", 0, 15], " ",
340
+ ["unicode-range", 16, 31], " ",
341
+ ["unicode-range", 256, 271], " ",
342
+ ["unicode-range", 4096, 4111], " ",
343
+ ["unicode-range", 65536, 65551], " ",
344
+ ["unicode-range", 1048576, 1048591], " ",
345
+ ["unicode-range", 1048576, 1048576], "?"
346
+ ],
347
+
348
+ "u+?? U+1?? U+10?? U+100?? U+1000?? U+10000??", [
349
+ ["unicode-range", 0, 255], " ",
350
+ ["unicode-range", 256, 511], " ",
351
+ ["unicode-range", 4096, 4351], " ",
352
+ ["unicode-range", 65536, 65791], " ",
353
+ ["unicode-range", 1048576, 1048831], " ",
354
+ ["unicode-range", 1048576, 1048591], "?"
355
+ ],
356
+
357
+ "u+??? U+1??? U+10??? U+100??? U+1000???", [
358
+ ["unicode-range", 0, 4095], " ",
359
+ ["unicode-range", 4096, 8191], " ",
360
+ ["unicode-range", 65536, 69631], " ",
361
+ ["unicode-range", 1048576, 1052671], " ",
362
+ ["unicode-range", 1048576, 1048831], "?"
363
+ ],
364
+
365
+ "u+???? U+1???? U+10???? U+100????", [
366
+ ["unicode-range", 0, 65535], " ",
367
+ ["unicode-range", 65536, 131071], " ",
368
+ ["unicode-range", 1048576, 1114111], " ",
369
+ ["unicode-range", 1048576, 1052671], "?"
370
+ ],
371
+
372
+ "u+????? U+1????? U+10?????", [
373
+ ["unicode-range", 0, 1048575], " ",
374
+ ["unicode-range", 1048576, 2097151], " ",
375
+ ["unicode-range", 1048576, 1114111], "?"
376
+ ],
377
+
378
+ "u+?????? U+1??????", [
379
+ ["unicode-range", 0, 16777215], " ",
380
+ ["unicode-range", 1048576, 2097151], "?"
381
+ ],
382
+
383
+ "u+1-2 U+100000-2 U+1000000-2 U+10-200000", [
384
+ ["unicode-range", 1, 2], " ",
385
+ ["unicode-range", 1048576, 2], " ",
386
+ ["unicode-range", 1048576, 1048576], ["number", "0", 0, "integer"],
387
+ ["number", "-2", -2, "integer"], " ",
388
+ ["unicode-range", 16, 2097152]
389
+ ],
390
+
391
+ "ù+12 Ü+12 u +12 U+ 12 U+12 - 20 U+1?2 U+1?-50", [
392
+ ["ident", "ù"], ["number", "+12", 12, "integer"], " ",
393
+ ["ident", "Ü"], ["number", "+12", 12, "integer"], " ",
394
+ ["ident", "u"], " ", ["number", "+12", 12, "integer"], " ",
395
+ ["ident", "U"], "+", " ", ["number", "12", 12, "integer"], " ",
396
+ ["unicode-range", 18, 18], " ", "-", " ", ["number", "20", 20, "integer"], " ",
397
+ ["unicode-range", 16, 31], ["number", "2", 2, "integer"], " ",
398
+ ["unicode-range", 16, 31], ["number", "-50", -50, "integer"]
399
+ ],
400
+
401
+ "~=|=^=$=*=||<!------> |/**/| ~/**/=", [
402
+ "~=", "|=", "^=", "$=", "*=", "||", "<!--", ["ident", "----"], ">",
403
+ " ", "|", "|", " ", "~", "="
404
+ ],
405
+
406
+ "a:not([href^=http\\:], [href ^=\t'https\\:'\n]) { color: rgba(0%, 100%, 50%); }", [
407
+ ["ident", "a"], ":", ["function", "not",
408
+ ["[]",
409
+ ["ident", "href"], "^=", ["ident", "http:"]
410
+ ], ",", " ", ["[]",
411
+ ["ident", "href"], " ", "^=", " ", ["string", "https:"], " "
412
+ ]
413
+ ], " ", ["{}",
414
+ " ", ["ident", "color"], ":", " ", ["function", "rgba",
415
+ ["percentage", "0", 0, "integer"], ",", " ",
416
+ ["percentage", "100", 100, "integer"], ",", " ",
417
+ ["percentage", "50", 50, "integer"]
418
+ ], ";", " "
419
+ ]
420
+ ],
421
+
422
+ "@media print { (foo]{bar) }baz", [
423
+ ["at-keyword", "media"], " ", ["ident", "print"], " ", ["{}",
424
+ " ", ["()",
425
+ ["ident", "foo"], ["error", "]"], ["{}",
426
+ ["ident", "bar"], ["error", ")"], " "
427
+ ], ["ident", "baz"]
428
+ ]
429
+ ]
430
+ ]
431
+
432
+ ]
@@ -0,0 +1,44 @@
1
+ [
2
+
3
+ "", [],
4
+ ";; /**/ ; ;", [],
5
+ "a:b; c:d 42!important;\n", [
6
+ ["declaration", "a", [["ident", "b"]], false],
7
+ ["declaration", "c", [["ident", "d"], " ", ["number", "42", 42, "integer"]], true]
8
+ ],
9
+
10
+ "z;a:b", [
11
+ ["error", "invalid"],
12
+ ["declaration", "a", [["ident", "b"]], false]
13
+ ],
14
+
15
+ "z:x!;a:b", [
16
+ ["declaration", "z", [["ident", "x"], "!"], false],
17
+ ["declaration", "a", [["ident", "b"]], false]
18
+ ],
19
+
20
+ "a:b; c+:d", [
21
+ ["declaration", "a", [["ident", "b"]], false],
22
+ ["error", "invalid"]
23
+ ],
24
+
25
+ "@import 'foo.css'; a:b; @import 'bar.css'", [
26
+ ["at-rule", "import", [" ", ["string", "foo.css"]], null],
27
+ ["declaration", "a", [["ident", "b"]], false],
28
+ ["at-rule", "import", [" ", ["string", "bar.css"]], null]
29
+ ],
30
+
31
+ "@media screen { div{;}} a:b;; @media print{div{", [
32
+ ["at-rule", "media", [" ", ["ident", "screen"], " "], [" ", ["ident", "div"], ["{}", ";"]]],
33
+ ["declaration", "a", [["ident", "b"]], false],
34
+ ["at-rule", "media", [" ", ["ident", "print"]], [["ident", "div"], ["{}"]]]
35
+ ],
36
+
37
+ "@ media screen { div{;}} a:b;; @media print{div{", [
38
+ ["error", "invalid"],
39
+ ["at-rule", "media", [" ", ["ident", "print"]], [["ident", "div"], ["{}"]]]
40
+ ],
41
+
42
+ "", []
43
+
44
+ ]