perf(css): Reduce size of tokens (#6384)

This commit is contained in:
Alexander Akait 2022-11-10 04:36:53 +03:00 committed by GitHub
parent c428e82ac6
commit bea6cce0c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
59 changed files with 231 additions and 386 deletions

View File

@ -89,9 +89,7 @@ pub enum Token {
BadString { BadString {
#[cfg_attr(feature = "rkyv", with(swc_atoms::EncodeJsWord))] #[cfg_attr(feature = "rkyv", with(swc_atoms::EncodeJsWord))]
value: JsWord, raw_value: JsWord,
#[cfg_attr(feature = "rkyv", with(swc_atoms::EncodeJsWord))]
raw: JsWord,
}, },
/// `url(value)` /// `url(value)`
@ -101,10 +99,6 @@ pub enum Token {
#[cfg_attr(feature = "rkyv", with(swc_atoms::EncodeJsWord))] #[cfg_attr(feature = "rkyv", with(swc_atoms::EncodeJsWord))]
raw_name: JsWord, raw_name: JsWord,
#[cfg_attr(feature = "rkyv", with(swc_atoms::EncodeJsWord))] #[cfg_attr(feature = "rkyv", with(swc_atoms::EncodeJsWord))]
before: JsWord,
#[cfg_attr(feature = "rkyv", with(swc_atoms::EncodeJsWord))]
after: JsWord,
#[cfg_attr(feature = "rkyv", with(swc_atoms::EncodeJsWord))]
value: JsWord, value: JsWord,
#[cfg_attr(feature = "rkyv", with(swc_atoms::EncodeJsWord))] #[cfg_attr(feature = "rkyv", with(swc_atoms::EncodeJsWord))]
raw_value: JsWord, raw_value: JsWord,
@ -116,8 +110,6 @@ pub enum Token {
#[cfg_attr(feature = "rkyv", with(swc_atoms::EncodeJsWord))] #[cfg_attr(feature = "rkyv", with(swc_atoms::EncodeJsWord))]
raw_name: JsWord, raw_name: JsWord,
#[cfg_attr(feature = "rkyv", with(swc_atoms::EncodeJsWord))] #[cfg_attr(feature = "rkyv", with(swc_atoms::EncodeJsWord))]
value: JsWord,
#[cfg_attr(feature = "rkyv", with(swc_atoms::EncodeJsWord))]
raw_value: JsWord, raw_value: JsWord,
}, },
@ -213,11 +205,13 @@ impl Hash for Token {
Token::Ident { value, raw } Token::Ident { value, raw }
| Token::Function { value, raw } | Token::Function { value, raw }
| Token::AtKeyword { value, raw } | Token::AtKeyword { value, raw }
| Token::String { value, raw } | Token::String { value, raw } => {
| Token::BadString { value, raw } => {
value.hash(state); value.hash(state);
raw.hash(state); raw.hash(state);
} }
Token::BadString { raw_value } => {
raw_value.hash(state);
}
Token::Hash { value, raw, is_id } => { Token::Hash { value, raw, is_id } => {
value.hash(state); value.hash(state);
raw.hash(state); raw.hash(state);
@ -226,27 +220,21 @@ impl Hash for Token {
Token::Url { Token::Url {
name, name,
raw_name, raw_name,
before,
after,
value, value,
raw_value, raw_value,
} => { } => {
name.hash(state); name.hash(state);
raw_name.hash(state); raw_name.hash(state);
before.hash(state);
after.hash(state);
value.hash(state); value.hash(state);
raw_value.hash(state); raw_value.hash(state);
} }
Token::BadUrl { Token::BadUrl {
name, name,
raw_name, raw_name,
value,
raw_value, raw_value,
} => { } => {
name.hash(state); name.hash(state);
raw_name.hash(state); raw_name.hash(state);
value.hash(state);
raw_value.hash(state); raw_value.hash(state);
} }
Token::Delim { value } => { Token::Delim { value } => {

View File

@ -432,11 +432,7 @@ pub struct UrlValueRaw {
#[cfg_attr(feature = "rkyv", with(swc_atoms::EncodeJsWord))] #[cfg_attr(feature = "rkyv", with(swc_atoms::EncodeJsWord))]
pub value: JsWord, pub value: JsWord,
#[cfg_attr(feature = "rkyv", with(swc_atoms::EncodeJsWord))] #[cfg_attr(feature = "rkyv", with(swc_atoms::EncodeJsWord))]
pub before: Option<JsWord>,
#[cfg_attr(feature = "rkyv", with(swc_atoms::EncodeJsWord))]
pub raw: Option<JsWord>, pub raw: Option<JsWord>,
#[cfg_attr(feature = "rkyv", with(swc_atoms::EncodeJsWord))]
pub after: Option<JsWord>,
} }
#[ast_node] #[ast_node]

View File

@ -1978,8 +1978,8 @@ where
write_raw!(self, span, &function); write_raw!(self, span, &function);
} }
Token::BadString { raw, .. } => { Token::BadString { raw_value } => {
write_str!(self, span, raw); write_str!(self, span, raw_value);
} }
Token::String { raw, .. } => { Token::String { raw, .. } => {
write_str!(self, span, raw); write_str!(self, span, raw);
@ -1987,19 +1987,13 @@ where
Token::Url { Token::Url {
raw_name, raw_name,
raw_value, raw_value,
before,
after,
.. ..
} => { } => {
let mut url = String::with_capacity( let mut url = String::with_capacity(raw_name.len() + raw_value.len() + 2);
raw_name.len() + before.len() + raw_value.len() + after.len() + 2,
);
url.push_str(raw_name); url.push_str(raw_name);
url.push('('); url.push('(');
url.push_str(before);
url.push_str(raw_value); url.push_str(raw_value);
url.push_str(after);
url.push(')'); url.push(')');
write_str!(self, span, &url); write_str!(self, span, &url);
@ -2009,7 +2003,7 @@ where
raw_value, raw_value,
.. ..
} => { } => {
let mut bad_url = String::with_capacity(raw_name.len() + raw_value.len() + 2); let mut bad_url = String::with_capacity(raw_value.len() + 2);
bad_url.push_str(raw_name); bad_url.push_str(raw_name);
bad_url.push('('); bad_url.push('(');
@ -2097,12 +2091,10 @@ where
url.push_str(&n.value); url.push_str(&n.value);
write_str!(self, n.span, &url); write_str!(self, n.span, &url);
} else if let (Some(before), Some(raw), Some(after)) = (&n.before, &n.raw, &n.after) { } else if let Some(raw) = &n.raw {
let mut url = String::with_capacity(before.len() + raw.len() + after.len()); let mut url = String::with_capacity(raw.len());
url.push_str(before);
url.push_str(raw); url.push_str(raw);
url.push_str(after);
write_str!(self, n.span, &url); write_str!(self, n.span, &url);
} else { } else {

View File

@ -283,8 +283,6 @@ impl VisitMut for NormalizeTest {
fn visit_mut_url_value_raw(&mut self, n: &mut UrlValueRaw) { fn visit_mut_url_value_raw(&mut self, n: &mut UrlValueRaw) {
n.visit_mut_children_with(self); n.visit_mut_children_with(self);
n.before = None;
n.after = None;
n.raw = None; n.raw = None;
} }

View File

@ -400,7 +400,9 @@ impl VisitMut for Compressor {
| Token::Function { value, .. } | Token::Function { value, .. }
| Token::AtKeyword { value, .. } | Token::AtKeyword { value, .. }
| Token::String { value, .. } | Token::String { value, .. }
| Token::BadString { value, .. } | Token::BadString {
raw_value: value, ..
}
| Token::Dimension { unit: value, .. } | Token::Dimension { unit: value, .. }
if !contains_only_ascii_characters(value) => if !contains_only_ascii_characters(value) =>
{ {

View File

@ -46,9 +46,7 @@ impl Compressor {
url.value = Some(Box::new(UrlValue::Raw(UrlValueRaw { url.value = Some(Box::new(UrlValue::Raw(UrlValueRaw {
span: *span, span: *span,
value: escaped.into(), value: escaped.into(),
before: None,
raw: None, raw: None,
after: None,
}))); })));
} }
} }

View File

@ -730,8 +730,7 @@ where
l.reconsume(); l.reconsume();
return Ok(Token::BadString { return Ok(Token::BadString {
value: (&**buf).into(), raw_value: (&**raw).into(),
raw: (&**raw).into(),
}); });
} }
@ -780,15 +779,17 @@ where
// This section describes how to consume a url token from a stream of code // This section describes how to consume a url token from a stream of code
// points. It returns either a <url-token> or a <bad-url-token>. // points. It returns either a <url-token> or a <bad-url-token>.
fn read_url(&mut self, name: (JsWord, JsWord), mut before: String) -> LexResult<Token> { fn read_url(&mut self, name: (JsWord, JsWord), before: String) -> LexResult<Token> {
// Initially create a <url-token> with its value set to the empty string. // Initially create a <url-token> with its value set to the empty string.
self.with_buf_and_raw_buf(|l, out, raw| { self.with_buf_and_raw_buf(|l, out, raw| {
raw.push_str(&before);
// Consume as much whitespace as possible. // Consume as much whitespace as possible.
while let Some(c) = l.next() { while let Some(c) = l.next() {
if is_whitespace(c) { if is_whitespace(c) {
l.consume(); l.consume();
before.push(c); raw.push(c);
} else { } else {
break; break;
} }
@ -807,8 +808,6 @@ where
raw_name: name.1, raw_name: name.1,
value: (&**out).into(), value: (&**out).into(),
raw_value: (&**raw).into(), raw_value: (&**raw).into(),
before: before.into(),
after: js_word!(""),
}); });
} }
@ -822,8 +821,6 @@ where
raw_name: name.1, raw_name: name.1,
value: (&**out).into(), value: (&**out).into(),
raw_value: (&**raw).into(), raw_value: (&**raw).into(),
before: before.into(),
after: js_word!(""),
}); });
} }
@ -853,25 +850,25 @@ where
Some(')') => { Some(')') => {
l.consume(); l.consume();
return Ok(Token::Url { raw.push_str(&whitespaces);
name: name.0,
raw_name: name.1, return Ok(Token::Url {
value: (&**out).into(), name: name.0,
raw_value: (&**raw).into(), raw_name: name.1,
before: before.into(), value: (&**out).into(),
after: whitespaces.into(), raw_value: (&**raw).into(),
}); });
} }
None => { None => {
l.emit_error(ErrorKind::UnterminatedUrl); l.emit_error(ErrorKind::UnterminatedUrl);
raw.push_str(&whitespaces);
return Ok(Token::Url { return Ok(Token::Url {
name: name.0, name: name.0,
raw_name: name.1, raw_name: name.1,
value: (&**out).into(), value: (&**out).into(),
raw_value: (&**raw).into(), raw_value: (&**raw).into(),
before: before.into(),
after: whitespaces.into(),
}); });
} }
_ => {} _ => {}
@ -890,8 +887,7 @@ where
return Ok(Token::BadUrl { return Ok(Token::BadUrl {
name: name.0, name: name.0,
raw_name: name.1, raw_name: name.1,
value: (before.clone() + (&**raw)).into(), raw_value: (&**raw).into(),
raw_value: (before.clone() + (&**raw)).into(),
}); });
} }
@ -914,8 +910,7 @@ where
return Ok(Token::BadUrl { return Ok(Token::BadUrl {
name: name.0, name: name.0,
raw_name: name.1, raw_name: name.1,
value: (before.clone() + (&**raw)).into(), raw_value: (&**raw).into(),
raw_value: (before.clone() + (&**raw)).into(),
}); });
} }
@ -946,8 +941,7 @@ where
return Ok(Token::BadUrl { return Ok(Token::BadUrl {
name: name.0, name: name.0,
raw_name: name.1, raw_name: name.1,
value: (before.clone() + (&**raw)).into(), raw_value: (&**raw).into(),
raw_value: (before.clone() + (&**raw)).into(),
}); });
} }
} }

View File

@ -2870,8 +2870,6 @@ where
raw_name, raw_name,
value, value,
raw_value, raw_value,
before,
after,
} => { } => {
let name_length = raw_name.len() as u32; let name_length = raw_name.len() as u32;
let name = Ident { let name = Ident {
@ -2890,9 +2888,7 @@ where
Default::default(), Default::default(),
), ),
value, value,
before: Some(before),
raw: Some(raw_value), raw: Some(raw_value),
after: Some(after),
}))); })));
Ok(Url { Ok(Url {

View File

@ -589,9 +589,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "https://www.example.com/", "value": "https://www.example.com/",
"before": "", "raw": "https://www.example.com/"
"raw": "https://www.example.com/",
"after": ""
}, },
"modifiers": null "modifiers": null
} }

View File

@ -171,9 +171,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "./style.css", "value": "./style.css",
"before": "", "raw": "./style.css"
"raw": "./style.css",
"after": ""
}, },
"modifiers": null "modifiers": null
}, },
@ -367,9 +365,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "./style.css", "value": "./style.css",
"before": "", "raw": "./style.css"
"raw": "./style.css",
"after": ""
}, },
"modifiers": null "modifiers": null
}, },
@ -1881,9 +1877,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "test.css", "value": "test.css",
"before": "", "raw": "test.css"
"raw": "test.css",
"after": ""
}, },
"modifiers": null "modifiers": null
}, },
@ -2057,9 +2051,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "test.css", "value": "test.css",
"before": "", "raw": "test.css"
"raw": "test.css",
"after": ""
}, },
"modifiers": null "modifiers": null
}, },
@ -2117,9 +2109,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "test.css", "value": "test.css",
"before": "", "raw": "test.css"
"raw": "test.css",
"after": ""
}, },
"modifiers": null "modifiers": null
}, },
@ -2177,9 +2167,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "test.css", "value": "test.css",
"before": "", "raw": "test.css "
"raw": "test.css",
"after": " "
}, },
"modifiers": null "modifiers": null
}, },
@ -2237,9 +2225,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "test.css", "value": "test.css",
"before": " ", "raw": " test.css"
"raw": "test.css",
"after": ""
}, },
"modifiers": null "modifiers": null
}, },
@ -2297,9 +2283,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "test.css", "value": "test.css",
"before": " ", "raw": " test.css "
"raw": "test.css",
"after": " "
}, },
"modifiers": null "modifiers": null
}, },
@ -2357,9 +2341,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "test.css", "value": "test.css",
"before": "\n", "raw": "\ntest.css\n"
"raw": "test.css",
"after": "\n"
}, },
"modifiers": null "modifiers": null
}, },
@ -2417,9 +2399,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "", "value": "",
"before": "", "raw": ""
"raw": "",
"after": ""
}, },
"modifiers": null "modifiers": null
}, },
@ -2827,9 +2807,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "", "value": "",
"before": "", "raw": ""
"raw": "",
"after": ""
}, },
"modifiers": null "modifiers": null
}, },
@ -3003,9 +2981,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "test.css", "value": "test.css",
"before": "", "raw": "test.css"
"raw": "test.css",
"after": ""
}, },
"modifiers": null "modifiers": null
}, },
@ -3148,9 +3124,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "test.css", "value": "test.css",
"before": "", "raw": "test.css"
"raw": "test.css",
"after": ""
}, },
"modifiers": null "modifiers": null
}, },
@ -3293,9 +3267,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "test.css", "value": "test.css",
"before": "", "raw": "test.css"
"raw": "test.css",
"after": ""
}, },
"modifiers": null "modifiers": null
}, },
@ -3438,9 +3410,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "test.css", "value": "test.css",
"before": "", "raw": "test.css"
"raw": "test.css",
"after": ""
}, },
"modifiers": null "modifiers": null
}, },
@ -3583,9 +3553,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "test.css", "value": "test.css",
"before": "", "raw": "test.css"
"raw": "test.css",
"after": ""
}, },
"modifiers": null "modifiers": null
}, },
@ -3786,9 +3754,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "~package/test.css", "value": "~package/test.css",
"before": "", "raw": "~package/test.css"
"raw": "~package/test.css",
"after": ""
}, },
"modifiers": null "modifiers": null
}, },
@ -4136,9 +4102,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "~package/tilde.css", "value": "~package/tilde.css",
"before": "", "raw": "~package/tilde.css"
"raw": "~package/tilde.css",
"after": ""
}, },
"modifiers": null "modifiers": null
}, },
@ -4196,9 +4160,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "~aliasesImport/alias.css", "value": "~aliasesImport/alias.css",
"before": "", "raw": "~aliasesImport/alias.css"
"raw": "~aliasesImport/alias.css",
"after": ""
}, },
"modifiers": null "modifiers": null
}, },
@ -4314,9 +4276,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "./test.css", "value": "./test.css",
"before": "", "raw": "./test.css"
"raw": "./test.css",
"after": ""
}, },
"modifiers": null "modifiers": null
}, },
@ -5247,9 +5207,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "./test test.css", "value": "./test test.css",
"before": "", "raw": "./test\\ test.css"
"raw": "./test\\ test.css",
"after": ""
}, },
"modifiers": null "modifiers": null
}, },
@ -5307,9 +5265,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "./test%20test.css", "value": "./test%20test.css",
"before": "", "raw": "./t\\65st%20test.css"
"raw": "./t\\65st%20test.css",
"after": ""
}, },
"modifiers": null "modifiers": null
}, },
@ -5561,9 +5517,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "test.css", "value": "test.css",
"before": " ", "raw": " test.css "
"raw": "test.css",
"after": " "
}, },
"modifiers": null "modifiers": null
}, },
@ -5718,9 +5672,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "test.css?foo=bar", "value": "test.css?foo=bar",
"before": "", "raw": "test.css?foo=bar"
"raw": "test.css?foo=bar",
"after": ""
}, },
"modifiers": null "modifiers": null
}, },
@ -5778,9 +5730,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "test.css?foo=bar#hash", "value": "test.css?foo=bar#hash",
"before": "", "raw": "test.css?foo=bar#hash"
"raw": "test.css?foo=bar#hash",
"after": ""
}, },
"modifiers": null "modifiers": null
}, },
@ -5838,9 +5788,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "test.css?#hash", "value": "test.css?#hash",
"before": "", "raw": "test.css?#hash"
"raw": "test.css?#hash",
"after": ""
}, },
"modifiers": null "modifiers": null
}, },
@ -6441,9 +6389,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "./test.css", "value": "./test.css",
"before": " ", "raw": " ./test.css "
"raw": "./test.css",
"after": " "
}, },
"modifiers": null "modifiers": null
}, },
@ -6714,9 +6660,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "data:text/css;charset=utf-8,a%20%7B%0D%0A%20%20color%3A%20red%3B%0D%0A%7D", "value": "data:text/css;charset=utf-8,a%20%7B%0D%0A%20%20color%3A%20red%3B%0D%0A%7D",
"before": "", "raw": "data:text/css;charset=utf-8,a%20%7B%0D%0A%20%20color%3A%20red%3B%0D%0A%7D"
"raw": "data:text/css;charset=utf-8,a%20%7B%0D%0A%20%20color%3A%20red%3B%0D%0A%7D",
"after": ""
}, },
"modifiers": null "modifiers": null
}, },
@ -6774,9 +6718,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "package/first.css", "value": "package/first.css",
"before": "", "raw": "package/first.css"
"raw": "package/first.css",
"after": ""
}, },
"modifiers": null "modifiers": null
}, },
@ -6834,9 +6776,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "package/second.css", "value": "package/second.css",
"before": "", "raw": "package/second.css"
"raw": "package/second.css",
"after": ""
}, },
"modifiers": null "modifiers": null
}, },
@ -9734,9 +9674,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "test.css", "value": "test.css",
"before": "", "raw": "test.css"
"raw": "test.css",
"after": ""
}, },
"modifiers": null "modifiers": null
}, },
@ -9794,9 +9732,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "test.css", "value": "test.css",
"before": "", "raw": "test.css"
"raw": "test.css",
"after": ""
}, },
"modifiers": null "modifiers": null
}, },
@ -9854,9 +9790,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "test.css", "value": "test.css",
"before": "", "raw": "test.css"
"raw": "test.css",
"after": ""
}, },
"modifiers": null "modifiers": null
}, },
@ -9999,9 +9933,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "test.css", "value": "test.css",
"before": "", "raw": "test.css"
"raw": "test.css",
"after": ""
}, },
"modifiers": null "modifiers": null
}, },
@ -11532,9 +11464,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "bootstrap-base.css", "value": "bootstrap-base.css",
"before": "", "raw": "bootstrap-base.css"
"raw": "bootstrap-base.css",
"after": ""
}, },
"modifiers": null "modifiers": null
}, },
@ -11631,9 +11561,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "base-headings.css", "value": "base-headings.css",
"before": "", "raw": "base-headings.css"
"raw": "base-headings.css",
"after": ""
}, },
"modifiers": null "modifiers": null
}, },

View File

@ -141,9 +141,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "http://www.w3.org/1999/xhtml", "value": "http://www.w3.org/1999/xhtml",
"before": "", "raw": "http://www.w3.org/1999/xhtml"
"raw": "http://www.w3.org/1999/xhtml",
"after": ""
}, },
"modifiers": null "modifiers": null
} }
@ -266,9 +264,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "http://www.w3.org/2000/svg", "value": "http://www.w3.org/2000/svg",
"before": "", "raw": "http://www.w3.org/2000/svg"
"raw": "http://www.w3.org/2000/svg",
"after": ""
}, },
"modifiers": null "modifiers": null
} }

View File

@ -1835,9 +1835,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "path/to.png", "value": "path/to.png",
"before": "", "raw": "path/to.png"
"raw": "path/to.png",
"after": ""
}, },
"modifiers": null "modifiers": null
}, },

View File

@ -782,9 +782,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "value", "value": "value",
"before": "", "raw": "value"
"raw": "value",
"after": ""
}, },
"modifiers": null "modifiers": null
}, },
@ -813,9 +811,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "value", "value": "value",
"before": "", "raw": "value"
"raw": "value",
"after": ""
}, },
"modifiers": null "modifiers": null
} }

View File

@ -130,9 +130,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "aج", "value": "aج",
"before": "", "raw": "a\\62c"
"raw": "a\\62c",
"after": ""
}, },
"modifiers": null "modifiers": null
} }

View File

@ -55,9 +55,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "foo.css", "value": "foo.css",
"before": "", "raw": "foo.css"
"raw": "foo.css",
"after": ""
}, },
"modifiers": null "modifiers": null
}, },

View File

@ -130,9 +130,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "abc", "value": "abc",
"before": "", "raw": "a\\62 c"
"raw": "a\\62 c",
"after": ""
}, },
"modifiers": null "modifiers": null
} }

View File

@ -130,9 +130,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": ",", "value": ",",
"before": "", "raw": "\\,"
"raw": "\\,",
"after": ""
}, },
"modifiers": null "modifiers": null
} }

View File

@ -55,9 +55,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "foo.css", "value": "foo.css",
"before": "", "raw": "foo.css"
"raw": "foo.css",
"after": ""
}, },
"modifiers": null "modifiers": null
}, },

View File

@ -130,9 +130,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": ",", "value": ",",
"before": "", "raw": "\\2c"
"raw": "\\2c",
"after": ""
}, },
"modifiers": null "modifiers": null
} }

View File

@ -130,9 +130,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "abc", "value": "abc",
"before": "", "raw": "\\61 bc"
"raw": "\\61 bc",
"after": ""
}, },
"modifiers": null "modifiers": null
} }

View File

@ -55,9 +55,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "", "value": "",
"before": "", "raw": ""
"raw": "",
"after": ""
}, },
"modifiers": null "modifiers": null
}, },

View File

@ -130,9 +130,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "憼", "value": "憼",
"before": "", "raw": "\\61bc"
"raw": "\\61bc",
"after": ""
}, },
"modifiers": null "modifiers": null
} }

View File

@ -130,9 +130,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7", "value": "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",
"before": "", "raw": "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"
"raw": "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",
"after": ""
}, },
"modifiers": null "modifiers": null
} }
@ -532,9 +530,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "", "value": "",
"before": "", "raw": ""
"raw": "",
"after": ""
}, },
"modifiers": null "modifiers": null
} }
@ -584,9 +580,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "", "value": "",
"before": " ", "raw": " "
"raw": "",
"after": ""
}, },
"modifiers": null "modifiers": null
} }
@ -886,9 +880,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "./image.png", "value": "./image.png",
"before": "", "raw": "./image.png"
"raw": "./image.png",
"after": ""
}, },
"modifiers": null "modifiers": null
} }
@ -938,9 +930,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "./image.png", "value": "./image.png",
"before": " ", "raw": " ./image.png "
"raw": "./image.png",
"after": " "
}, },
"modifiers": null "modifiers": null
} }
@ -990,9 +980,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "./image2.png", "value": "./image2.png",
"before": " ", "raw": " ./image\\32.png "
"raw": "./image\\32.png",
"after": " "
}, },
"modifiers": null "modifiers": null
} }
@ -1042,9 +1030,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "./image2.png", "value": "./image2.png",
"before": " \n ", "raw": " \n ./image\\32.png \n "
"raw": "./image\\32.png",
"after": " \n "
}, },
"modifiers": null "modifiers": null
} }
@ -1094,9 +1080,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "./image2.png", "value": "./image2.png",
"before": "\n \n \n \n ", "raw": "\n \n \n \n ./image\\32.png\n \n \n \n "
"raw": "./image\\32.png",
"after": "\n \n \n \n "
}, },
"modifiers": null "modifiers": null
} }
@ -1146,9 +1130,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "./image2.png", "value": "./image2.png",
"before": " \n\n\n\n ", "raw": " \n\n\n\n ./image\\32.png\n\n\n\n "
"raw": "./image\\32.png",
"after": "\n\n\n\n "
}, },
"modifiers": null "modifiers": null
} }
@ -1198,9 +1180,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "image.png\u0001", "value": "image.png\u0001",
"before": "", "raw": "image.png\\0001"
"raw": "image.png\\0001",
"after": ""
}, },
"modifiers": null "modifiers": null
} }
@ -1250,9 +1230,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "image.png\u0001", "value": "image.png\u0001",
"before": "", "raw": "image.png\\1"
"raw": "image.png\\1",
"after": ""
}, },
"modifiers": null "modifiers": null
} }
@ -1302,9 +1280,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "image.png힙", "value": "image.png힙",
"before": "", "raw": "image.png\\D799"
"raw": "image.png\\D799",
"after": ""
}, },
"modifiers": null "modifiers": null
} }
@ -1354,9 +1330,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "image.png", "value": "image.png",
"before": "", "raw": "image.png\\E000"
"raw": "image.png\\E000",
"after": ""
}, },
"modifiers": null "modifiers": null
} }
@ -1406,9 +1380,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "image.png􏿿", "value": "image.png􏿿",
"before": "", "raw": "image.png\\10FFFF"
"raw": "image.png\\10FFFF",
"after": ""
}, },
"modifiers": null "modifiers": null
} }
@ -1458,9 +1430,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "18", "value": "18",
"before": "", "raw": "18"
"raw": "18",
"after": ""
}, },
"modifiers": null "modifiers": null
} }

View File

@ -14,4 +14,5 @@ a {
color: #FF; color: #FF;
color: #123456789; color: #123456789;
color: #xyz; color: #xyz;
color: #aa\61;
} }

View File

@ -2,7 +2,7 @@
"type": "Stylesheet", "type": "Stylesheet",
"span": { "span": {
"start": 1, "start": 1,
"end": 257, "end": 274,
"ctxt": 0 "ctxt": 0
}, },
"rules": [ "rules": [
@ -10,7 +10,7 @@
"type": "QualifiedRule", "type": "QualifiedRule",
"span": { "span": {
"start": 1, "start": 1,
"end": 256, "end": 273,
"ctxt": 0 "ctxt": 0
}, },
"prelude": { "prelude": {
@ -74,7 +74,7 @@
"type": "SimpleBlock", "type": "SimpleBlock",
"span": { "span": {
"start": 3, "start": 3,
"end": 256, "end": 273,
"ctxt": 0 "ctxt": 0
}, },
"name": { "name": {
@ -551,6 +551,37 @@
} }
], ],
"important": null "important": null
},
{
"type": "Declaration",
"span": {
"start": 257,
"end": 270,
"ctxt": 0
},
"name": {
"type": "Ident",
"span": {
"start": 257,
"end": 262,
"ctxt": 0
},
"value": "color",
"raw": "color"
},
"value": [
{
"type": "HexColor",
"span": {
"start": 264,
"end": 270,
"ctxt": 0
},
"value": "aaa",
"raw": "aa\\61"
}
],
"important": null
} }
] ]
} }

View File

@ -17,7 +17,8 @@
14 | | color: #FF; 14 | | color: #FF;
15 | | color: #123456789; 15 | | color: #123456789;
16 | | color: #xyz; 16 | | color: #xyz;
17 | `-> } 17 | | color: #aa\61;
18 | `-> }
`---- `----
x Rule x Rule
@ -38,7 +39,8 @@
14 | | color: #FF; 14 | | color: #FF;
15 | | color: #123456789; 15 | | color: #123456789;
16 | | color: #xyz; 16 | | color: #xyz;
17 | `-> } 17 | | color: #aa\61;
18 | `-> }
`---- `----
x QualifiedRule x QualifiedRule
@ -59,7 +61,8 @@
14 | | color: #FF; 14 | | color: #FF;
15 | | color: #123456789; 15 | | color: #123456789;
16 | | color: #xyz; 16 | | color: #xyz;
17 | `-> } 17 | | color: #aa\61;
18 | `-> }
`---- `----
x SelectorList x SelectorList
@ -122,7 +125,8 @@
14 | | color: #FF; 14 | | color: #FF;
15 | | color: #123456789; 15 | | color: #123456789;
16 | | color: #xyz; 16 | | color: #xyz;
17 | `-> } 17 | | color: #aa\61;
18 | `-> }
`---- `----
x LBrace x LBrace
@ -850,3 +854,51 @@
16 | color: #xyz; 16 | color: #xyz;
: ^^^^ : ^^^^
`---- `----
x ComponentValue
,-[$DIR/tests/fixture/hex-colors/input.css:17:3]
17 | color: #aa\61;
: ^^^^^^^^^^^^^
`----
x StyleBlock
,-[$DIR/tests/fixture/hex-colors/input.css:17:3]
17 | color: #aa\61;
: ^^^^^^^^^^^^^
`----
x Declaration
,-[$DIR/tests/fixture/hex-colors/input.css:17:3]
17 | color: #aa\61;
: ^^^^^^^^^^^^^
`----
x DeclarationName
,-[$DIR/tests/fixture/hex-colors/input.css:17:3]
17 | color: #aa\61;
: ^^^^^
`----
x Ident
,-[$DIR/tests/fixture/hex-colors/input.css:17:3]
17 | color: #aa\61;
: ^^^^^
`----
x ComponentValue
,-[$DIR/tests/fixture/hex-colors/input.css:17:3]
17 | color: #aa\61;
: ^^^^^^
`----
x Color
,-[$DIR/tests/fixture/hex-colors/input.css:17:3]
17 | color: #aa\61;
: ^^^^^^
`----
x HexColor
,-[$DIR/tests/fixture/hex-colors/input.css:17:3]
17 | color: #aa\61;
: ^^^^^^
`----

View File

@ -1771,8 +1771,6 @@
"Url": { "Url": {
"name": "url", "name": "url",
"raw_name": "url", "raw_name": "url",
"before": "",
"after": "",
"value": "foo.png", "value": "foo.png",
"raw_value": "foo.png" "raw_value": "foo.png"
} }

View File

@ -1541,8 +1541,7 @@
: ^^^^^^^^^^^^ : ^^^^^^^^^^^^
`---- `----
x Url { name: Atom('url' type=static), raw_name: Atom('url' type=static), before: Atom('' type=static), after: Atom('' type=static), value: Atom('foo.png' type=inline), raw_value: Atom('foo.png' x Url { name: Atom('url' type=static), raw_name: Atom('url' type=static), value: Atom('foo.png' type=inline), raw_value: Atom('foo.png' type=inline) }
| type=inline) }
,-[$DIR/tests/fixture/selector/pseudo-class/unknown/input.css:15:1] ,-[$DIR/tests/fixture/selector/pseudo-class/unknown/input.css:15:1]
15 | :unknown(url(foo.png)) {} 15 | :unknown(url(foo.png)) {}
: ^^^^^^^^^^^^ : ^^^^^^^^^^^^

View File

@ -1771,8 +1771,6 @@
"Url": { "Url": {
"name": "url", "name": "url",
"raw_name": "url", "raw_name": "url",
"before": "",
"after": "",
"value": "foo.png", "value": "foo.png",
"raw_value": "foo.png" "raw_value": "foo.png"
} }

View File

@ -1540,8 +1540,7 @@
: ^^^^^^^^^^^^ : ^^^^^^^^^^^^
`---- `----
x Url { name: Atom('url' type=static), raw_name: Atom('url' type=static), before: Atom('' type=static), after: Atom('' type=static), value: Atom('foo.png' type=inline), raw_value: Atom('foo.png' x Url { name: Atom('url' type=static), raw_name: Atom('url' type=static), value: Atom('foo.png' type=inline), raw_value: Atom('foo.png' type=inline) }
| type=inline) }
,-[$DIR/tests/fixture/selector/pseudo-element/unknown/input.css:15:1] ,-[$DIR/tests/fixture/selector/pseudo-element/unknown/input.css:15:1]
15 | ::unknown(url(foo.png)) {} 15 | ::unknown(url(foo.png)) {}
: ^^^^^^^^^^^^ : ^^^^^^^^^^^^

View File

@ -148,9 +148,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "foo.jpg", "value": "foo.jpg",
"before": "", "raw": "foo.jpg"
"raw": "foo.jpg",
"after": ""
}, },
"modifiers": null "modifiers": null
}, },

View File

@ -295,9 +295,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "a;a", "value": "a;a",
"before": "", "raw": "a;a"
"raw": "a;a",
"after": ""
}, },
"modifiers": null "modifiers": null
} }
@ -347,9 +345,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "a/*", "value": "a/*",
"before": "", "raw": "a/*"
"raw": "a/*",
"after": ""
}, },
"modifiers": null "modifiers": null
} }

View File

@ -130,9 +130,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "https://example.com/image.png", "value": "https://example.com/image.png",
"before": "", "raw": "https://example.com/image.png"
"raw": "https://example.com/image.png",
"after": ""
}, },
"modifiers": null "modifiers": null
} }
@ -182,9 +180,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "https://example.com/image.png", "value": "https://example.com/image.png",
"before": "", "raw": "https://example.com/image.png"
"raw": "https://example.com/image.png",
"after": ""
}, },
"modifiers": null "modifiers": null
} }
@ -234,9 +230,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "https://example.com/image.png", "value": "https://example.com/image.png",
"before": "", "raw": "https://example.com/image.png"
"raw": "https://example.com/image.png",
"after": ""
}, },
"modifiers": null "modifiers": null
} }
@ -486,9 +480,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "data:image/png;base64,iRxVB0", "value": "data:image/png;base64,iRxVB0",
"before": "", "raw": "data:image/png;base64,iRxVB0"
"raw": "data:image/png;base64,iRxVB0",
"after": ""
}, },
"modifiers": null "modifiers": null
} }
@ -538,9 +530,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "#IDofSVGpath", "value": "#IDofSVGpath",
"before": "", "raw": "#IDofSVGpath"
"raw": "#IDofSVGpath",
"after": ""
}, },
"modifiers": null "modifiers": null
} }
@ -873,9 +863,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "", "value": "",
"before": "", "raw": ""
"raw": "",
"after": ""
}, },
"modifiers": null "modifiers": null
} }
@ -1232,9 +1220,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "https://example.com/image.png", "value": "https://example.com/image.png",
"before": " ", "raw": " https://example.com/image.png "
"raw": "https://example.com/image.png",
"after": " "
}, },
"modifiers": null "modifiers": null
} }
@ -1284,9 +1270,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "https://example.com/image.png", "value": "https://example.com/image.png",
"before": " ", "raw": " https://example.com/image.png "
"raw": "https://example.com/image.png",
"after": " "
}, },
"modifiers": null "modifiers": null
} }
@ -1336,9 +1320,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "https://example.com/image.png", "value": "https://example.com/image.png",
"before": " \n ", "raw": " \n https://example.com/image.png \n "
"raw": "https://example.com/image.png",
"after": " \n "
}, },
"modifiers": null "modifiers": null
} }
@ -1388,9 +1370,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "https://example.com/image.png", "value": "https://example.com/image.png",
"before": "\n\n\n", "raw": "\n\n\nhttps://example.com/image.png\n\n\n"
"raw": "https://example.com/image.png",
"after": "\n\n\n"
}, },
"modifiers": null "modifiers": null
} }
@ -1440,9 +1420,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "https://example.com/ima)ge.png", "value": "https://example.com/ima)ge.png",
"before": "", "raw": "https://example.com/ima\\)ge.png"
"raw": "https://example.com/ima\\)ge.png",
"after": ""
}, },
"modifiers": null "modifiers": null
} }

View File

@ -116,7 +116,6 @@
"BadUrl": { "BadUrl": {
"name": "url", "name": "url",
"raw_name": "url", "raw_name": "url",
"value": "image\".png",
"raw_value": "image\".png" "raw_value": "image\".png"
} }
} }

View File

@ -115,7 +115,7 @@
: ^^^^^^^^^^^^^^^ : ^^^^^^^^^^^^^^^
`---- `----
x BadUrl { name: Atom('url' type=static), raw_name: Atom('url' type=static), value: Atom('image".png' type=dynamic), raw_value: Atom('image".png' type=dynamic) } x BadUrl { name: Atom('url' type=static), raw_name: Atom('url' type=static), raw_value: Atom('image".png' type=dynamic) }
,-[$DIR/tests/recovery/bad-url-token/double-quotes/input.css:2:5] ,-[$DIR/tests/recovery/bad-url-token/double-quotes/input.css:2:5]
2 | background: url(image".png); 2 | background: url(image".png);
: ^^^^^^^^^^^^^^^ : ^^^^^^^^^^^^^^^

View File

@ -116,7 +116,6 @@
"BadUrl": { "BadUrl": {
"name": "url", "name": "url",
"raw_name": "url", "raw_name": "url",
"value": "image.png\\\n ",
"raw_value": "image.png\\\n " "raw_value": "image.png\\\n "
} }
} }

View File

@ -115,8 +115,7 @@
3 | `-> ); 3 | `-> );
`---- `----
x BadUrl { name: Atom('url' type=static), raw_name: Atom('url' type=static), value: Atom('image.png\ x BadUrl { name: Atom('url' type=static), raw_name: Atom('url' type=static), raw_value: Atom('image.png\
| ' type=dynamic), raw_value: Atom('image.png\
| ' type=dynamic) } | ' type=dynamic) }
,-[$DIR/tests/recovery/bad-url-token/invalid-escape/input.css:2:5] ,-[$DIR/tests/recovery/bad-url-token/invalid-escape/input.css:2:5]
2 | ,-> background: url(image.png\ 2 | ,-> background: url(image.png\

View File

@ -116,7 +116,6 @@
"BadUrl": { "BadUrl": {
"name": "url", "name": "url",
"raw_name": "url", "raw_name": "url",
"value": "image(.png",
"raw_value": "image(.png" "raw_value": "image(.png"
} }
} }

View File

@ -115,7 +115,7 @@
: ^^^^^^^^^^^^^^^ : ^^^^^^^^^^^^^^^
`---- `----
x BadUrl { name: Atom('url' type=static), raw_name: Atom('url' type=static), value: Atom('image(.png' type=dynamic), raw_value: Atom('image(.png' type=dynamic) } x BadUrl { name: Atom('url' type=static), raw_name: Atom('url' type=static), raw_value: Atom('image(.png' type=dynamic) }
,-[$DIR/tests/recovery/bad-url-token/left-parenthesis/input.css:2:5] ,-[$DIR/tests/recovery/bad-url-token/left-parenthesis/input.css:2:5]
2 | background: url(image(.png); 2 | background: url(image(.png);
: ^^^^^^^^^^^^^^^ : ^^^^^^^^^^^^^^^

View File

@ -116,7 +116,6 @@
"BadUrl": { "BadUrl": {
"name": "url", "name": "url",
"raw_name": "url", "raw_name": "url",
"value": "image'.png",
"raw_value": "image'.png" "raw_value": "image'.png"
} }
} }

View File

@ -115,7 +115,7 @@
: ^^^^^^^^^^^^^^^ : ^^^^^^^^^^^^^^^
`---- `----
x BadUrl { name: Atom('url' type=static), raw_name: Atom('url' type=static), value: Atom('image'.png' type=dynamic), raw_value: Atom('image'.png' type=dynamic) } x BadUrl { name: Atom('url' type=static), raw_name: Atom('url' type=static), raw_value: Atom('image'.png' type=dynamic) }
,-[$DIR/tests/recovery/bad-url-token/single-quotes/input.css:2:5] ,-[$DIR/tests/recovery/bad-url-token/single-quotes/input.css:2:5]
2 | background: url(image'.png); 2 | background: url(image'.png);
: ^^^^^^^^^^^^^^^ : ^^^^^^^^^^^^^^^

View File

@ -116,7 +116,6 @@
"BadUrl": { "BadUrl": {
"name": "url", "name": "url",
"raw_name": "url", "raw_name": "url",
"value": " ./image.jpg a ",
"raw_value": " ./image.jpg a " "raw_value": " ./image.jpg a "
} }
} }

View File

@ -111,7 +111,7 @@
: ^^^^^^^^^^^^^^^^^^^^^^^^ : ^^^^^^^^^^^^^^^^^^^^^^^^
`---- `----
x BadUrl { name: Atom('url' type=static), raw_name: Atom('url' type=static), value: Atom(' ./image.jpg a ' type=dynamic), raw_value: Atom(' ./image.jpg a ' type=dynamic) } x BadUrl { name: Atom('url' type=static), raw_name: Atom('url' type=static), raw_value: Atom(' ./image.jpg a ' type=dynamic) }
,-[$DIR/tests/recovery/bad-url-token/whitespace-in-middle/input.css:2:5] ,-[$DIR/tests/recovery/bad-url-token/whitespace-in-middle/input.css:2:5]
2 | background-image: url( ./image.jpg a ); 2 | background-image: url( ./image.jpg a );
: ^^^^^^^^^^^^^^^^^^^^^^^^ : ^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -116,7 +116,6 @@
"BadUrl": { "BadUrl": {
"name": "url", "name": "url",
"raw_name": "url", "raw_name": "url",
"value": "image.\n png",
"raw_value": "image.\n png" "raw_value": "image.\n png"
} }
} }

View File

@ -119,8 +119,7 @@
3 | `-> png); 3 | `-> png);
`---- `----
x BadUrl { name: Atom('url' type=static), raw_name: Atom('url' type=static), value: Atom('image. x BadUrl { name: Atom('url' type=static), raw_name: Atom('url' type=static), raw_value: Atom('image.
| png' type=dynamic), raw_value: Atom('image.
| png' type=dynamic) } | png' type=dynamic) }
,-[$DIR/tests/recovery/bad-url-token/whitespace/input.css:2:5] ,-[$DIR/tests/recovery/bad-url-token/whitespace/input.css:2:5]
2 | ,-> background: url(image. 2 | ,-> background: url(image.

View File

@ -116,7 +116,6 @@
"BadUrl": { "BadUrl": {
"name": "url", "name": "url",
"raw_name": "url", "raw_name": "url",
"value": "\n /* test */\n \"test.png\"\n ",
"raw_value": "\n /* test */\n \"test.png\"\n " "raw_value": "\n /* test */\n \"test.png\"\n "
} }
} }

View File

@ -131,10 +131,7 @@
5 | `-> ); 5 | `-> );
`---- `----
x BadUrl { name: Atom('url' type=static), raw_name: Atom('url' type=static), value: Atom(' x BadUrl { name: Atom('url' type=static), raw_name: Atom('url' type=static), raw_value: Atom('
| /* test */
| "test.png"
| ' type=dynamic), raw_value: Atom('
| /* test */ | /* test */
| "test.png" | "test.png"
| ' type=dynamic) } | ' type=dynamic) }

View File

@ -116,7 +116,6 @@
"BadUrl": { "BadUrl": {
"name": "url", "name": "url",
"raw_name": "url", "raw_name": "url",
"value": "\n /* test */\n test.png\n ",
"raw_value": "\n /* test */\n test.png\n " "raw_value": "\n /* test */\n test.png\n "
} }
} }

View File

@ -131,10 +131,7 @@
5 | `-> ); 5 | `-> );
`---- `----
x BadUrl { name: Atom('url' type=static), raw_name: Atom('url' type=static), value: Atom(' x BadUrl { name: Atom('url' type=static), raw_name: Atom('url' type=static), raw_value: Atom('
| /* test */
| test.png
| ' type=dynamic), raw_value: Atom('
| /* test */ | /* test */
| test.png | test.png
| ' type=dynamic) } | ' type=dynamic) }

View File

@ -134,8 +134,7 @@
}, },
"token": { "token": {
"BadString": { "BadString": {
"value": "tes", "raw_value": "\"tes"
"raw": "\"tes"
} }
} }
}, },
@ -175,8 +174,7 @@
}, },
"token": { "token": {
"BadString": { "BadString": {
"value": ";", "raw_value": "\";"
"raw": "\";"
} }
} }
} }

View File

@ -136,7 +136,7 @@
: ^^^^ : ^^^^
`---- `----
x BadString { value: Atom('tes' type=inline), raw: Atom('"tes' type=inline) } x BadString { raw_value: Atom('"tes' type=inline) }
,-[$DIR/tests/recovery/value/quotes/input.css:2:5] ,-[$DIR/tests/recovery/value/quotes/input.css:2:5]
2 | content: "tes 2 | content: "tes
: ^^^^ : ^^^^
@ -173,7 +173,7 @@
: ^^ : ^^
`---- `----
x BadString { value: Atom(';' type=inline), raw: Atom('";' type=inline) } x BadString { raw_value: Atom('";' type=inline) }
,-[$DIR/tests/recovery/value/quotes/input.css:3:5] ,-[$DIR/tests/recovery/value/quotes/input.css:3:5]
3 | t"; 3 | t";
: ^^ : ^^

View File

@ -114,8 +114,7 @@
}, },
"token": { "token": {
"BadString": { "BadString": {
"value": "", "raw_value": "\""
"raw": "\""
} }
} }
} }

View File

@ -107,7 +107,7 @@
: ^ : ^
`---- `----
x BadString { value: Atom('' type=static), raw: Atom('"' type=inline) } x BadString { raw_value: Atom('"' type=inline) }
,-[$DIR/tests/recovery/value/string/newline/input.css:2:5] ,-[$DIR/tests/recovery/value/string/newline/input.css:2:5]
2 | prop: " 2 | prop: "
: ^ : ^

View File

@ -151,7 +151,6 @@
"BadUrl": { "BadUrl": {
"name": "url", "name": "url",
"raw_name": "url", "raw_name": "url",
"value": "var(--foo",
"raw_value": "var(--foo" "raw_value": "var(--foo"
} }
} }
@ -202,9 +201,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "image.png<6E>", "value": "image.png<6E>",
"before": "", "raw": "image.png\\999999"
"raw": "image.png\\999999",
"after": ""
}, },
"modifiers": null "modifiers": null
} }
@ -254,9 +251,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "image.png<6E>", "value": "image.png<6E>",
"before": "", "raw": "image.png\\0"
"raw": "image.png\\0",
"after": ""
}, },
"modifiers": null "modifiers": null
} }
@ -306,9 +301,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "image.png<6E>", "value": "image.png<6E>",
"before": "", "raw": "image.png\\D800"
"raw": "image.png\\D800",
"after": ""
}, },
"modifiers": null "modifiers": null
} }
@ -358,9 +351,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "image.png<6E>", "value": "image.png<6E>",
"before": "", "raw": "image.png\\DFFF"
"raw": "image.png\\DFFF",
"after": ""
}, },
"modifiers": null "modifiers": null
} }
@ -410,9 +401,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "image.png<6E>", "value": "image.png<6E>",
"before": "", "raw": "image.png\\11FFFF"
"raw": "image.png\\11FFFF",
"after": ""
}, },
"modifiers": null "modifiers": null
} }
@ -556,7 +545,6 @@
"BadUrl": { "BadUrl": {
"name": "url", "name": "url",
"raw_name": "url", "raw_name": "url",
"value": "image.png param(var(--url",
"raw_value": "image.png param(var(--url" "raw_value": "image.png param(var(--url"
} }
} }

View File

@ -189,7 +189,7 @@
: ^^^^^^^^^^^^^^ : ^^^^^^^^^^^^^^
`---- `----
x BadUrl { name: Atom('url' type=static), raw_name: Atom('url' type=static), value: Atom('var(--foo' type=dynamic), raw_value: Atom('var(--foo' type=dynamic) } x BadUrl { name: Atom('url' type=static), raw_name: Atom('url' type=static), raw_value: Atom('var(--foo' type=dynamic) }
,-[$DIR/tests/recovery/value/url/basic/input.css:3:5] ,-[$DIR/tests/recovery/value/url/basic/input.css:3:5]
3 | background: url(var(--foo)); 3 | background: url(var(--foo));
: ^^^^^^^^^^^^^^ : ^^^^^^^^^^^^^^
@ -636,7 +636,7 @@
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`---- `----
x BadUrl { name: Atom('url' type=static), raw_name: Atom('url' type=static), value: Atom('image.png param(var(--url' type=dynamic), raw_value: Atom('image.png param(var(--url' type=dynamic) } x BadUrl { name: Atom('url' type=static), raw_name: Atom('url' type=static), raw_value: Atom('image.png param(var(--url' type=dynamic) }
,-[$DIR/tests/recovery/value/url/basic/input.css:13:5] ,-[$DIR/tests/recovery/value/url/basic/input.css:13:5]
13 | background: url(image.png param(var(--url))); 13 | background: url(image.png param(var(--url)));
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -130,9 +130,7 @@
"ctxt": 0 "ctxt": 0
}, },
"value": "foo.png", "value": "foo.png",
"before": "", "raw": "foo.png"
"raw": "foo.png",
"after": ""
}, },
"modifiers": null "modifiers": null
} }

View File

@ -116,7 +116,6 @@
"BadUrl": { "BadUrl": {
"name": "url", "name": "url",
"raw_name": "url", "raw_name": "url",
"value": "test\\);\n}",
"raw_value": "test\\);\n}" "raw_value": "test\\);\n}"
} }
} }

View File

@ -111,8 +111,7 @@
3 | `-> } 3 | `-> }
`---- `----
x BadUrl { name: Atom('url' type=static), raw_name: Atom('url' type=static), value: Atom('test\); x BadUrl { name: Atom('url' type=static), raw_name: Atom('url' type=static), raw_value: Atom('test\);
| }' type=dynamic), raw_value: Atom('test\);
| }' type=dynamic) } | }' type=dynamic) }
,-[$DIR/tests/recovery/value/url/parenthesis/input.css:2:5] ,-[$DIR/tests/recovery/value/url/parenthesis/input.css:2:5]
2 | ,-> background: url(test\); 2 | ,-> background: url(test\);

View File

@ -288,9 +288,7 @@ define!({
pub struct UrlValueRaw { pub struct UrlValueRaw {
pub span: Span, pub span: Span,
pub value: JsWord, pub value: JsWord,
pub before: Option<JsWord>,
pub raw: Option<JsWord>, pub raw: Option<JsWord>,
pub after: Option<JsWord>,
} }
pub enum UrlModifier { pub enum UrlModifier {