feat(css): Support urange syntax (#3491)

This commit is contained in:
Alexander Akait 2022-02-09 15:23:14 +03:00 committed by GitHub
parent 6c5ebbbbf8
commit cbe302b99d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 1528 additions and 6 deletions

View File

@ -42,11 +42,14 @@ pub enum Value {
#[tag("Delimiter")]
Delimiter(Delimiter),
#[tag("Tokens")]
Tokens(Tokens),
#[tag("Url")]
Url(Url),
#[tag("Urange")]
Urange(Urange),
#[tag("Tokens")]
Tokens(Tokens),
}
#[ast_node("Ident")]
@ -265,3 +268,9 @@ pub enum UrlModifier {
#[tag("Function")]
Function(Function),
}
#[ast_node("Urange")]
pub struct Urange {
pub span: Span,
pub value: JsWord,
}

View File

@ -829,6 +829,7 @@ where
Value::Tokens(n) => emit!(self, n),
Value::Url(n) => emit!(self, n),
Value::Delimiter(n) => emit!(self, n),
Value::Urange(n) => emit!(self, n),
}
}
@ -1344,6 +1345,11 @@ where
}
}
#[emitter]
fn emit_urange(&mut self, n: &Urange) -> Result {
self.wr.write_raw(Some(n.span), &n.value)?;
}
#[emitter]
fn emit_selector_list(&mut self, n: &SelectorList) -> Result {
self.emit_list(&n.children, ListFormat::CommaDelimited)?;

View File

@ -71,6 +71,10 @@ macro_rules! tok {
swc_css_ast::Token::Delim { value: '!', .. }
};
("?") => {
swc_css_ast::Token::Delim { value: '?', .. }
};
("{") => {
swc_css_ast::Token::LBrace
};

View File

@ -142,6 +142,14 @@ macro_rules! is {
}};
}
macro_rules! is_one_of {
($parser:expr, $($tt:tt),+) => {
$(
is!($parser, $tt)
)||*
};
}
macro_rules! peeked_is {
($parser:expr, $tt:tt) => {{
match $parser.input.peek()? {
@ -151,10 +159,10 @@ macro_rules! peeked_is {
}};
}
macro_rules! is_one_of {
macro_rules! peeked_is_one_of {
($parser:expr, $($tt:tt),+) => {
$(
is!($parser, $tt)
peeked_is!($parser, $tt)
)||*
};
}

View File

@ -278,7 +278,11 @@ where
Token::Ident { value, .. } => {
if value.starts_with("--") {
return Ok(Value::DashedIdent(self.parse()?));
};
} else if &*value.to_ascii_lowercase() == "u"
&& peeked_is_one_of!(self, "+", Num, Dimension)
{
return Ok(Value::Urange(self.parse()?));
}
return Ok(Value::Ident(self.parse()?));
}
@ -1327,6 +1331,214 @@ where
}
}
// <urange> =
// u '+' <ident-token> '?'* |
// u <dimension-token> '?'* |
// u <number-token> '?'* |
// u <number-token> <dimension-token> |
// u <number-token> <number-token> |
// u '+' '?'+
impl<I> Parse<Urange> for Parser<I>
where
I: ParserInput,
{
fn parse(&mut self) -> PResult<Urange> {
let span = self.input.cur_span()?;
let mut urange = String::new();
// should start with `u` or `U`
match cur!(self) {
Token::Ident { value, .. } if &*value.to_ascii_lowercase() == "u" => {
let ident = match bump!(self) {
Token::Ident { value, .. } => value,
_ => {
unreachable!();
}
};
urange.push_str(&ident);
}
_ => {
return Err(Error::new(span, ErrorKind::Expected("'u' ident token")));
}
};
match cur!(self) {
// u '+' <ident-token> '?'*
// u '+' '?'+
Token::Delim { value } if *value == '+' => {
let plus = match bump!(self) {
Token::Delim { value } => value,
_ => {
unreachable!();
}
};
urange.push(plus);
if is!(self, Ident) {
let ident = match bump!(self) {
Token::Ident { value, .. } => value,
_ => {
unreachable!();
}
};
urange.push_str(&ident);
loop {
if !is!(self, "?") {
break;
}
let question = match bump!(self) {
Token::Delim { value } => value,
_ => {
unreachable!();
}
};
urange.push(question);
}
} else {
let question = match bump!(self) {
Token::Delim { value } if value == '?' => value,
_ => {
return Err(Error::new(span, ErrorKind::Expected("'?' delim token")));
}
};
urange.push(question);
loop {
if !is!(self, "?") {
break;
}
let question = match bump!(self) {
Token::Delim { value } => value,
_ => {
unreachable!();
}
};
urange.push(question);
}
}
}
// u <number-token> '?'*
// u <number-token> <dimension-token>
// u <number-token> <number-token>
tok!("num") => {
let number = match bump!(self) {
Token::Num { raw, .. } => raw,
_ => {
unreachable!();
}
};
urange.push_str(&number);
match cur!(self) {
tok!("?") => {
let question = match bump!(self) {
Token::Delim { value } => value,
_ => {
unreachable!();
}
};
urange.push(question);
loop {
if !is!(self, "?") {
break;
}
let question = match bump!(self) {
Token::Delim { value } => value,
_ => {
unreachable!();
}
};
urange.push(question);
}
}
tok!("dimension") => {
let dimension = match bump!(self) {
Token::Dimension {
raw_value,
raw_unit,
..
} => (raw_value, raw_unit),
_ => {
unreachable!();
}
};
urange.push_str(&dimension.0);
urange.push_str(&dimension.1);
}
tok!("num") => {
let number = match bump!(self) {
Token::Num { raw, .. } => raw,
_ => {
unreachable!();
}
};
urange.push_str(&number);
}
_ => {}
}
}
// u <dimension-token> '?'*
tok!("dimension") => {
let dimension = match bump!(self) {
Token::Dimension {
raw_value,
raw_unit,
..
} => (raw_value, raw_unit),
_ => {
unreachable!();
}
};
urange.push_str(&dimension.0);
urange.push_str(&dimension.1);
loop {
if !is!(self, "?") {
break;
}
let question = match bump!(self) {
Token::Delim { value } => value,
_ => {
unreachable!();
}
};
urange.push(question);
}
}
_ => {
return Err(Error::new(
span,
ErrorKind::Expected("dimension, number or '?' delim token"),
));
}
}
return Ok(Urange {
span: span!(self, span.lo),
value: urange.into(),
});
}
}
fn is_length_unit(unit: &str) -> bool {
matches!(
&*unit.to_ascii_lowercase(),

View File

@ -388,6 +388,8 @@ impl Visit for SpanVisualizer<'_> {
mtd!(UrlModifier, visit_url_modifier);
mtd!(Urange, visit_urange);
mtd!(Value, visit_value);
mtd!(CharsetRule, visit_charset_rule);

View File

@ -0,0 +1,18 @@
@font-face {
font-family: 'Ampersand';
src: local('Times New Roman');
unicode-range: U+26; /* single codepoint */
unicode-range: u+26;
unicode-range: U+0-7F;
unicode-range: U+0025-00FF; /* codepoint range */
unicode-range: U+4??; /* wildcard range */
unicode-range: U+0025-00FF, U+4??; /* multiple values */
unicode-range: U+A5, U+4E00-9FFF, U+30??, U+FF00-FF9F; /* multiple values */
unicode-range: U+????;
unicode-range: U+??????;
unicode-range: U+12;
unicode-range: U+12e112;
unicode-range: U+1e1ee1;
unicode-range: U+1e1ee?;
unicode-range: U+12-13;
}

View File

@ -0,0 +1,602 @@
{
"type": "Stylesheet",
"span": {
"start": 0,
"end": 653,
"ctxt": 0
},
"rules": [
{
"type": "FontFaceRule",
"span": {
"start": 0,
"end": 652,
"ctxt": 0
},
"block": {
"type": "Block",
"span": {
"start": 11,
"end": 652,
"ctxt": 0
},
"value": [
{
"type": "Declaration",
"span": {
"start": 17,
"end": 41,
"ctxt": 0
},
"name": {
"type": "Ident",
"span": {
"start": 17,
"end": 28,
"ctxt": 0
},
"value": "font-family",
"raw": "font-family"
},
"value": [
{
"type": "String",
"span": {
"start": 30,
"end": 41,
"ctxt": 0
},
"value": "Ampersand",
"raw": "'Ampersand'"
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 47,
"end": 76,
"ctxt": 0
},
"name": {
"type": "Ident",
"span": {
"start": 47,
"end": 50,
"ctxt": 0
},
"value": "src",
"raw": "src"
},
"value": [
{
"type": "Function",
"span": {
"start": 52,
"end": 76,
"ctxt": 0
},
"name": {
"type": "Ident",
"span": {
"start": 52,
"end": 57,
"ctxt": 0
},
"value": "local",
"raw": "local"
},
"value": [
{
"type": "String",
"span": {
"start": 58,
"end": 75,
"ctxt": 0
},
"value": "Times New Roman",
"raw": "'Times New Roman'"
}
]
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 82,
"end": 101,
"ctxt": 0
},
"name": {
"type": "Ident",
"span": {
"start": 82,
"end": 95,
"ctxt": 0
},
"value": "unicode-range",
"raw": "unicode-range"
},
"value": [
{
"type": "Urange",
"span": {
"start": 97,
"end": 101,
"ctxt": 0
},
"value": "U+26"
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 144,
"end": 163,
"ctxt": 0
},
"name": {
"type": "Ident",
"span": {
"start": 144,
"end": 157,
"ctxt": 0
},
"value": "unicode-range",
"raw": "unicode-range"
},
"value": [
{
"type": "Urange",
"span": {
"start": 159,
"end": 163,
"ctxt": 0
},
"value": "u+26"
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 169,
"end": 190,
"ctxt": 0
},
"name": {
"type": "Ident",
"span": {
"start": 169,
"end": 182,
"ctxt": 0
},
"value": "unicode-range",
"raw": "unicode-range"
},
"value": [
{
"type": "Urange",
"span": {
"start": 184,
"end": 190,
"ctxt": 0
},
"value": "U+0-7F"
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 196,
"end": 222,
"ctxt": 0
},
"name": {
"type": "Ident",
"span": {
"start": 196,
"end": 209,
"ctxt": 0
},
"value": "unicode-range",
"raw": "unicode-range"
},
"value": [
{
"type": "Urange",
"span": {
"start": 211,
"end": 222,
"ctxt": 0
},
"value": "U+0025-00FF"
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 257,
"end": 277,
"ctxt": 0
},
"name": {
"type": "Ident",
"span": {
"start": 257,
"end": 270,
"ctxt": 0
},
"value": "unicode-range",
"raw": "unicode-range"
},
"value": [
{
"type": "Urange",
"span": {
"start": 272,
"end": 277,
"ctxt": 0
},
"value": "U+4??"
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 317,
"end": 350,
"ctxt": 0
},
"name": {
"type": "Ident",
"span": {
"start": 317,
"end": 330,
"ctxt": 0
},
"value": "unicode-range",
"raw": "unicode-range"
},
"value": [
{
"type": "Urange",
"span": {
"start": 332,
"end": 343,
"ctxt": 0
},
"value": "U+0025-00FF"
},
{
"type": "Delimiter",
"span": {
"start": 343,
"end": 344,
"ctxt": 0
},
"value": ","
},
{
"type": "Urange",
"span": {
"start": 345,
"end": 350,
"ctxt": 0
},
"value": "U+4??"
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 378,
"end": 431,
"ctxt": 0
},
"name": {
"type": "Ident",
"span": {
"start": 378,
"end": 391,
"ctxt": 0
},
"value": "unicode-range",
"raw": "unicode-range"
},
"value": [
{
"type": "Urange",
"span": {
"start": 393,
"end": 397,
"ctxt": 0
},
"value": "U+A5"
},
{
"type": "Delimiter",
"span": {
"start": 397,
"end": 398,
"ctxt": 0
},
"value": ","
},
{
"type": "Urange",
"span": {
"start": 399,
"end": 410,
"ctxt": 0
},
"value": "U+4E00-9FFF"
},
{
"type": "Delimiter",
"span": {
"start": 410,
"end": 411,
"ctxt": 0
},
"value": ","
},
{
"type": "Urange",
"span": {
"start": 412,
"end": 418,
"ctxt": 0
},
"value": "U+30??"
},
{
"type": "Delimiter",
"span": {
"start": 418,
"end": 419,
"ctxt": 0
},
"value": ","
},
{
"type": "Urange",
"span": {
"start": 420,
"end": 431,
"ctxt": 0
},
"value": "U+FF00-FF9F"
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 459,
"end": 480,
"ctxt": 0
},
"name": {
"type": "Ident",
"span": {
"start": 459,
"end": 472,
"ctxt": 0
},
"value": "unicode-range",
"raw": "unicode-range"
},
"value": [
{
"type": "Urange",
"span": {
"start": 474,
"end": 480,
"ctxt": 0
},
"value": "U+????"
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 486,
"end": 509,
"ctxt": 0
},
"name": {
"type": "Ident",
"span": {
"start": 486,
"end": 499,
"ctxt": 0
},
"value": "unicode-range",
"raw": "unicode-range"
},
"value": [
{
"type": "Urange",
"span": {
"start": 501,
"end": 509,
"ctxt": 0
},
"value": "U+??????"
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 515,
"end": 534,
"ctxt": 0
},
"name": {
"type": "Ident",
"span": {
"start": 515,
"end": 528,
"ctxt": 0
},
"value": "unicode-range",
"raw": "unicode-range"
},
"value": [
{
"type": "Urange",
"span": {
"start": 530,
"end": 534,
"ctxt": 0
},
"value": "U+12"
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 540,
"end": 563,
"ctxt": 0
},
"name": {
"type": "Ident",
"span": {
"start": 540,
"end": 553,
"ctxt": 0
},
"value": "unicode-range",
"raw": "unicode-range"
},
"value": [
{
"type": "Urange",
"span": {
"start": 555,
"end": 563,
"ctxt": 0
},
"value": "U+12e112"
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 569,
"end": 592,
"ctxt": 0
},
"name": {
"type": "Ident",
"span": {
"start": 569,
"end": 582,
"ctxt": 0
},
"value": "unicode-range",
"raw": "unicode-range"
},
"value": [
{
"type": "Urange",
"span": {
"start": 584,
"end": 592,
"ctxt": 0
},
"value": "U+1e1ee1"
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 598,
"end": 621,
"ctxt": 0
},
"name": {
"type": "Ident",
"span": {
"start": 598,
"end": 611,
"ctxt": 0
},
"value": "unicode-range",
"raw": "unicode-range"
},
"value": [
{
"type": "Urange",
"span": {
"start": 613,
"end": 621,
"ctxt": 0
},
"value": "U+1e1ee?"
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 627,
"end": 649,
"ctxt": 0
},
"name": {
"type": "Ident",
"span": {
"start": 627,
"end": 640,
"ctxt": 0
},
"value": "unicode-range",
"raw": "unicode-range"
},
"value": [
{
"type": "Urange",
"span": {
"start": 642,
"end": 649,
"ctxt": 0
},
"value": "U+12-13"
}
],
"important": null
}
]
}
}
]
}

View File

@ -0,0 +1,655 @@
error: Stylesheet
--> $DIR/tests/fixture/value/urange/input.css:1:1
|
1 | / @font-face {
2 | | font-family: 'Ampersand';
3 | | src: local('Times New Roman');
4 | | unicode-range: U+26; /* single codepoint */
... |
17 | | unicode-range: U+12-13;
18 | | }
| |__^
error: Rule
--> $DIR/tests/fixture/value/urange/input.css:1:1
|
1 | / @font-face {
2 | | font-family: 'Ampersand';
3 | | src: local('Times New Roman');
4 | | unicode-range: U+26; /* single codepoint */
... |
17 | | unicode-range: U+12-13;
18 | | }
| |_^
error: AtRule
--> $DIR/tests/fixture/value/urange/input.css:1:1
|
1 | / @font-face {
2 | | font-family: 'Ampersand';
3 | | src: local('Times New Roman');
4 | | unicode-range: U+26; /* single codepoint */
... |
17 | | unicode-range: U+12-13;
18 | | }
| |_^
error: FontFaceRule
--> $DIR/tests/fixture/value/urange/input.css:1:1
|
1 | / @font-face {
2 | | font-family: 'Ampersand';
3 | | src: local('Times New Roman');
4 | | unicode-range: U+26; /* single codepoint */
... |
17 | | unicode-range: U+12-13;
18 | | }
| |_^
error: Block
--> $DIR/tests/fixture/value/urange/input.css:1:12
|
1 | @font-face {
| ____________^
2 | | font-family: 'Ampersand';
3 | | src: local('Times New Roman');
4 | | unicode-range: U+26; /* single codepoint */
... |
17 | | unicode-range: U+12-13;
18 | | }
| |_^
error: Declaration
--> $DIR/tests/fixture/value/urange/input.css:2:5
|
2 | font-family: 'Ampersand';
| ^^^^^^^^^^^^^^^^^^^^^^^^
error: DeclarationName
--> $DIR/tests/fixture/value/urange/input.css:2:5
|
2 | font-family: 'Ampersand';
| ^^^^^^^^^^^
error: Ident
--> $DIR/tests/fixture/value/urange/input.css:2:5
|
2 | font-family: 'Ampersand';
| ^^^^^^^^^^^
error: Value
--> $DIR/tests/fixture/value/urange/input.css:2:18
|
2 | font-family: 'Ampersand';
| ^^^^^^^^^^^
error: Str
--> $DIR/tests/fixture/value/urange/input.css:2:18
|
2 | font-family: 'Ampersand';
| ^^^^^^^^^^^
error: Declaration
--> $DIR/tests/fixture/value/urange/input.css:3:5
|
3 | src: local('Times New Roman');
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: DeclarationName
--> $DIR/tests/fixture/value/urange/input.css:3:5
|
3 | src: local('Times New Roman');
| ^^^
error: Ident
--> $DIR/tests/fixture/value/urange/input.css:3:5
|
3 | src: local('Times New Roman');
| ^^^
error: Value
--> $DIR/tests/fixture/value/urange/input.css:3:10
|
3 | src: local('Times New Roman');
| ^^^^^^^^^^^^^^^^^^^^^^^^
error: Function
--> $DIR/tests/fixture/value/urange/input.css:3:10
|
3 | src: local('Times New Roman');
| ^^^^^^^^^^^^^^^^^^^^^^^^
error: Ident
--> $DIR/tests/fixture/value/urange/input.css:3:10
|
3 | src: local('Times New Roman');
| ^^^^^
error: Value
--> $DIR/tests/fixture/value/urange/input.css:3:16
|
3 | src: local('Times New Roman');
| ^^^^^^^^^^^^^^^^^
error: Str
--> $DIR/tests/fixture/value/urange/input.css:3:16
|
3 | src: local('Times New Roman');
| ^^^^^^^^^^^^^^^^^
error: Declaration
--> $DIR/tests/fixture/value/urange/input.css:4:5
|
4 | unicode-range: U+26; /* single codepoint */
| ^^^^^^^^^^^^^^^^^^^
error: DeclarationName
--> $DIR/tests/fixture/value/urange/input.css:4:5
|
4 | unicode-range: U+26; /* single codepoint */
| ^^^^^^^^^^^^^
error: Ident
--> $DIR/tests/fixture/value/urange/input.css:4:5
|
4 | unicode-range: U+26; /* single codepoint */
| ^^^^^^^^^^^^^
error: Value
--> $DIR/tests/fixture/value/urange/input.css:4:20
|
4 | unicode-range: U+26; /* single codepoint */
| ^^^^
error: Urange
--> $DIR/tests/fixture/value/urange/input.css:4:20
|
4 | unicode-range: U+26; /* single codepoint */
| ^^^^
error: Declaration
--> $DIR/tests/fixture/value/urange/input.css:5:5
|
5 | unicode-range: u+26;
| ^^^^^^^^^^^^^^^^^^^
error: DeclarationName
--> $DIR/tests/fixture/value/urange/input.css:5:5
|
5 | unicode-range: u+26;
| ^^^^^^^^^^^^^
error: Ident
--> $DIR/tests/fixture/value/urange/input.css:5:5
|
5 | unicode-range: u+26;
| ^^^^^^^^^^^^^
error: Value
--> $DIR/tests/fixture/value/urange/input.css:5:20
|
5 | unicode-range: u+26;
| ^^^^
error: Urange
--> $DIR/tests/fixture/value/urange/input.css:5:20
|
5 | unicode-range: u+26;
| ^^^^
error: Declaration
--> $DIR/tests/fixture/value/urange/input.css:6:5
|
6 | unicode-range: U+0-7F;
| ^^^^^^^^^^^^^^^^^^^^^
error: DeclarationName
--> $DIR/tests/fixture/value/urange/input.css:6:5
|
6 | unicode-range: U+0-7F;
| ^^^^^^^^^^^^^
error: Ident
--> $DIR/tests/fixture/value/urange/input.css:6:5
|
6 | unicode-range: U+0-7F;
| ^^^^^^^^^^^^^
error: Value
--> $DIR/tests/fixture/value/urange/input.css:6:20
|
6 | unicode-range: U+0-7F;
| ^^^^^^
error: Urange
--> $DIR/tests/fixture/value/urange/input.css:6:20
|
6 | unicode-range: U+0-7F;
| ^^^^^^
error: Declaration
--> $DIR/tests/fixture/value/urange/input.css:7:5
|
7 | unicode-range: U+0025-00FF; /* codepoint range */
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: DeclarationName
--> $DIR/tests/fixture/value/urange/input.css:7:5
|
7 | unicode-range: U+0025-00FF; /* codepoint range */
| ^^^^^^^^^^^^^
error: Ident
--> $DIR/tests/fixture/value/urange/input.css:7:5
|
7 | unicode-range: U+0025-00FF; /* codepoint range */
| ^^^^^^^^^^^^^
error: Value
--> $DIR/tests/fixture/value/urange/input.css:7:20
|
7 | unicode-range: U+0025-00FF; /* codepoint range */
| ^^^^^^^^^^^
error: Urange
--> $DIR/tests/fixture/value/urange/input.css:7:20
|
7 | unicode-range: U+0025-00FF; /* codepoint range */
| ^^^^^^^^^^^
error: Declaration
--> $DIR/tests/fixture/value/urange/input.css:8:5
|
8 | unicode-range: U+4??; /* wildcard range */
| ^^^^^^^^^^^^^^^^^^^^
error: DeclarationName
--> $DIR/tests/fixture/value/urange/input.css:8:5
|
8 | unicode-range: U+4??; /* wildcard range */
| ^^^^^^^^^^^^^
error: Ident
--> $DIR/tests/fixture/value/urange/input.css:8:5
|
8 | unicode-range: U+4??; /* wildcard range */
| ^^^^^^^^^^^^^
error: Value
--> $DIR/tests/fixture/value/urange/input.css:8:20
|
8 | unicode-range: U+4??; /* wildcard range */
| ^^^^^
error: Urange
--> $DIR/tests/fixture/value/urange/input.css:8:20
|
8 | unicode-range: U+4??; /* wildcard range */
| ^^^^^
error: Declaration
--> $DIR/tests/fixture/value/urange/input.css:9:5
|
9 | unicode-range: U+0025-00FF, U+4??; /* multiple values */
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: DeclarationName
--> $DIR/tests/fixture/value/urange/input.css:9:5
|
9 | unicode-range: U+0025-00FF, U+4??; /* multiple values */
| ^^^^^^^^^^^^^
error: Ident
--> $DIR/tests/fixture/value/urange/input.css:9:5
|
9 | unicode-range: U+0025-00FF, U+4??; /* multiple values */
| ^^^^^^^^^^^^^
error: Value
--> $DIR/tests/fixture/value/urange/input.css:9:20
|
9 | unicode-range: U+0025-00FF, U+4??; /* multiple values */
| ^^^^^^^^^^^
error: Urange
--> $DIR/tests/fixture/value/urange/input.css:9:20
|
9 | unicode-range: U+0025-00FF, U+4??; /* multiple values */
| ^^^^^^^^^^^
error: Value
--> $DIR/tests/fixture/value/urange/input.css:9:31
|
9 | unicode-range: U+0025-00FF, U+4??; /* multiple values */
| ^
error: Delimiter
--> $DIR/tests/fixture/value/urange/input.css:9:31
|
9 | unicode-range: U+0025-00FF, U+4??; /* multiple values */
| ^
error: Value
--> $DIR/tests/fixture/value/urange/input.css:9:33
|
9 | unicode-range: U+0025-00FF, U+4??; /* multiple values */
| ^^^^^
error: Urange
--> $DIR/tests/fixture/value/urange/input.css:9:33
|
9 | unicode-range: U+0025-00FF, U+4??; /* multiple values */
| ^^^^^
error: Declaration
--> $DIR/tests/fixture/value/urange/input.css:10:5
|
10 | unicode-range: U+A5, U+4E00-9FFF, U+30??, U+FF00-FF9F; /* multiple values */
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: DeclarationName
--> $DIR/tests/fixture/value/urange/input.css:10:5
|
10 | unicode-range: U+A5, U+4E00-9FFF, U+30??, U+FF00-FF9F; /* multiple values */
| ^^^^^^^^^^^^^
error: Ident
--> $DIR/tests/fixture/value/urange/input.css:10:5
|
10 | unicode-range: U+A5, U+4E00-9FFF, U+30??, U+FF00-FF9F; /* multiple values */
| ^^^^^^^^^^^^^
error: Value
--> $DIR/tests/fixture/value/urange/input.css:10:20
|
10 | unicode-range: U+A5, U+4E00-9FFF, U+30??, U+FF00-FF9F; /* multiple values */
| ^^^^
error: Urange
--> $DIR/tests/fixture/value/urange/input.css:10:20
|
10 | unicode-range: U+A5, U+4E00-9FFF, U+30??, U+FF00-FF9F; /* multiple values */
| ^^^^
error: Value
--> $DIR/tests/fixture/value/urange/input.css:10:24
|
10 | unicode-range: U+A5, U+4E00-9FFF, U+30??, U+FF00-FF9F; /* multiple values */
| ^
error: Delimiter
--> $DIR/tests/fixture/value/urange/input.css:10:24
|
10 | unicode-range: U+A5, U+4E00-9FFF, U+30??, U+FF00-FF9F; /* multiple values */
| ^
error: Value
--> $DIR/tests/fixture/value/urange/input.css:10:26
|
10 | unicode-range: U+A5, U+4E00-9FFF, U+30??, U+FF00-FF9F; /* multiple values */
| ^^^^^^^^^^^
error: Urange
--> $DIR/tests/fixture/value/urange/input.css:10:26
|
10 | unicode-range: U+A5, U+4E00-9FFF, U+30??, U+FF00-FF9F; /* multiple values */
| ^^^^^^^^^^^
error: Value
--> $DIR/tests/fixture/value/urange/input.css:10:37
|
10 | unicode-range: U+A5, U+4E00-9FFF, U+30??, U+FF00-FF9F; /* multiple values */
| ^
error: Delimiter
--> $DIR/tests/fixture/value/urange/input.css:10:37
|
10 | unicode-range: U+A5, U+4E00-9FFF, U+30??, U+FF00-FF9F; /* multiple values */
| ^
error: Value
--> $DIR/tests/fixture/value/urange/input.css:10:39
|
10 | unicode-range: U+A5, U+4E00-9FFF, U+30??, U+FF00-FF9F; /* multiple values */
| ^^^^^^
error: Urange
--> $DIR/tests/fixture/value/urange/input.css:10:39
|
10 | unicode-range: U+A5, U+4E00-9FFF, U+30??, U+FF00-FF9F; /* multiple values */
| ^^^^^^
error: Value
--> $DIR/tests/fixture/value/urange/input.css:10:45
|
10 | unicode-range: U+A5, U+4E00-9FFF, U+30??, U+FF00-FF9F; /* multiple values */
| ^
error: Delimiter
--> $DIR/tests/fixture/value/urange/input.css:10:45
|
10 | unicode-range: U+A5, U+4E00-9FFF, U+30??, U+FF00-FF9F; /* multiple values */
| ^
error: Value
--> $DIR/tests/fixture/value/urange/input.css:10:47
|
10 | unicode-range: U+A5, U+4E00-9FFF, U+30??, U+FF00-FF9F; /* multiple values */
| ^^^^^^^^^^^
error: Urange
--> $DIR/tests/fixture/value/urange/input.css:10:47
|
10 | unicode-range: U+A5, U+4E00-9FFF, U+30??, U+FF00-FF9F; /* multiple values */
| ^^^^^^^^^^^
error: Declaration
--> $DIR/tests/fixture/value/urange/input.css:11:5
|
11 | unicode-range: U+????;
| ^^^^^^^^^^^^^^^^^^^^^
error: DeclarationName
--> $DIR/tests/fixture/value/urange/input.css:11:5
|
11 | unicode-range: U+????;
| ^^^^^^^^^^^^^
error: Ident
--> $DIR/tests/fixture/value/urange/input.css:11:5
|
11 | unicode-range: U+????;
| ^^^^^^^^^^^^^
error: Value
--> $DIR/tests/fixture/value/urange/input.css:11:20
|
11 | unicode-range: U+????;
| ^^^^^^
error: Urange
--> $DIR/tests/fixture/value/urange/input.css:11:20
|
11 | unicode-range: U+????;
| ^^^^^^
error: Declaration
--> $DIR/tests/fixture/value/urange/input.css:12:5
|
12 | unicode-range: U+??????;
| ^^^^^^^^^^^^^^^^^^^^^^^
error: DeclarationName
--> $DIR/tests/fixture/value/urange/input.css:12:5
|
12 | unicode-range: U+??????;
| ^^^^^^^^^^^^^
error: Ident
--> $DIR/tests/fixture/value/urange/input.css:12:5
|
12 | unicode-range: U+??????;
| ^^^^^^^^^^^^^
error: Value
--> $DIR/tests/fixture/value/urange/input.css:12:20
|
12 | unicode-range: U+??????;
| ^^^^^^^^
error: Urange
--> $DIR/tests/fixture/value/urange/input.css:12:20
|
12 | unicode-range: U+??????;
| ^^^^^^^^
error: Declaration
--> $DIR/tests/fixture/value/urange/input.css:13:5
|
13 | unicode-range: U+12;
| ^^^^^^^^^^^^^^^^^^^
error: DeclarationName
--> $DIR/tests/fixture/value/urange/input.css:13:5
|
13 | unicode-range: U+12;
| ^^^^^^^^^^^^^
error: Ident
--> $DIR/tests/fixture/value/urange/input.css:13:5
|
13 | unicode-range: U+12;
| ^^^^^^^^^^^^^
error: Value
--> $DIR/tests/fixture/value/urange/input.css:13:20
|
13 | unicode-range: U+12;
| ^^^^
error: Urange
--> $DIR/tests/fixture/value/urange/input.css:13:20
|
13 | unicode-range: U+12;
| ^^^^
error: Declaration
--> $DIR/tests/fixture/value/urange/input.css:14:5
|
14 | unicode-range: U+12e112;
| ^^^^^^^^^^^^^^^^^^^^^^^
error: DeclarationName
--> $DIR/tests/fixture/value/urange/input.css:14:5
|
14 | unicode-range: U+12e112;
| ^^^^^^^^^^^^^
error: Ident
--> $DIR/tests/fixture/value/urange/input.css:14:5
|
14 | unicode-range: U+12e112;
| ^^^^^^^^^^^^^
error: Value
--> $DIR/tests/fixture/value/urange/input.css:14:20
|
14 | unicode-range: U+12e112;
| ^^^^^^^^
error: Urange
--> $DIR/tests/fixture/value/urange/input.css:14:20
|
14 | unicode-range: U+12e112;
| ^^^^^^^^
error: Declaration
--> $DIR/tests/fixture/value/urange/input.css:15:5
|
15 | unicode-range: U+1e1ee1;
| ^^^^^^^^^^^^^^^^^^^^^^^
error: DeclarationName
--> $DIR/tests/fixture/value/urange/input.css:15:5
|
15 | unicode-range: U+1e1ee1;
| ^^^^^^^^^^^^^
error: Ident
--> $DIR/tests/fixture/value/urange/input.css:15:5
|
15 | unicode-range: U+1e1ee1;
| ^^^^^^^^^^^^^
error: Value
--> $DIR/tests/fixture/value/urange/input.css:15:20
|
15 | unicode-range: U+1e1ee1;
| ^^^^^^^^
error: Urange
--> $DIR/tests/fixture/value/urange/input.css:15:20
|
15 | unicode-range: U+1e1ee1;
| ^^^^^^^^
error: Declaration
--> $DIR/tests/fixture/value/urange/input.css:16:5
|
16 | unicode-range: U+1e1ee?;
| ^^^^^^^^^^^^^^^^^^^^^^^
error: DeclarationName
--> $DIR/tests/fixture/value/urange/input.css:16:5
|
16 | unicode-range: U+1e1ee?;
| ^^^^^^^^^^^^^
error: Ident
--> $DIR/tests/fixture/value/urange/input.css:16:5
|
16 | unicode-range: U+1e1ee?;
| ^^^^^^^^^^^^^
error: Value
--> $DIR/tests/fixture/value/urange/input.css:16:20
|
16 | unicode-range: U+1e1ee?;
| ^^^^^^^^
error: Urange
--> $DIR/tests/fixture/value/urange/input.css:16:20
|
16 | unicode-range: U+1e1ee?;
| ^^^^^^^^
error: Declaration
--> $DIR/tests/fixture/value/urange/input.css:17:5
|
17 | unicode-range: U+12-13;
| ^^^^^^^^^^^^^^^^^^^^^^
error: DeclarationName
--> $DIR/tests/fixture/value/urange/input.css:17:5
|
17 | unicode-range: U+12-13;
| ^^^^^^^^^^^^^
error: Ident
--> $DIR/tests/fixture/value/urange/input.css:17:5
|
17 | unicode-range: U+12-13;
| ^^^^^^^^^^^^^
error: Value
--> $DIR/tests/fixture/value/urange/input.css:17:20
|
17 | unicode-range: U+12-13;
| ^^^^^^^
error: Urange
--> $DIR/tests/fixture/value/urange/input.css:17:20
|
17 | unicode-range: U+12-13;
| ^^^^^^^

View File

@ -104,6 +104,7 @@ define!({
Function(Function),
Bin(BinValue),
Delimiter(Delimiter),
Urange(Urange),
Tokens(Tokens),
Url(Url),
}
@ -232,6 +233,11 @@ define!({
Function(Function),
}
pub struct Urange {
pub span: Span,
pub value: JsWord,
}
pub struct SelectorList {
pub span: Span,
pub children: Vec<ComplexSelector>,