Skip to content

Commit be2503e

Browse files
author
bors-servo
authored
Auto merge of servo#120 - servo:0.9, r=mbrubeck
Batched breaking changes Closes servo#117 <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/rust-cssparser/120) <!-- Reviewable:end -->
2 parents 4507fe5 + f2927df commit be2503e

11 files changed

+457
-225
lines changed

Cargo.toml

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22

33
name = "cssparser"
4-
version = "0.8.0"
4+
version = "0.9.0"
55
authors = [ "Simon Sapin <simon.sapin@exyr.org>" ]
66

77
description = "Rust implementation of CSS Syntax Level 3"
@@ -14,12 +14,15 @@ build = "build.rs"
1414

1515
exclude = ["src/css-parsing-tests"]
1616

17+
[lib]
18+
doctest = false
19+
1720
[dev-dependencies]
1821
rustc-serialize = "0.3"
1922
tempdir = "0.3"
23+
encoding_rs = "0.3.2"
2024

2125
[dependencies]
22-
encoding = "0.2"
2326
heapsize = {version = ">=0.1.1, <0.4.0", optional = true}
2427
matches = "0.1"
2528
serde = {version = ">=0.6.6, <0.9", optional = true}

build.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* License, v. 2.0. If a copy of the MPL was not distributed with this
33
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
44

5-
#[macro_use] extern crate quote;
5+
extern crate quote;
66
extern crate syn;
77

88
use std::env;

src/css-parsing-tests/README.rst

+20-17
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ CSS parsing tests
44
This repository contains implementation-independent test for CSS parsers,
55
based on the 2013 draft of the `CSS Syntax Level 3`_ specification.
66

7-
.. _CSS Syntax Level 3: http://dev.w3.org/csswg/css-syntax-3/
7+
.. _CSS Syntax Level 3: https://drafts.csswg.org/css-syntax-3/
88

99
The upstream repository for these tests is at
1010
https://github.com/SimonSapin/css-parsing-tests
@@ -51,51 +51,51 @@ associated with the expected result.
5151

5252
``component_value_list.json``
5353
Tests `Parse a list of component values
54-
<http://dev.w3.org/csswg/css-syntax-3/#parse-a-list-of-component-values>`_.
54+
<https://drafts.csswg.org/css-syntax-3/#parse-a-list-of-component-values>`_.
5555
The Unicode input is represented by a JSON string,
5656
the output as an array of `component values`_ as described below.
5757

5858
``component_value_list.json``
5959
Tests `Parse a component value
60-
<http://dev.w3.org/csswg/css-syntax-3/#parse-a-component-value>`_.
60+
<https://drafts.csswg.org/css-syntax-3/#parse-a-component-value>`_.
6161
The Unicode input is represented by a JSON string,
6262
the output as a `component value`_.
6363

6464
``declaration_list.json``
6565
Tests `Parse a list of declarations
66-
<http://dev.w3.org/csswg/css-syntax-3/#parse-a-list-of-declarations>`_.
66+
<https://drafts.csswg.org/css-syntax-3/#parse-a-list-of-declarations>`_.
6767
The Unicode input is represented by a JSON string,
6868
the output as an array of declarations_ and at-rules_.
6969

7070
``one_declaration.json``
7171
Tests `Parse a declaration
72-
<http://dev.w3.org/csswg/css-syntax-3/#parse-a-declaration>`_.
72+
<https://drafts.csswg.org/css-syntax-3/#parse-a-declaration>`_.
7373
The Unicode input is represented by a JSON string,
7474
the output as a declaration_.
7575

7676
``one_rule.json``
7777
Tests `Parse a rule
78-
<http://dev.w3.org/csswg/css-syntax-3/#parse-a-rule>`_.
78+
<https://drafts.csswg.org/css-syntax-3/#parse-a-rule>`_.
7979
The Unicode input is represented by a JSON string,
8080
the output as a `qualified rule`_ or at-rule_.
8181

8282
``rule_list.json``
8383
Tests `Parse a list of rules
84-
<http://dev.w3.org/csswg/css-syntax-3/#parse-a-list-of-rules>`_.
84+
<https://drafts.csswg.org/css-syntax-3/#parse-a-list-of-rules>`_.
8585
The Unicode input is represented by a JSON string,
8686
the output as a list of `qualified rules`_ or at-rules_.
8787

8888
``stylesheet.json``
8989
Tests `Parse a stylesheet
90-
<http://dev.w3.org/csswg/css-syntax-3/#parse-a-stylesheet>`_.
90+
<https://drafts.csswg.org/css-syntax-3/#parse-a-stylesheet>`_.
9191
The Unicode input is represented by a JSON string,
9292
the output as a list of `qualified rules`_ or at-rules_.
9393

9494
``stylesheet_bytes.json``
9595
Tests `Parse a stylesheet
96-
<http://dev.w3.org/csswg/css-syntax-3/#parse-a-stylesheet>`_
96+
<https://drafts.csswg.org/css-syntax-3/#parse-a-stylesheet>`_
9797
together with `The input byte stream
98-
<http://dev.w3.org/csswg/css-syntax/#input-byte-stream>`_.
98+
<https://drafts.csswg.org/css-syntax-3/#input-byte-stream>`_.
9999
The input is represented as a JSON object containing:
100100

101101
* A required ``css_bytes``, the input byte string,
@@ -132,16 +132,23 @@ associated with the expected result.
132132
This file is generated by the ``make_color3_keywords.py`` Python script.
133133

134134
``An+B.json``
135-
Tests the `An+B <http://dev.w3.org/csswg/css-syntax/#the-anb-type>`_
135+
Tests the `An+B <https://drafts.csswg.org/css-syntax-3/#the-anb-type>`_
136136
syntax defined in CSS Syntax Level 3.
137-
This `differs <http://dev.w3.org/csswg/css-syntax/#changes>`_ from the
137+
This `differs <https://drafts.csswg.org/css-syntax/#changes>`_ from the
138138
`nth grammar rule <http://www.w3.org/TR/css3-selectors/#nth-child-pseudo>`_
139139
in Selectors Level 3 only in that
140-
``-`` charecters and digits can be escaped in some cases.
140+
``-`` characters and digits can be escaped in some cases.
141141
The Unicode input is represented by a JSON string,
142142
the output as null for invalid syntax,
143143
or an array of two integers ``[A, B]``.
144144

145+
``urange.json``
146+
Tests the `urange <https://drafts.csswg.org/css-syntax-3/#urange>`_
147+
syntax defined in CSS Syntax Level 3.
148+
The Unicode input is represented by a JSON string,
149+
the output as null for invalid syntax,
150+
or an array of two integers ``[start, end]``.
151+
145152

146153
Result representation
147154
=====================
@@ -228,10 +235,6 @@ Component values
228235
the value as a number, the type as the string ``"integer"`` or ``"number"``,
229236
and the unit as a string.
230237

231-
<unicode-range>
232-
Array of length 3: the string ``"unicode-range"``,
233-
followed by the *start* and *end* integers as two numbers.
234-
235238
<include-match>
236239
The string ``"~="``.
237240

src/css-parsing-tests/component_value_list.json

-74
Original file line numberDiff line numberDiff line change
@@ -325,80 +325,6 @@
325325
["dimension", "12", 12, "integer", "rêd"]
326326
],
327327

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+20-3F U+100000-2 U+1000000-2 U+10-200000", [
384-
["unicode-range", 32, 63], " ",
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 U+1- 2", [
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-
["unicode-range", 1, 1], "-", " ", ["number", "2", 2, "integer"]
400-
],
401-
402328
"~=|=^=$=*=||<!------> |/**/| ~/**/=", [
403329
"~=", "|=", "^=", "$=", "*=", "||", "<!--", ["ident", "----"], ">",
404330
" ", "|", "|", " ", "~", "="

src/css-parsing-tests/urange.json

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
[
2+
3+
"u+1, U+10, U+100, U+1000, U+10000, U+100000, U+1000000", [
4+
[1, 1],
5+
[16, 16],
6+
[256, 256],
7+
[4096, 4096],
8+
[65536, 65536],
9+
[1048576, 1048576],
10+
null
11+
],
12+
13+
"u+?, u+1?, U+10?, U+100?, U+1000?, U+10000?, U+100000?", [
14+
[0, 15],
15+
[16, 31],
16+
[256, 271],
17+
[4096, 4111],
18+
[65536, 65551],
19+
[1048576, 1048591],
20+
null
21+
],
22+
23+
"u+??, U+1??, U+10??, U+100??, U+1000??, U+10000??", [
24+
[0, 255],
25+
[256, 511],
26+
[4096, 4351],
27+
[65536, 65791],
28+
[1048576, 1048831],
29+
null
30+
],
31+
32+
"u+???, U+1???, U+10???, U+100???, U+1000???", [
33+
[0, 4095],
34+
[4096, 8191],
35+
[65536, 69631],
36+
[1048576, 1052671],
37+
null
38+
],
39+
40+
"u+????, U+1????, U+10????, U+100????", [
41+
[0, 65535],
42+
[65536, 131071],
43+
[1048576, 1114111],
44+
null
45+
],
46+
47+
"u+?????, U+1?????, U+10?????", [
48+
[0, 1048575],
49+
null,
50+
null
51+
],
52+
53+
"u+??????, U+1??????", [
54+
null,
55+
null
56+
],
57+
58+
59+
"u+20-3F, u+3F-3F, u+3F-3E, U+0-110000, U+0-10FFFF, U+100000-2, U+1000000-2, U+10-200000", [
60+
[32, 63],
61+
[63, 63],
62+
null,
63+
null,
64+
[0, 1114111],
65+
null,
66+
null,
67+
null
68+
],
69+
70+
"ù+12, Ü+12, u +12, U+ 12, U+12 - 20, U+1?2, U+1?-50, U+1- 2", [
71+
null,
72+
null,
73+
null,
74+
null,
75+
null,
76+
null,
77+
null,
78+
null
79+
]
80+
81+
]

0 commit comments

Comments
 (0)