crass 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +8 -5
- data/HISTORY.md +8 -0
- data/crass.gemspec +1 -2
- data/lib/crass/version.rb +1 -1
- metadata +4 -65
- data/test/css-parsing-tests/An+B.json +0 -156
- data/test/css-parsing-tests/LICENSE +0 -8
- data/test/css-parsing-tests/README.rst +0 -301
- data/test/css-parsing-tests/color3.json +0 -142
- data/test/css-parsing-tests/color3_hsl.json +0 -3890
- data/test/css-parsing-tests/color3_keywords.json +0 -803
- data/test/css-parsing-tests/component_value_list.json +0 -432
- data/test/css-parsing-tests/declaration_list.json +0 -44
- data/test/css-parsing-tests/make_color3_hsl.py +0 -17
- data/test/css-parsing-tests/make_color3_keywords.py +0 -191
- data/test/css-parsing-tests/one_component_value.json +0 -27
- data/test/css-parsing-tests/one_declaration.json +0 -46
- data/test/css-parsing-tests/one_rule.json +0 -36
- data/test/css-parsing-tests/rule_list.json +0 -48
- data/test/css-parsing-tests/stylesheet.json +0 -44
- data/test/css-parsing-tests/stylesheet_bytes.json +0 -146
- data/test/shared/parse_rules.rb +0 -463
- data/test/support/common.rb +0 -170
- data/test/support/serialization/animate.css +0 -3158
- data/test/support/serialization/bootstrap-theme.css +0 -384
- data/test/support/serialization/bootstrap.css +0 -6805
- data/test/support/serialization/html5-boilerplate.css +0 -268
- data/test/support/serialization/misc.css +0 -9
- data/test/support/serialization/pure.css +0 -1662
- data/test/test_crass.rb +0 -31
- data/test/test_css_parsing_tests.rb +0 -150
- data/test/test_parse_properties.rb +0 -310
- data/test/test_parse_rules.rb +0 -17
- data/test/test_parse_stylesheet.rb +0 -17
- data/test/test_serialization.rb +0 -71
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 335330d4d7d855e20733747cc6f01cf3513c176c37dd107c473f525b94c2bbfc
|
4
|
+
data.tar.gz: aec721d58cd3f1017fc957f7ae9d8b47f0e811db22649535ab64da580a6db70f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df7fc13c7c363a4aaf44986f62eabbce1fe9da744797bdcdf3148628d1c8447e69c24b6df2b33325bebe88951e195ccb43c9a5e50b2e1e920fab782aa5f532dc
|
7
|
+
data.tar.gz: 38cfc577fcd184f175ba37b54f7e8638086a4c9817eb54c24b1c53a62f0437d4e97f9b87b8e81422511bf20c5eb2452f85838c6f822b89634fa944211eab3071
|
data/.travis.yml
CHANGED
data/HISTORY.md
CHANGED
data/crass.gemspec
CHANGED
@@ -16,8 +16,7 @@ Gem::Specification.new do |s|
|
|
16
16
|
|
17
17
|
s.require_paths = ['lib']
|
18
18
|
|
19
|
-
s.files
|
20
|
-
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
19
|
+
s.files = `git ls-files -z`.split("\x0").grep_v(%r{^test/})
|
21
20
|
|
22
21
|
# Development dependencies.
|
23
22
|
s.add_development_dependency 'minitest', '~> 5.0.8'
|
data/lib/crass/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: crass
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Grove
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-10-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -60,36 +60,6 @@ files:
|
|
60
60
|
- lib/crass/token-scanner.rb
|
61
61
|
- lib/crass/tokenizer.rb
|
62
62
|
- lib/crass/version.rb
|
63
|
-
- test/css-parsing-tests/An+B.json
|
64
|
-
- test/css-parsing-tests/LICENSE
|
65
|
-
- test/css-parsing-tests/README.rst
|
66
|
-
- test/css-parsing-tests/color3.json
|
67
|
-
- test/css-parsing-tests/color3_hsl.json
|
68
|
-
- test/css-parsing-tests/color3_keywords.json
|
69
|
-
- test/css-parsing-tests/component_value_list.json
|
70
|
-
- test/css-parsing-tests/declaration_list.json
|
71
|
-
- test/css-parsing-tests/make_color3_hsl.py
|
72
|
-
- test/css-parsing-tests/make_color3_keywords.py
|
73
|
-
- test/css-parsing-tests/one_component_value.json
|
74
|
-
- test/css-parsing-tests/one_declaration.json
|
75
|
-
- test/css-parsing-tests/one_rule.json
|
76
|
-
- test/css-parsing-tests/rule_list.json
|
77
|
-
- test/css-parsing-tests/stylesheet.json
|
78
|
-
- test/css-parsing-tests/stylesheet_bytes.json
|
79
|
-
- test/shared/parse_rules.rb
|
80
|
-
- test/support/common.rb
|
81
|
-
- test/support/serialization/animate.css
|
82
|
-
- test/support/serialization/bootstrap-theme.css
|
83
|
-
- test/support/serialization/bootstrap.css
|
84
|
-
- test/support/serialization/html5-boilerplate.css
|
85
|
-
- test/support/serialization/misc.css
|
86
|
-
- test/support/serialization/pure.css
|
87
|
-
- test/test_crass.rb
|
88
|
-
- test/test_css_parsing_tests.rb
|
89
|
-
- test/test_parse_properties.rb
|
90
|
-
- test/test_parse_rules.rb
|
91
|
-
- test/test_parse_stylesheet.rb
|
92
|
-
- test/test_serialization.rb
|
93
63
|
homepage: https://github.com/rgrove/crass/
|
94
64
|
licenses:
|
95
65
|
- MIT
|
@@ -109,39 +79,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
109
79
|
- !ruby/object:Gem::Version
|
110
80
|
version: '0'
|
111
81
|
requirements: []
|
112
|
-
|
113
|
-
rubygems_version: 2.7.3
|
82
|
+
rubygems_version: 3.0.3
|
114
83
|
signing_key:
|
115
84
|
specification_version: 4
|
116
85
|
summary: CSS parser based on the CSS Syntax Level 3 spec.
|
117
|
-
test_files:
|
118
|
-
- test/css-parsing-tests/An+B.json
|
119
|
-
- test/css-parsing-tests/LICENSE
|
120
|
-
- test/css-parsing-tests/README.rst
|
121
|
-
- test/css-parsing-tests/color3.json
|
122
|
-
- test/css-parsing-tests/color3_hsl.json
|
123
|
-
- test/css-parsing-tests/color3_keywords.json
|
124
|
-
- test/css-parsing-tests/component_value_list.json
|
125
|
-
- test/css-parsing-tests/declaration_list.json
|
126
|
-
- test/css-parsing-tests/make_color3_hsl.py
|
127
|
-
- test/css-parsing-tests/make_color3_keywords.py
|
128
|
-
- test/css-parsing-tests/one_component_value.json
|
129
|
-
- test/css-parsing-tests/one_declaration.json
|
130
|
-
- test/css-parsing-tests/one_rule.json
|
131
|
-
- test/css-parsing-tests/rule_list.json
|
132
|
-
- test/css-parsing-tests/stylesheet.json
|
133
|
-
- test/css-parsing-tests/stylesheet_bytes.json
|
134
|
-
- test/shared/parse_rules.rb
|
135
|
-
- test/support/common.rb
|
136
|
-
- test/support/serialization/animate.css
|
137
|
-
- test/support/serialization/bootstrap-theme.css
|
138
|
-
- test/support/serialization/bootstrap.css
|
139
|
-
- test/support/serialization/html5-boilerplate.css
|
140
|
-
- test/support/serialization/misc.css
|
141
|
-
- test/support/serialization/pure.css
|
142
|
-
- test/test_crass.rb
|
143
|
-
- test/test_css_parsing_tests.rb
|
144
|
-
- test/test_parse_properties.rb
|
145
|
-
- test/test_parse_rules.rb
|
146
|
-
- test/test_parse_stylesheet.rb
|
147
|
-
- test/test_serialization.rb
|
86
|
+
test_files: []
|
@@ -1,156 +0,0 @@
|
|
1
|
-
[
|
2
|
-
|
3
|
-
"", null,
|
4
|
-
" \n", null,
|
5
|
-
|
6
|
-
"odd", [2, 1],
|
7
|
-
"even", [2, 0],
|
8
|
-
"ödd", null,
|
9
|
-
"éven", null,
|
10
|
-
" /**/\t OdD /**/\n", [2, 1],
|
11
|
-
" /**/\t EveN /**/\n", [2, 0],
|
12
|
-
|
13
|
-
|
14
|
-
"3", [0, 3],
|
15
|
-
"+2 ", [0, 2],
|
16
|
-
" -14 ", [0, -14],
|
17
|
-
"+ 2 ", null,
|
18
|
-
"- 14 ", null,
|
19
|
-
"3.1", null,
|
20
|
-
|
21
|
-
"3N", [3, 0],
|
22
|
-
"+2N ", [2, 0],
|
23
|
-
" -14n ", [-14, 0],
|
24
|
-
"+ 2N ", null,
|
25
|
-
"- 14N ", null,
|
26
|
-
"3.1N", null,
|
27
|
-
"3 n", null,
|
28
|
-
|
29
|
-
" N", [1, 0],
|
30
|
-
" +n", [1, 0],
|
31
|
-
" -n", [-1, 0],
|
32
|
-
"+ n", null,
|
33
|
-
"- n", null,
|
34
|
-
|
35
|
-
|
36
|
-
"3N+1", [3, 1],
|
37
|
-
"+2n+1 ", [2, 1],
|
38
|
-
" -14n+1 ", [-14, 1],
|
39
|
-
"+ 2N+1 ", null,
|
40
|
-
"- 14n+1 ", null,
|
41
|
-
"3.1n+1", null,
|
42
|
-
"3 n+1", null,
|
43
|
-
|
44
|
-
" n+1", [1, 1],
|
45
|
-
" +N+1", [1, 1],
|
46
|
-
" -n+1", [-1, 1],
|
47
|
-
"+ N+1", null,
|
48
|
-
"- N+1", null,
|
49
|
-
|
50
|
-
"3n-1", [3, -1],
|
51
|
-
"+2N-1 ", [2, -1],
|
52
|
-
" -14n-1 ", [-14, -1],
|
53
|
-
"+ 2N-1 ", null,
|
54
|
-
"- 14N-1 ", null,
|
55
|
-
"3.1n-1", null,
|
56
|
-
"3 n-1", null,
|
57
|
-
"3n-1foo", null,
|
58
|
-
|
59
|
-
" n-1", [1, -1],
|
60
|
-
" +n-1", [1, -1],
|
61
|
-
" -n-1", [-1, -1],
|
62
|
-
"+ n-1", null,
|
63
|
-
"- n-1", null,
|
64
|
-
" +n-1foo", null,
|
65
|
-
" -n-1foo", null,
|
66
|
-
|
67
|
-
|
68
|
-
"3N +1", [3, 1],
|
69
|
-
"+2N +1 ", [2, 1],
|
70
|
-
" -14n +1 ", [-14, 1],
|
71
|
-
"+ 2N +1 ", null,
|
72
|
-
"- 14n +1 ", null,
|
73
|
-
"3.1N +1", null,
|
74
|
-
"3 n +1", null,
|
75
|
-
"3n foo", null,
|
76
|
-
"3n + foo", null,
|
77
|
-
|
78
|
-
" n +1", [1, 1],
|
79
|
-
" +N +1", [1, 1],
|
80
|
-
" -n +1", [-1, 1],
|
81
|
-
"+ n +1", null,
|
82
|
-
"- N +1", null,
|
83
|
-
|
84
|
-
"3N -1", [3, -1],
|
85
|
-
"+2n -1 ", [2, -1],
|
86
|
-
" -14n -1 ", [-14, -1],
|
87
|
-
"+ 2n -1 ", null,
|
88
|
-
"- 14N -1 ", null,
|
89
|
-
"3.1N -1", null,
|
90
|
-
"3 N -1", null,
|
91
|
-
|
92
|
-
" N -1", [1, -1],
|
93
|
-
" +N -1", [1, -1],
|
94
|
-
" -n -1", [-1, -1],
|
95
|
-
"+ n -1", null,
|
96
|
-
"- n -1", null,
|
97
|
-
|
98
|
-
|
99
|
-
"3n+ 1", [3, 1],
|
100
|
-
"+2n+ 1 ", [2, 1],
|
101
|
-
" -14n+ 1 ", [-14, 1],
|
102
|
-
"+ 2n+ 1 ", null,
|
103
|
-
"- 14N+ 1 ", null,
|
104
|
-
"3.1n+ 1", null,
|
105
|
-
"3 N+ 1", null,
|
106
|
-
|
107
|
-
" N+ 1", [1, 1],
|
108
|
-
" +N+ 1", [1, 1],
|
109
|
-
" -N+ 1", [-1, 1],
|
110
|
-
"+ n+ 1", null,
|
111
|
-
"- N+ 1", null,
|
112
|
-
|
113
|
-
"3n- 1", [3, -1],
|
114
|
-
"+2N- 1 ", [2, -1],
|
115
|
-
" -14N- 1 ", [-14, -1],
|
116
|
-
"+ 2N- 1 ", null,
|
117
|
-
"- 14n- 1 ", null,
|
118
|
-
"3.1n- 1", null,
|
119
|
-
"3 n- 1", null,
|
120
|
-
|
121
|
-
" N- 1", [1, -1],
|
122
|
-
" +N- 1", [1, -1],
|
123
|
-
" -n- 1", [-1, -1],
|
124
|
-
"+ n- 1", null,
|
125
|
-
"- N- 1", null,
|
126
|
-
|
127
|
-
|
128
|
-
"3N + 1", [3, 1],
|
129
|
-
"+2N + 1 ", [2, 1],
|
130
|
-
" -14n + 1 ", [-14, 1],
|
131
|
-
"+ 2n + 1 ", null,
|
132
|
-
"- 14N + 1 ", null,
|
133
|
-
"3.1n + 1", null,
|
134
|
-
"3 N + 1", null,
|
135
|
-
|
136
|
-
" n + 1", [1, 1],
|
137
|
-
" +n + 1", [1, 1],
|
138
|
-
" -N + 1", [-1, 1],
|
139
|
-
"+ N + 1", null,
|
140
|
-
"- N + 1", null,
|
141
|
-
|
142
|
-
"3N - 1", [3, -1],
|
143
|
-
"+2n - 1 ", [2, -1],
|
144
|
-
" -14n - 1 ", [-14, -1],
|
145
|
-
"+ 2N - 1 ", null,
|
146
|
-
"- 14N - 1 ", null,
|
147
|
-
"3.1N - 1", null,
|
148
|
-
"3 n - 1", null,
|
149
|
-
|
150
|
-
" N - 1", [1, -1],
|
151
|
-
" +n - 1", [1, -1],
|
152
|
-
" -n - 1", [-1, -1],
|
153
|
-
"+ N - 1", null,
|
154
|
-
"- N - 1", null
|
155
|
-
|
156
|
-
]
|
@@ -1,8 +0,0 @@
|
|
1
|
-
Written in 2013 by Simon Sapin.
|
2
|
-
|
3
|
-
To the extent possible under law, the author(s) have dedicated all copyright
|
4
|
-
and related and neighboring rights to this work to the public domain worldwide.
|
5
|
-
This work is distributed without any warranty.
|
6
|
-
|
7
|
-
See the CC0 Public Domain Dedication:
|
8
|
-
http://creativecommons.org/publicdomain/zero/1.0/
|
@@ -1,301 +0,0 @@
|
|
1
|
-
CSS parsing tests
|
2
|
-
#################
|
3
|
-
|
4
|
-
This repository contains implementation-independent test for CSS parsers,
|
5
|
-
based on the 2013 draft of the `CSS Syntax Level 3`_ specification.
|
6
|
-
|
7
|
-
.. _CSS Syntax Level 3: http://dev.w3.org/csswg/css-syntax-3/
|
8
|
-
|
9
|
-
The upstream repository for these tests is at
|
10
|
-
https://github.com/SimonSapin/css-parsing-tests
|
11
|
-
|
12
|
-
|
13
|
-
Projects using this
|
14
|
-
===================
|
15
|
-
|
16
|
-
CSS parsers using these tests:
|
17
|
-
|
18
|
-
* `tinycss2 <https://github.com/SimonSapin/tinycss2>`_ (Python)
|
19
|
-
* `rust-cssparser <https://github.com/mozilla-servo/rust-cssparser>`_
|
20
|
-
(Rust, used in `Servo <https://github.com/mozilla/servo/>`_)
|
21
|
-
* `Crass <https://github.com/rgrove/crass/>`_ (Ruby)
|
22
|
-
|
23
|
-
|
24
|
-
Importing
|
25
|
-
=========
|
26
|
-
|
27
|
-
The recommended way to use these tests in an implementation
|
28
|
-
is to import them with git-subtree_.
|
29
|
-
|
30
|
-
.. _git-subtree: https://github.com/git/git/tree/master/contrib/subtree
|
31
|
-
|
32
|
-
To import the first time to a ``./css-parsing-tests`` sub-directory,
|
33
|
-
run this from the top-level of a git repository::
|
34
|
-
|
35
|
-
git subtree add -P css-parsing-tests https://github.com/SimonSapin/css-parsing-tests.git master
|
36
|
-
|
37
|
-
Later, to merge changes made in the upstream repository, run::
|
38
|
-
|
39
|
-
git subtree pull -P css-parsing-tests https://github.com/SimonSapin/css-parsing-tests.git master
|
40
|
-
|
41
|
-
|
42
|
-
Test files
|
43
|
-
==========
|
44
|
-
|
45
|
-
CSS Syntax specification describes a number of "functions".
|
46
|
-
Each ``.json`` file in this repository corresponds to such a function.
|
47
|
-
The files are encoded as UTF-8
|
48
|
-
and each contain a JSON array with an even number of items,
|
49
|
-
where each pair of items is one function input
|
50
|
-
associated with the expected result.
|
51
|
-
|
52
|
-
``component_value_list.json``
|
53
|
-
Tests `Parse a list of component values
|
54
|
-
<http://dev.w3.org/csswg/css-syntax-3/#parse-a-list-of-component-values>`_.
|
55
|
-
The Unicode input is represented by a JSON string,
|
56
|
-
the output as an array of `component values`_ as described below.
|
57
|
-
|
58
|
-
``component_value_list.json``
|
59
|
-
Tests `Parse a component value
|
60
|
-
<http://dev.w3.org/csswg/css-syntax-3/#parse-a-component-value>`_.
|
61
|
-
The Unicode input is represented by a JSON string,
|
62
|
-
the output as a `component value`_.
|
63
|
-
|
64
|
-
``declaration_list.json``
|
65
|
-
Tests `Parse a list of declarations
|
66
|
-
<http://dev.w3.org/csswg/css-syntax-3/#parse-a-list-of-declarations>`_.
|
67
|
-
The Unicode input is represented by a JSON string,
|
68
|
-
the output as an array of declarations_ and at-rules_.
|
69
|
-
|
70
|
-
``one_declaration.json``
|
71
|
-
Tests `Parse a declaration
|
72
|
-
<http://dev.w3.org/csswg/css-syntax-3/#parse-a-declaration>`_.
|
73
|
-
The Unicode input is represented by a JSON string,
|
74
|
-
the output as a declaration_.
|
75
|
-
|
76
|
-
``one_rule.json``
|
77
|
-
Tests `Parse a rule
|
78
|
-
<http://dev.w3.org/csswg/css-syntax-3/#parse-a-rule>`_.
|
79
|
-
The Unicode input is represented by a JSON string,
|
80
|
-
the output as a `qualified rule`_ or at-rule_.
|
81
|
-
|
82
|
-
``rule_list.json``
|
83
|
-
Tests `Parse a list of rules
|
84
|
-
<http://dev.w3.org/csswg/css-syntax-3/#parse-a-list-of-rules>`_.
|
85
|
-
The Unicode input is represented by a JSON string,
|
86
|
-
the output as a list of `qualified rules`_ or at-rules_.
|
87
|
-
|
88
|
-
``stylesheet.json``
|
89
|
-
Tests `Parse a stylesheet
|
90
|
-
<http://dev.w3.org/csswg/css-syntax-3/#parse-a-stylesheet>`_.
|
91
|
-
The Unicode input is represented by a JSON string,
|
92
|
-
the output as a list of `qualified rules`_ or at-rules_.
|
93
|
-
|
94
|
-
``stylesheet_bytes.json``
|
95
|
-
Tests `Parse a stylesheet
|
96
|
-
<http://dev.w3.org/csswg/css-syntax-3/#parse-a-stylesheet>`_
|
97
|
-
together with `The input byte stream
|
98
|
-
<http://dev.w3.org/csswg/css-syntax/#input-byte-stream>`_.
|
99
|
-
The input is represented as a JSON object containing:
|
100
|
-
|
101
|
-
* A required ``css_bytes``, the input byte string,
|
102
|
-
represented as a JSON string where code points U+0000 to U+00FF
|
103
|
-
represent bytes of the same value.
|
104
|
-
* An optional ``protocol_encoding``,
|
105
|
-
a protocol encoding label as a JSON string, or null.
|
106
|
-
* An optional ``environment_encoding``,
|
107
|
-
an environment encoding label as a JSON string, or null.
|
108
|
-
* An optional ``comment`` that is ignored.
|
109
|
-
|
110
|
-
The output is represented a list of `qualified rules`_ or at-rules_.
|
111
|
-
|
112
|
-
``color3.json``
|
113
|
-
Tests the ``<color>`` syntax `defined in CSS Color Level 3
|
114
|
-
<http://www.w3.org/TR/css3-color/#colorunits>`_.
|
115
|
-
The Unicode input is represented by a JSON string,
|
116
|
-
the output as one of:
|
117
|
-
|
118
|
-
* null if the input is not a valid color in CSS syntax
|
119
|
-
* The string "currentColor" for the currentColor keyword
|
120
|
-
* An array of length 4 for every other values:
|
121
|
-
four (floating point) numbers for the Red, Green, Blue and Alpha channel.
|
122
|
-
Each value is between 0 and 1.
|
123
|
-
|
124
|
-
``color3_hsl.json``
|
125
|
-
Same as ``color3.json``.
|
126
|
-
This file is generated by the ``make_color3_hsl.py`` Python script.
|
127
|
-
|
128
|
-
``color3_keywords.json``
|
129
|
-
Same as ``color3.json``,
|
130
|
-
except that the values for the Red, Green and Blue channel
|
131
|
-
are between 0 and 255.
|
132
|
-
This file is generated by the ``make_color3_keywords.py`` Python script.
|
133
|
-
|
134
|
-
``An+B.json``
|
135
|
-
Tests the `An+B <http://dev.w3.org/csswg/css-syntax/#the-anb-type>`_
|
136
|
-
syntax defined in CSS Syntax Level 3.
|
137
|
-
This `differs <http://dev.w3.org/csswg/css-syntax/#changes>`_ from the
|
138
|
-
`nth grammar rule <http://www.w3.org/TR/css3-selectors/#nth-child-pseudo>`_
|
139
|
-
in Selectors Level 3 only in that
|
140
|
-
``-`` charecters and digits can be escaped in some cases.
|
141
|
-
The Unicode input is represented by a JSON string,
|
142
|
-
the output as null for invalid syntax,
|
143
|
-
or an array of two integers ``[A, B]``.
|
144
|
-
|
145
|
-
|
146
|
-
Result representation
|
147
|
-
=====================
|
148
|
-
|
149
|
-
AST nodes (the results of parsing) are represented in JSON as follow.
|
150
|
-
This representation was chosen to be compact
|
151
|
-
(and thus less annoying to write by hand)
|
152
|
-
while staying unambiguous.
|
153
|
-
For example, the difference between ``@import`` and ``\@import`` is not lost:
|
154
|
-
they are represented as ``["at-keyword", "import"]`` and ``["ident", "@import"]``,
|
155
|
-
respectively.
|
156
|
-
|
157
|
-
|
158
|
-
Rules and declarations
|
159
|
-
----------------------
|
160
|
-
|
161
|
-
.. _at-rule:
|
162
|
-
.. _at-rules:
|
163
|
-
.. _qualified rule:
|
164
|
-
.. _qualified rules:
|
165
|
-
.. _declaration:
|
166
|
-
.. _declarations:
|
167
|
-
|
168
|
-
|
169
|
-
At-rule
|
170
|
-
An array of length 4: the string ``"at-rule"``,
|
171
|
-
the name (value of the at-keyword) as a string,
|
172
|
-
the prelude as a nested array of `component values`_,
|
173
|
-
and the optional block as a nested array of component value, or null.
|
174
|
-
|
175
|
-
Qualified rule
|
176
|
-
An array of length 3: the string ``"qualified rule"``,
|
177
|
-
the prelude as a nested array of `component values`_,
|
178
|
-
and the block as a nested array of component value.
|
179
|
-
|
180
|
-
|
181
|
-
Declaration
|
182
|
-
An array of length 4: the string ``"declaration"``, the name as a string,
|
183
|
-
the value as a nested array of `component values`_,
|
184
|
-
and a the important flag as a boolean.
|
185
|
-
|
186
|
-
|
187
|
-
.. _component value:
|
188
|
-
.. _component values:
|
189
|
-
|
190
|
-
Component values
|
191
|
-
----------------
|
192
|
-
|
193
|
-
<ident>
|
194
|
-
Array of length 2: the string ``"ident"``, and the value as a string.
|
195
|
-
|
196
|
-
<at-keyword>
|
197
|
-
Array of length 2: the string ``"at-keyword"``, and the value as a string.
|
198
|
-
|
199
|
-
<hash>
|
200
|
-
Array of length 3: the string ``"hash"``, the value as a string,
|
201
|
-
and the type as the string ``"id"`` or ``"unrestricted"``.
|
202
|
-
|
203
|
-
<string>
|
204
|
-
Array of length 2: the string ``"string"``, and the value as a string.
|
205
|
-
|
206
|
-
<bad-string>
|
207
|
-
Array of length 1: the string ``"bad-string"``.
|
208
|
-
|
209
|
-
<url>
|
210
|
-
Array of length 2: the string ``"url"``, and the value as a string.
|
211
|
-
|
212
|
-
<bad-url>
|
213
|
-
Array of length 1: the string ``"bad-url"``.
|
214
|
-
|
215
|
-
<delim>
|
216
|
-
The value as a one-character string.
|
217
|
-
|
218
|
-
<number>
|
219
|
-
Array of length 4: the string ``"number"``, the representation as a string,
|
220
|
-
the value as a number, and the type as the string ``"integer"`` or ``"number"``.
|
221
|
-
|
222
|
-
<percentage>
|
223
|
-
Array of length 4: the string ``"percentage"``, the representation as a string,
|
224
|
-
the value as a number, and the type as the string ``"integer"`` or ``"number"``.
|
225
|
-
|
226
|
-
<dimension>
|
227
|
-
Array of length 4: the string ``"dimension"``, the representation as a string,
|
228
|
-
the value as a number, the type as the string ``"integer"`` or ``"number"``,
|
229
|
-
and the unit as a string.
|
230
|
-
|
231
|
-
<unicode-range>
|
232
|
-
Array of length 3: the string ``"unicode-range"``,
|
233
|
-
followed by the *start* and *end* integers as two numbers.
|
234
|
-
|
235
|
-
<include-match>
|
236
|
-
The string ``"~="``.
|
237
|
-
|
238
|
-
<dash-match>
|
239
|
-
The string ``"|="``.
|
240
|
-
|
241
|
-
<prefix-match>
|
242
|
-
The string ``"^="``.
|
243
|
-
|
244
|
-
<suffix-match>
|
245
|
-
The string ``"$="``.
|
246
|
-
|
247
|
-
<substring-match>
|
248
|
-
The string ``"*="``.
|
249
|
-
|
250
|
-
<column>
|
251
|
-
The string ``"||"``.
|
252
|
-
|
253
|
-
<whitespace>
|
254
|
-
The string ``" "`` (a single space.)
|
255
|
-
|
256
|
-
<CDO>
|
257
|
-
The string ``"<!--"``.
|
258
|
-
|
259
|
-
<CDC>
|
260
|
-
The string ``"-->"``.
|
261
|
-
|
262
|
-
<colon>
|
263
|
-
The string ``":"``.
|
264
|
-
|
265
|
-
<semicolon>
|
266
|
-
The string ``";"``.
|
267
|
-
|
268
|
-
<comma>
|
269
|
-
The string ``","``.
|
270
|
-
|
271
|
-
{} block
|
272
|
-
An array of length N+1: the string ``"{}"``
|
273
|
-
followed by the N `component values`_ of the block’s content.
|
274
|
-
|
275
|
-
[] block
|
276
|
-
An array of length N+1: the string ``"[]"``
|
277
|
-
followed by the N `component values`_ of the block’s content.
|
278
|
-
|
279
|
-
() block
|
280
|
-
An array of length N+1: the string ``"()"``
|
281
|
-
followed by the N `component values`_ of the block’s content.
|
282
|
-
|
283
|
-
Function
|
284
|
-
An array of length N+2: the string ``"function"``
|
285
|
-
and the name of the function as a string
|
286
|
-
followed by the N `component values`_ of the function’s arguments.
|
287
|
-
|
288
|
-
<bad-string>
|
289
|
-
The array of two strings ``["error", "bad-string"]``.
|
290
|
-
|
291
|
-
<bad-url>
|
292
|
-
The array of two strings ``["error", "bad-url"]``.
|
293
|
-
|
294
|
-
Unmatched <}>
|
295
|
-
The array of two strings ``["error", "}"]``.
|
296
|
-
|
297
|
-
Unmatched <]>
|
298
|
-
The array of two strings ``["error", "]"]``.
|
299
|
-
|
300
|
-
Unmatched <)>
|
301
|
-
The array of two strings ``["error", ")"]``.
|