refactor(css/parser): Fix parsing of declarations (#6234)

This commit is contained in:
Alexander Akait 2022-10-23 01:50:19 +03:00 committed by GitHub
parent ac3949e34f
commit e4fe8403d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
48 changed files with 1314 additions and 449 deletions

View File

@ -45,8 +45,7 @@ div {
background: url('\"foo\"'); background: url('\"foo\"');
} }
.bar { .bar {
background: url(http://example.com/image.svg param(--color var(--primary-color); background: url(http://example.com/image.svg param(--color var(--primary-color)));}
));}
.baz { .baz {
background: url("http://example.com/image.svg" param(--color var(--primary-color))); background: url("http://example.com/image.svg" param(--color var(--primary-color)));
} }

View File

@ -1 +1 @@
div{background:url(https://example.com/image.png);background:url(https://example.com/image.png);background:url(https://example.com/image.png);background:url("https://example.com/image.png");background:url("https://example.com/image.png");background:url("https://example.com/image.png");background:url("https://example.com/image.png");background:url(data:image/png;base64,iRxVB0);background:url(#IDofSVGpath);background:url("//aa.com/img.svg"prefetch);background:url("//aa.com/img.svg"foo bar baz func(test));background:url("http://example.com/image.svg"param(--color var(--primary-color)));background:url();background:url("");background:url("");--foo:"http://www.example.com/pinkish.gif";background:src("http://www.example.com/pinkish.gif");background:src("http://www.example.com/pinkish.gif");background:src(var(--foo));background:url(https://example.com/image.png);background:url(https://example.com/image.png);background:url(https://example.com/image.png);background:url(https://example.com/image.png);background:url(image.png힙)}div{background:url(foo.img)red}*{background:url("foo");background:url("f o");background:url("f o");background:url("foo)");background:url("(foo");background:url("(foo)");background:url('"foo"')}.bar{background:url(http://example.com/image.svg param(--color var(--primary-color);));}.baz{background:url("http://example.com/image.svg"param(--color var(--primary-color)))}.foo{background:url(__ident__)} div{background:url(https://example.com/image.png);background:url(https://example.com/image.png);background:url(https://example.com/image.png);background:url("https://example.com/image.png");background:url("https://example.com/image.png");background:url("https://example.com/image.png");background:url("https://example.com/image.png");background:url(data:image/png;base64,iRxVB0);background:url(#IDofSVGpath);background:url("//aa.com/img.svg"prefetch);background:url("//aa.com/img.svg"foo bar baz func(test));background:url("http://example.com/image.svg"param(--color var(--primary-color)));background:url();background:url("");background:url("");--foo:"http://www.example.com/pinkish.gif";background:src("http://www.example.com/pinkish.gif");background:src("http://www.example.com/pinkish.gif");background:src(var(--foo));background:url(https://example.com/image.png);background:url(https://example.com/image.png);background:url(https://example.com/image.png);background:url(https://example.com/image.png);background:url(image.png힙)}div{background:url(foo.img)red}*{background:url("foo");background:url("f o");background:url("f o");background:url("foo)");background:url("(foo");background:url("(foo)");background:url('"foo"')}.bar{background: url(http://example.com/image.svg param(--color var(--primary-color)));}.baz{background:url("http://example.com/image.svg"param(--color var(--primary-color)))}.foo{background:url(__ident__)}

View File

@ -42,6 +42,7 @@ impl Error {
ErrorKind::Ignore => "Not an error".into(), ErrorKind::Ignore => "Not an error".into(),
ErrorKind::UnexpectedChar(c) => format!("Unexpected character `{:?}`", c).into(), ErrorKind::UnexpectedChar(c) => format!("Unexpected character `{:?}`", c).into(),
ErrorKind::Expected(s) => format!("Expected {}", s).into(), ErrorKind::Expected(s) => format!("Expected {}", s).into(),
ErrorKind::Unexpected(s) => format!("Unexpected {}", s).into(),
ErrorKind::ExpectedButGot(s) => format!("Expected {}", s).into(), ErrorKind::ExpectedButGot(s) => format!("Expected {}", s).into(),
ErrorKind::ExpectedSelectorText => "Expected a text for selector".into(), ErrorKind::ExpectedSelectorText => "Expected a text for selector".into(),
ErrorKind::UnterminatedBlockComment => "Unterminated block comment".into(), ErrorKind::UnterminatedBlockComment => "Unterminated block comment".into(),
@ -91,6 +92,7 @@ pub enum ErrorKind {
Ignore, Ignore,
UnexpectedChar(char), UnexpectedChar(char),
Expected(&'static str), Expected(&'static str),
Unexpected(&'static str),
ExpectedButGot(&'static str), ExpectedButGot(&'static str),
ExpectedSelectorText, ExpectedSelectorText,
UnterminatedBlockComment, UnterminatedBlockComment,

View File

@ -1,4 +1,4 @@
use swc_common::Span; use swc_common::{Span, Spanned};
use swc_css_ast::*; use swc_css_ast::*;
use super::{input::ParserInput, PResult, Parser}; use super::{input::ParserInput, PResult, Parser};
@ -252,19 +252,33 @@ where
// <semicolon-token> // <semicolon-token>
// Do nothing. // Do nothing.
tok!(";") => { tok!(";") => {
bump!(self); let token_and_span = self.input.bump().unwrap();
// For recovery mode
// TODO revisit it after refactor parser
if let Some(StyleBlock::ListOfComponentValues(list_of_component_values)) =
declarations.last_mut()
{
list_of_component_values.span = Span::new(
list_of_component_values.span_lo(),
token_and_span.span_hi(),
Default::default(),
);
list_of_component_values
.children
.push(ComponentValue::PreservedToken(token_and_span));
}
} }
// <at-keyword-token> // <at-keyword-token>
// Reconsume the current input token. Consume an at-rule, and append the result to // Reconsume the current input token. Consume an at-rule, and append the result to
// rules. // rules.
tok!("@") => { tok!("@") => {
let ctx = Ctx { rules.push(StyleBlock::AtRule(Box::new(
self.with_ctx(Ctx {
block_contents_grammar: BlockContentsGrammar::StyleBlock, block_contents_grammar: BlockContentsGrammar::StyleBlock,
..self.ctx ..self.ctx
}; })
.parse_as::<AtRule>()?,
rules.push(StyleBlock::AtRule(Box::new(
self.with_ctx(ctx).parse_as::<AtRule>()?,
))); )));
} }
// <ident-token> // <ident-token>
@ -276,11 +290,12 @@ where
tok!("ident") => { tok!("ident") => {
if self.config.legacy_nesting { if self.config.legacy_nesting {
let state = self.input.state(); let state = self.input.state();
let ctx = Ctx { let legacy_nested = self
.with_ctx(Ctx {
is_trying_legacy_nesting: true, is_trying_legacy_nesting: true,
..self.ctx ..self.ctx
}; })
let legacy_nested = self.with_ctx(ctx).parse_as::<QualifiedRule>(); .parse_as::<QualifiedRule>();
match legacy_nested { match legacy_nested {
Ok(legacy_nested) => { Ok(legacy_nested) => {
@ -294,39 +309,36 @@ where
}; };
} }
let state = self.input.state(); let span = self.input.cur_span();
let prop = match self.parse() { let mut temporary_list = ListOfComponentValues {
Ok(v) => StyleBlock::Declaration(v), span: Default::default(),
children: vec![],
};
while !is_one_of!(self, ";", EOF) {
let ctx = Ctx {
block_contents_grammar: BlockContentsGrammar::NoGrammar,
..self.ctx
};
let component_value = self.with_ctx(ctx).parse_as::<ComponentValue>()?;
temporary_list.children.push(component_value);
}
let decl_or_list_of_component_values =
match self.parse_according_to_grammar::<Declaration>(&temporary_list) {
Ok(decl) => StyleBlock::Declaration(Box::new(decl)),
Err(err) => { Err(err) => {
self.errors.push(err); self.errors.push(err);
self.input.reset(&state);
let span = self.input.cur_span(); temporary_list.span = span!(self, span.lo);
let mut children = vec![];
while !is_one_of!(self, EOF) { StyleBlock::ListOfComponentValues(temporary_list)
if let Some(token_and_span) = self.input.bump() {
children.push(ComponentValue::PreservedToken(token_and_span));
}
if is!(self, ";") {
if let Some(token_and_span) = self.input.bump() {
children
.push(ComponentValue::PreservedToken(token_and_span));
}
break;
}
}
StyleBlock::ListOfComponentValues(ListOfComponentValues {
span: span!(self, span.lo),
children,
})
} }
}; };
declarations.push(prop); declarations.push(decl_or_list_of_component_values);
} }
// <delim-token> with a value of "&" (U+0026 AMPERSAND) // <delim-token> with a value of "&" (U+0026 AMPERSAND)
@ -881,6 +893,25 @@ where
} }
} }
} }
match value.last() {
Some(ComponentValue::PreservedToken(TokenAndSpan {
span,
token: Token::BadUrl { .. },
..
}))
| Some(ComponentValue::PreservedToken(TokenAndSpan {
span,
token: Token::BadString { .. },
..
})) => {
return Err(Error::new(
*span,
ErrorKind::Unexpected("token in <declaration-value>"),
));
}
_ => {}
};
} }
// 5. If the last two non-<whitespace-token>s in the declarations value are a // 5. If the last two non-<whitespace-token>s in the declarations value are a

View File

@ -25,9 +25,7 @@ where
match cur!(self) { match cur!(self) {
// ... <bad-string-token>, <bad-url-token>, // ... <bad-string-token>, <bad-url-token>,
tok!("bad-string") | tok!("bad-url") => { tok!("bad-string") | tok!("bad-url") => break,
break;
}
// ... unmatched <)-token>, <]-token>, or <}-token>, // ... unmatched <)-token>, <]-token>, or <}-token>,
tok!(")") | tok!("]") | tok!("}") => { tok!(")") | tok!("]") | tok!("}") => {

View File

@ -3626,7 +3626,7 @@
"type": "Declaration", "type": "Declaration",
"span": { "span": {
"start": 1285, "start": 1285,
"end": 1299, "end": 1298,
"ctxt": 0 "ctxt": 0
}, },
"name": { "name": {
@ -3646,7 +3646,7 @@
"type": "Declaration", "type": "Declaration",
"span": { "span": {
"start": 1304, "start": 1304,
"end": 1315, "end": 1314,
"ctxt": 0 "ctxt": 0
}, },
"name": { "name": {

View File

@ -3686,19 +3686,19 @@
x ComponentValue x ComponentValue
,-[$DIR/tests/fixture/csstree/1/input.css:52:5] ,-[$DIR/tests/fixture/csstree/1/input.css:52:5]
52 | --empty-var: ; 52 | --empty-var: ;
: ^^^^^^^^^^^^^^ : ^^^^^^^^^^^^^
`---- `----
x StyleBlock x StyleBlock
,-[$DIR/tests/fixture/csstree/1/input.css:52:5] ,-[$DIR/tests/fixture/csstree/1/input.css:52:5]
52 | --empty-var: ; 52 | --empty-var: ;
: ^^^^^^^^^^^^^^ : ^^^^^^^^^^^^^
`---- `----
x Declaration x Declaration
,-[$DIR/tests/fixture/csstree/1/input.css:52:5] ,-[$DIR/tests/fixture/csstree/1/input.css:52:5]
52 | --empty-var: ; 52 | --empty-var: ;
: ^^^^^^^^^^^^^^ : ^^^^^^^^^^^^^
`---- `----
x DeclarationName x DeclarationName
@ -3716,19 +3716,19 @@
x ComponentValue x ComponentValue
,-[$DIR/tests/fixture/csstree/1/input.css:53:5] ,-[$DIR/tests/fixture/csstree/1/input.css:53:5]
53 | --bad-var:; 53 | --bad-var:;
: ^^^^^^^^^^^ : ^^^^^^^^^^
`---- `----
x StyleBlock x StyleBlock
,-[$DIR/tests/fixture/csstree/1/input.css:53:5] ,-[$DIR/tests/fixture/csstree/1/input.css:53:5]
53 | --bad-var:; 53 | --bad-var:;
: ^^^^^^^^^^^ : ^^^^^^^^^^
`---- `----
x Declaration x Declaration
,-[$DIR/tests/fixture/csstree/1/input.css:53:5] ,-[$DIR/tests/fixture/csstree/1/input.css:53:5]
53 | --bad-var:; 53 | --bad-var:;
: ^^^^^^^^^^^ : ^^^^^^^^^^
`---- `----
x DeclarationName x DeclarationName

View File

@ -430,7 +430,7 @@
"type": "Declaration", "type": "Declaration",
"span": { "span": {
"start": 206, "start": 206,
"end": 216, "end": 215,
"ctxt": 0 "ctxt": 0
}, },
"name": { "name": {
@ -450,7 +450,7 @@
"type": "Declaration", "type": "Declaration",
"span": { "span": {
"start": 221, "start": 221,
"end": 236, "end": 231,
"ctxt": 0 "ctxt": 0
}, },
"name": { "name": {
@ -544,7 +544,7 @@
"type": "Declaration", "type": "Declaration",
"span": { "span": {
"start": 297, "start": 297,
"end": 322, "end": 314,
"ctxt": 0 "ctxt": 0
}, },
"name": { "name": {

View File

@ -658,19 +658,19 @@
x ComponentValue x ComponentValue
,-[$DIR/tests/fixture/value/custom-property/input.css:10:5] ,-[$DIR/tests/fixture/value/custom-property/input.css:10:5]
10 | --empty: ; 10 | --empty: ;
: ^^^^^^^^^^ : ^^^^^^^^^
`---- `----
x StyleBlock x StyleBlock
,-[$DIR/tests/fixture/value/custom-property/input.css:10:5] ,-[$DIR/tests/fixture/value/custom-property/input.css:10:5]
10 | --empty: ; 10 | --empty: ;
: ^^^^^^^^^^ : ^^^^^^^^^
`---- `----
x Declaration x Declaration
,-[$DIR/tests/fixture/value/custom-property/input.css:10:5] ,-[$DIR/tests/fixture/value/custom-property/input.css:10:5]
10 | --empty: ; 10 | --empty: ;
: ^^^^^^^^^^ : ^^^^^^^^^
`---- `----
x DeclarationName x DeclarationName
@ -688,19 +688,19 @@
x ComponentValue x ComponentValue
,-[$DIR/tests/fixture/value/custom-property/input.css:11:5] ,-[$DIR/tests/fixture/value/custom-property/input.css:11:5]
11 | --empty2: /**/; 11 | --empty2: /**/;
: ^^^^^^^^^^^^^^^ : ^^^^^^^^^^
`---- `----
x StyleBlock x StyleBlock
,-[$DIR/tests/fixture/value/custom-property/input.css:11:5] ,-[$DIR/tests/fixture/value/custom-property/input.css:11:5]
11 | --empty2: /**/; 11 | --empty2: /**/;
: ^^^^^^^^^^^^^^^ : ^^^^^^^^^^
`---- `----
x Declaration x Declaration
,-[$DIR/tests/fixture/value/custom-property/input.css:11:5] ,-[$DIR/tests/fixture/value/custom-property/input.css:11:5]
11 | --empty2: /**/; 11 | --empty2: /**/;
: ^^^^^^^^^^^^^^^ : ^^^^^^^^^^
`---- `----
x DeclarationName x DeclarationName
@ -802,19 +802,19 @@
x ComponentValue x ComponentValue
,-[$DIR/tests/fixture/value/custom-property/input.css:14:5] ,-[$DIR/tests/fixture/value/custom-property/input.css:14:5]
14 | --empty5:/* 1 */ /* 2 */; 14 | --empty5:/* 1 */ /* 2 */;
: ^^^^^^^^^^^^^^^^^^^^^^^^^ : ^^^^^^^^^^^^^^^^^
`---- `----
x StyleBlock x StyleBlock
,-[$DIR/tests/fixture/value/custom-property/input.css:14:5] ,-[$DIR/tests/fixture/value/custom-property/input.css:14:5]
14 | --empty5:/* 1 */ /* 2 */; 14 | --empty5:/* 1 */ /* 2 */;
: ^^^^^^^^^^^^^^^^^^^^^^^^^ : ^^^^^^^^^^^^^^^^^
`---- `----
x Declaration x Declaration
,-[$DIR/tests/fixture/value/custom-property/input.css:14:5] ,-[$DIR/tests/fixture/value/custom-property/input.css:14:5]
14 | --empty5:/* 1 */ /* 2 */; 14 | --empty5:/* 1 */ /* 2 */;
: ^^^^^^^^^^^^^^^^^^^^^^^^^ : ^^^^^^^^^^^^^^^^^
`---- `----
x DeclarationName x DeclarationName

View File

@ -88,23 +88,49 @@
}, },
"value": [ "value": [
{ {
"type": "Declaration", "type": "ListOfComponentValues",
"span": { "span": {
"start": 11, "start": 11,
"end": 38, "end": 39,
"ctxt": 0 "ctxt": 0
}, },
"name": { "children": [
"type": "Ident", {
"type": "PreservedToken",
"span": { "span": {
"start": 11, "start": 11,
"end": 21, "end": 21,
"ctxt": 0 "ctxt": 0
}, },
"token": {
"Ident": {
"value": "background", "value": "background",
"raw": "background" "raw": "background"
}
}
},
{
"type": "PreservedToken",
"span": {
"start": 21,
"end": 22,
"ctxt": 0
},
"token": "Colon"
},
{
"type": "PreservedToken",
"span": {
"start": 22,
"end": 23,
"ctxt": 0
},
"token": {
"WhiteSpace": {
"value": " "
}
}
}, },
"value": [
{ {
"type": "PreservedToken", "type": "PreservedToken",
"span": { "span": {
@ -120,9 +146,17 @@
"raw_value": "image\".png" "raw_value": "image\".png"
} }
} }
},
{
"type": "PreservedToken",
"span": {
"start": 38,
"end": 39,
"ctxt": 0
},
"token": "Semi"
} }
], ]
"important": null
}, },
{ {
"type": "Declaration", "type": "Declaration",

View File

@ -10,3 +10,9 @@
2 | background: url(image".png); 2 | background: url(image".png);
: ^ : ^
`---- `----
x Unexpected token in <declaration-value>
,-[$DIR/tests/recovery/bad-url-token/double-quotes/input.css:2:5]
2 | background: url(image".png);
: ^^^^^^^^^^^^^^^
`----

View File

@ -82,33 +82,51 @@
x ComponentValue x ComponentValue
,-[$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);
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^ : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`---- `----
x StyleBlock x StyleBlock
,-[$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);
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^ : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`---- `----
x Declaration x ComponentValue
,-[$DIR/tests/recovery/bad-url-token/double-quotes/input.css:2:5]
2 | background: url(image".png);
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^
`----
x DeclarationName
,-[$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);
: ^^^^^^^^^^ : ^^^^^^^^^^
`---- `----
x Ident x Ident { value: Atom('background' type=dynamic), raw: Atom('background' 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);
: ^^^^^^^^^^ : ^^^^^^^^^^
`---- `----
x ComponentValue
,-[$DIR/tests/recovery/bad-url-token/double-quotes/input.css:2:5]
2 | background: url(image".png);
: ^
`----
x Colon
,-[$DIR/tests/recovery/bad-url-token/double-quotes/input.css:2:5]
2 | background: url(image".png);
: ^
`----
x ComponentValue
,-[$DIR/tests/recovery/bad-url-token/double-quotes/input.css:2:5]
2 | background: url(image".png);
: ^
`----
x WhiteSpace { value: Atom(' ' type=inline) }
,-[$DIR/tests/recovery/bad-url-token/double-quotes/input.css:2:5]
2 | background: url(image".png);
: ^
`----
x ComponentValue x ComponentValue
,-[$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);
@ -121,6 +139,18 @@
: ^^^^^^^^^^^^^^^ : ^^^^^^^^^^^^^^^
`---- `----
x ComponentValue
,-[$DIR/tests/recovery/bad-url-token/double-quotes/input.css:2:5]
2 | background: url(image".png);
: ^
`----
x Semi
,-[$DIR/tests/recovery/bad-url-token/double-quotes/input.css:2:5]
2 | background: url(image".png);
: ^
`----
x ComponentValue x ComponentValue
,-[$DIR/tests/recovery/bad-url-token/double-quotes/input.css:3:5] ,-[$DIR/tests/recovery/bad-url-token/double-quotes/input.css:3:5]
3 | color: red; 3 | color: red;

View File

@ -88,23 +88,49 @@
}, },
"value": [ "value": [
{ {
"type": "Declaration", "type": "ListOfComponentValues",
"span": { "span": {
"start": 11, "start": 11,
"end": 43, "end": 44,
"ctxt": 0 "ctxt": 0
}, },
"name": { "children": [
"type": "Ident", {
"type": "PreservedToken",
"span": { "span": {
"start": 11, "start": 11,
"end": 21, "end": 21,
"ctxt": 0 "ctxt": 0
}, },
"token": {
"Ident": {
"value": "background", "value": "background",
"raw": "background" "raw": "background"
}
}
},
{
"type": "PreservedToken",
"span": {
"start": 21,
"end": 22,
"ctxt": 0
},
"token": "Colon"
},
{
"type": "PreservedToken",
"span": {
"start": 22,
"end": 23,
"ctxt": 0
},
"token": {
"WhiteSpace": {
"value": " "
}
}
}, },
"value": [
{ {
"type": "PreservedToken", "type": "PreservedToken",
"span": { "span": {
@ -120,9 +146,17 @@
"raw_value": "image.png\\\n " "raw_value": "image.png\\\n "
} }
} }
},
{
"type": "PreservedToken",
"span": {
"start": 43,
"end": 44,
"ctxt": 0
},
"token": "Semi"
} }
], ]
"important": null
} }
] ]
} }

View File

@ -10,3 +10,9 @@
2 | ,-> background: url(image.png\ 2 | ,-> background: url(image.png\
3 | `-> ); 3 | `-> );
`---- `----
x Unexpected token in <declaration-value>
,-[$DIR/tests/recovery/bad-url-token/invalid-escape/input.css:2:5]
2 | ,-> background: url(image.png\
3 | `-> );
`----

View File

@ -91,24 +91,42 @@
3 | `-> ); 3 | `-> );
`---- `----
x Declaration x ComponentValue
,-[$DIR/tests/recovery/bad-url-token/invalid-escape/input.css:2:5]
2 | ,-> background: url(image.png\
3 | `-> );
`----
x DeclarationName
,-[$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\
: ^^^^^^^^^^ : ^^^^^^^^^^
`---- `----
x Ident x Ident { value: Atom('background' type=dynamic), raw: Atom('background' 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\
: ^^^^^^^^^^ : ^^^^^^^^^^
`---- `----
x ComponentValue
,-[$DIR/tests/recovery/bad-url-token/invalid-escape/input.css:2:5]
2 | background: url(image.png\
: ^
`----
x Colon
,-[$DIR/tests/recovery/bad-url-token/invalid-escape/input.css:2:5]
2 | background: url(image.png\
: ^
`----
x ComponentValue
,-[$DIR/tests/recovery/bad-url-token/invalid-escape/input.css:2:5]
2 | background: url(image.png\
: ^
`----
x WhiteSpace { value: Atom(' ' type=inline) }
,-[$DIR/tests/recovery/bad-url-token/invalid-escape/input.css:2:5]
2 | background: url(image.png\
: ^
`----
x ComponentValue x ComponentValue
,-[$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\
@ -122,3 +140,15 @@
2 | ,-> background: url(image.png\ 2 | ,-> background: url(image.png\
3 | `-> ); 3 | `-> );
`---- `----
x ComponentValue
,-[$DIR/tests/recovery/bad-url-token/invalid-escape/input.css:3:5]
3 | );
: ^
`----
x Semi
,-[$DIR/tests/recovery/bad-url-token/invalid-escape/input.css:3:5]
3 | );
: ^
`----

View File

@ -88,23 +88,49 @@
}, },
"value": [ "value": [
{ {
"type": "Declaration", "type": "ListOfComponentValues",
"span": { "span": {
"start": 11, "start": 11,
"end": 38, "end": 39,
"ctxt": 0 "ctxt": 0
}, },
"name": { "children": [
"type": "Ident", {
"type": "PreservedToken",
"span": { "span": {
"start": 11, "start": 11,
"end": 21, "end": 21,
"ctxt": 0 "ctxt": 0
}, },
"token": {
"Ident": {
"value": "background", "value": "background",
"raw": "background" "raw": "background"
}
}
},
{
"type": "PreservedToken",
"span": {
"start": 21,
"end": 22,
"ctxt": 0
},
"token": "Colon"
},
{
"type": "PreservedToken",
"span": {
"start": 22,
"end": 23,
"ctxt": 0
},
"token": {
"WhiteSpace": {
"value": " "
}
}
}, },
"value": [
{ {
"type": "PreservedToken", "type": "PreservedToken",
"span": { "span": {
@ -120,9 +146,17 @@
"raw_value": "image(.png" "raw_value": "image(.png"
} }
} }
},
{
"type": "PreservedToken",
"span": {
"start": 38,
"end": 39,
"ctxt": 0
},
"token": "Semi"
} }
], ]
"important": null
}, },
{ {
"type": "Declaration", "type": "Declaration",

View File

@ -10,3 +10,9 @@
2 | background: url(image(.png); 2 | background: url(image(.png);
: ^ : ^
`---- `----
x Unexpected token in <declaration-value>
,-[$DIR/tests/recovery/bad-url-token/left-parenthesis/input.css:2:5]
2 | background: url(image(.png);
: ^^^^^^^^^^^^^^^
`----

View File

@ -82,33 +82,51 @@
x ComponentValue x ComponentValue
,-[$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);
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^ : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`---- `----
x StyleBlock x StyleBlock
,-[$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);
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^ : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`---- `----
x Declaration x ComponentValue
,-[$DIR/tests/recovery/bad-url-token/left-parenthesis/input.css:2:5]
2 | background: url(image(.png);
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^
`----
x DeclarationName
,-[$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);
: ^^^^^^^^^^ : ^^^^^^^^^^
`---- `----
x Ident x Ident { value: Atom('background' type=dynamic), raw: Atom('background' 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);
: ^^^^^^^^^^ : ^^^^^^^^^^
`---- `----
x ComponentValue
,-[$DIR/tests/recovery/bad-url-token/left-parenthesis/input.css:2:5]
2 | background: url(image(.png);
: ^
`----
x Colon
,-[$DIR/tests/recovery/bad-url-token/left-parenthesis/input.css:2:5]
2 | background: url(image(.png);
: ^
`----
x ComponentValue
,-[$DIR/tests/recovery/bad-url-token/left-parenthesis/input.css:2:5]
2 | background: url(image(.png);
: ^
`----
x WhiteSpace { value: Atom(' ' type=inline) }
,-[$DIR/tests/recovery/bad-url-token/left-parenthesis/input.css:2:5]
2 | background: url(image(.png);
: ^
`----
x ComponentValue x ComponentValue
,-[$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);
@ -121,6 +139,18 @@
: ^^^^^^^^^^^^^^^ : ^^^^^^^^^^^^^^^
`---- `----
x ComponentValue
,-[$DIR/tests/recovery/bad-url-token/left-parenthesis/input.css:2:5]
2 | background: url(image(.png);
: ^
`----
x Semi
,-[$DIR/tests/recovery/bad-url-token/left-parenthesis/input.css:2:5]
2 | background: url(image(.png);
: ^
`----
x ComponentValue x ComponentValue
,-[$DIR/tests/recovery/bad-url-token/left-parenthesis/input.css:3:5] ,-[$DIR/tests/recovery/bad-url-token/left-parenthesis/input.css:3:5]
3 | color: red; 3 | color: red;

View File

@ -88,23 +88,49 @@
}, },
"value": [ "value": [
{ {
"type": "Declaration", "type": "ListOfComponentValues",
"span": { "span": {
"start": 11, "start": 11,
"end": 38, "end": 39,
"ctxt": 0 "ctxt": 0
}, },
"name": { "children": [
"type": "Ident", {
"type": "PreservedToken",
"span": { "span": {
"start": 11, "start": 11,
"end": 21, "end": 21,
"ctxt": 0 "ctxt": 0
}, },
"token": {
"Ident": {
"value": "background", "value": "background",
"raw": "background" "raw": "background"
}
}
},
{
"type": "PreservedToken",
"span": {
"start": 21,
"end": 22,
"ctxt": 0
},
"token": "Colon"
},
{
"type": "PreservedToken",
"span": {
"start": 22,
"end": 23,
"ctxt": 0
},
"token": {
"WhiteSpace": {
"value": " "
}
}
}, },
"value": [
{ {
"type": "PreservedToken", "type": "PreservedToken",
"span": { "span": {
@ -120,9 +146,17 @@
"raw_value": "image'.png" "raw_value": "image'.png"
} }
} }
},
{
"type": "PreservedToken",
"span": {
"start": 38,
"end": 39,
"ctxt": 0
},
"token": "Semi"
} }
], ]
"important": null
}, },
{ {
"type": "Declaration", "type": "Declaration",

View File

@ -10,3 +10,9 @@
2 | background: url(image'.png); 2 | background: url(image'.png);
: ^ : ^
`---- `----
x Unexpected token in <declaration-value>
,-[$DIR/tests/recovery/bad-url-token/single-quotes/input.css:2:5]
2 | background: url(image'.png);
: ^^^^^^^^^^^^^^^
`----

View File

@ -82,33 +82,51 @@
x ComponentValue x ComponentValue
,-[$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);
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^ : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`---- `----
x StyleBlock x StyleBlock
,-[$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);
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^ : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`---- `----
x Declaration x ComponentValue
,-[$DIR/tests/recovery/bad-url-token/single-quotes/input.css:2:5]
2 | background: url(image'.png);
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^
`----
x DeclarationName
,-[$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);
: ^^^^^^^^^^ : ^^^^^^^^^^
`---- `----
x Ident x Ident { value: Atom('background' type=dynamic), raw: Atom('background' 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);
: ^^^^^^^^^^ : ^^^^^^^^^^
`---- `----
x ComponentValue
,-[$DIR/tests/recovery/bad-url-token/single-quotes/input.css:2:5]
2 | background: url(image'.png);
: ^
`----
x Colon
,-[$DIR/tests/recovery/bad-url-token/single-quotes/input.css:2:5]
2 | background: url(image'.png);
: ^
`----
x ComponentValue
,-[$DIR/tests/recovery/bad-url-token/single-quotes/input.css:2:5]
2 | background: url(image'.png);
: ^
`----
x WhiteSpace { value: Atom(' ' type=inline) }
,-[$DIR/tests/recovery/bad-url-token/single-quotes/input.css:2:5]
2 | background: url(image'.png);
: ^
`----
x ComponentValue x ComponentValue
,-[$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);
@ -121,6 +139,18 @@
: ^^^^^^^^^^^^^^^ : ^^^^^^^^^^^^^^^
`---- `----
x ComponentValue
,-[$DIR/tests/recovery/bad-url-token/single-quotes/input.css:2:5]
2 | background: url(image'.png);
: ^
`----
x Semi
,-[$DIR/tests/recovery/bad-url-token/single-quotes/input.css:2:5]
2 | background: url(image'.png);
: ^
`----
x ComponentValue x ComponentValue
,-[$DIR/tests/recovery/bad-url-token/single-quotes/input.css:3:5] ,-[$DIR/tests/recovery/bad-url-token/single-quotes/input.css:3:5]
3 | color: red; 3 | color: red;

View File

@ -88,23 +88,49 @@
}, },
"value": [ "value": [
{ {
"type": "Declaration", "type": "ListOfComponentValues",
"span": { "span": {
"start": 9, "start": 9,
"end": 51, "end": 52,
"ctxt": 0 "ctxt": 0
}, },
"name": { "children": [
"type": "Ident", {
"type": "PreservedToken",
"span": { "span": {
"start": 9, "start": 9,
"end": 25, "end": 25,
"ctxt": 0 "ctxt": 0
}, },
"token": {
"Ident": {
"value": "background-image", "value": "background-image",
"raw": "background-image" "raw": "background-image"
}
}
},
{
"type": "PreservedToken",
"span": {
"start": 25,
"end": 26,
"ctxt": 0
},
"token": "Colon"
},
{
"type": "PreservedToken",
"span": {
"start": 26,
"end": 27,
"ctxt": 0
},
"token": {
"WhiteSpace": {
"value": " "
}
}
}, },
"value": [
{ {
"type": "PreservedToken", "type": "PreservedToken",
"span": { "span": {
@ -120,9 +146,17 @@
"raw_value": " ./image.jpg a " "raw_value": " ./image.jpg a "
} }
} }
},
{
"type": "PreservedToken",
"span": {
"start": 51,
"end": 52,
"ctxt": 0
},
"token": "Semi"
} }
], ]
"important": null
} }
] ]
} }

View File

@ -4,3 +4,9 @@
2 | background-image: url( ./image.jpg a ); 2 | background-image: url( ./image.jpg a );
: ^^^^^^^^^^^^^^^^^^^^^^^^ : ^^^^^^^^^^^^^^^^^^^^^^^^
`---- `----
x Unexpected token in <declaration-value>
,-[$DIR/tests/recovery/bad-url-token/whitespace-in-middle/input.css:2:5]
2 | background-image: url( ./image.jpg a );
: ^^^^^^^^^^^^^^^^^^^^^^^^
`----

View File

@ -78,33 +78,51 @@
x ComponentValue x ComponentValue
,-[$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 );
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`---- `----
x StyleBlock x StyleBlock
,-[$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 );
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`---- `----
x Declaration x ComponentValue
,-[$DIR/tests/recovery/bad-url-token/whitespace-in-middle/input.css:2:5]
2 | background-image: url( ./image.jpg a );
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`----
x DeclarationName
,-[$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 );
: ^^^^^^^^^^^^^^^^ : ^^^^^^^^^^^^^^^^
`---- `----
x Ident x Ident { value: Atom('background-image' type=dynamic), raw: Atom('background-image' 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 );
: ^^^^^^^^^^^^^^^^ : ^^^^^^^^^^^^^^^^
`---- `----
x ComponentValue
,-[$DIR/tests/recovery/bad-url-token/whitespace-in-middle/input.css:2:5]
2 | background-image: url( ./image.jpg a );
: ^
`----
x Colon
,-[$DIR/tests/recovery/bad-url-token/whitespace-in-middle/input.css:2:5]
2 | background-image: url( ./image.jpg a );
: ^
`----
x ComponentValue
,-[$DIR/tests/recovery/bad-url-token/whitespace-in-middle/input.css:2:5]
2 | background-image: url( ./image.jpg a );
: ^
`----
x WhiteSpace { value: Atom(' ' type=inline) }
,-[$DIR/tests/recovery/bad-url-token/whitespace-in-middle/input.css:2:5]
2 | background-image: url( ./image.jpg a );
: ^
`----
x ComponentValue x ComponentValue
,-[$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 );
@ -116,3 +134,15 @@
2 | background-image: url( ./image.jpg a ); 2 | background-image: url( ./image.jpg a );
: ^^^^^^^^^^^^^^^^^^^^^^^^ : ^^^^^^^^^^^^^^^^^^^^^^^^
`---- `----
x ComponentValue
,-[$DIR/tests/recovery/bad-url-token/whitespace-in-middle/input.css:2:5]
2 | background-image: url( ./image.jpg a );
: ^
`----
x Semi
,-[$DIR/tests/recovery/bad-url-token/whitespace-in-middle/input.css:2:5]
2 | background-image: url( ./image.jpg a );
: ^
`----

View File

@ -88,23 +88,49 @@
}, },
"value": [ "value": [
{ {
"type": "Declaration", "type": "ListOfComponentValues",
"span": { "span": {
"start": 11, "start": 11,
"end": 42, "end": 43,
"ctxt": 0 "ctxt": 0
}, },
"name": { "children": [
"type": "Ident", {
"type": "PreservedToken",
"span": { "span": {
"start": 11, "start": 11,
"end": 21, "end": 21,
"ctxt": 0 "ctxt": 0
}, },
"token": {
"Ident": {
"value": "background", "value": "background",
"raw": "background" "raw": "background"
}
}
},
{
"type": "PreservedToken",
"span": {
"start": 21,
"end": 22,
"ctxt": 0
},
"token": "Colon"
},
{
"type": "PreservedToken",
"span": {
"start": 22,
"end": 23,
"ctxt": 0
},
"token": {
"WhiteSpace": {
"value": " "
}
}
}, },
"value": [
{ {
"type": "PreservedToken", "type": "PreservedToken",
"span": { "span": {
@ -120,9 +146,17 @@
"raw_value": "image.\n png" "raw_value": "image.\n png"
} }
} }
},
{
"type": "PreservedToken",
"span": {
"start": 42,
"end": 43,
"ctxt": 0
},
"token": "Semi"
} }
], ]
"important": null
}, },
{ {
"type": "Declaration", "type": "Declaration",

View File

@ -4,3 +4,9 @@
2 | ,-> background: url(image. 2 | ,-> background: url(image.
3 | `-> png); 3 | `-> png);
`---- `----
x Unexpected token in <declaration-value>
,-[$DIR/tests/recovery/bad-url-token/whitespace/input.css:2:5]
2 | ,-> background: url(image.
3 | `-> png);
`----

View File

@ -95,24 +95,42 @@
3 | `-> png); 3 | `-> png);
`---- `----
x Declaration x ComponentValue
,-[$DIR/tests/recovery/bad-url-token/whitespace/input.css:2:5]
2 | ,-> background: url(image.
3 | `-> png);
`----
x DeclarationName
,-[$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.
: ^^^^^^^^^^ : ^^^^^^^^^^
`---- `----
x Ident x Ident { value: Atom('background' type=dynamic), raw: Atom('background' 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.
: ^^^^^^^^^^ : ^^^^^^^^^^
`---- `----
x ComponentValue
,-[$DIR/tests/recovery/bad-url-token/whitespace/input.css:2:5]
2 | background: url(image.
: ^
`----
x Colon
,-[$DIR/tests/recovery/bad-url-token/whitespace/input.css:2:5]
2 | background: url(image.
: ^
`----
x ComponentValue
,-[$DIR/tests/recovery/bad-url-token/whitespace/input.css:2:5]
2 | background: url(image.
: ^
`----
x WhiteSpace { value: Atom(' ' type=inline) }
,-[$DIR/tests/recovery/bad-url-token/whitespace/input.css:2:5]
2 | background: url(image.
: ^
`----
x ComponentValue x ComponentValue
,-[$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.
@ -127,6 +145,18 @@
3 | `-> png); 3 | `-> png);
`---- `----
x ComponentValue
,-[$DIR/tests/recovery/bad-url-token/whitespace/input.css:3:5]
3 | png);
: ^
`----
x Semi
,-[$DIR/tests/recovery/bad-url-token/whitespace/input.css:3:5]
3 | png);
: ^
`----
x ComponentValue x ComponentValue
,-[$DIR/tests/recovery/bad-url-token/whitespace/input.css:4:5] ,-[$DIR/tests/recovery/bad-url-token/whitespace/input.css:4:5]
4 | color: red; 4 | color: red;

View File

@ -84,7 +84,7 @@
"type": "Declaration", "type": "Declaration",
"span": { "span": {
"start": 14, "start": 14,
"end": 21, "end": 20,
"ctxt": 0 "ctxt": 0
}, },
"name": { "name": {

View File

@ -86,19 +86,19 @@
x ComponentValue x ComponentValue
,-[$DIR/tests/recovery/declaration/basic/input.css:2:5] ,-[$DIR/tests/recovery/declaration/basic/input.css:2:5]
2 | prop: ; 2 | prop: ;
: ^^^^^^^ : ^^^^^^
`---- `----
x StyleBlock x StyleBlock
,-[$DIR/tests/recovery/declaration/basic/input.css:2:5] ,-[$DIR/tests/recovery/declaration/basic/input.css:2:5]
2 | prop: ; 2 | prop: ;
: ^^^^^^^ : ^^^^^^
`---- `----
x Declaration x Declaration
,-[$DIR/tests/recovery/declaration/basic/input.css:2:5] ,-[$DIR/tests/recovery/declaration/basic/input.css:2:5]
2 | prop: ; 2 | prop: ;
: ^^^^^^^ : ^^^^^^
`---- `----
x DeclarationName x DeclarationName

View File

@ -88,23 +88,49 @@
}, },
"value": [ "value": [
{ {
"type": "Declaration", "type": "ListOfComponentValues",
"span": { "span": {
"start": 9, "start": 9,
"end": 69, "end": 70,
"ctxt": 0 "ctxt": 0
}, },
"name": { "children": [
"type": "Ident", {
"type": "PreservedToken",
"span": { "span": {
"start": 9, "start": 9,
"end": 19, "end": 19,
"ctxt": 0 "ctxt": 0
}, },
"token": {
"Ident": {
"value": "background", "value": "background",
"raw": "background" "raw": "background"
}
}
},
{
"type": "PreservedToken",
"span": {
"start": 19,
"end": 20,
"ctxt": 0
},
"token": "Colon"
},
{
"type": "PreservedToken",
"span": {
"start": 20,
"end": 21,
"ctxt": 0
},
"token": {
"WhiteSpace": {
"value": " "
}
}
}, },
"value": [
{ {
"type": "PreservedToken", "type": "PreservedToken",
"span": { "span": {
@ -120,9 +146,17 @@
"raw_value": "\n /* test */\n \"test.png\"\n " "raw_value": "\n /* test */\n \"test.png\"\n "
} }
} }
},
{
"type": "PreservedToken",
"span": {
"start": 69,
"end": 70,
"ctxt": 0
},
"token": "Semi"
} }
], ]
"important": null
} }
] ]
} }

View File

@ -6,3 +6,11 @@
4 | | "test.png" 4 | | "test.png"
5 | `-> ); 5 | `-> );
`---- `----
x Unexpected token in <declaration-value>
,-[$DIR/tests/recovery/function/bad-comment-2/input.css:2:5]
2 | ,-> background: url(
3 | | /* test */
4 | | "test.png"
5 | `-> );
`----

View File

@ -103,26 +103,42 @@
5 | `-> ); 5 | `-> );
`---- `----
x Declaration x ComponentValue
,-[$DIR/tests/recovery/function/bad-comment-2/input.css:2:5]
2 | ,-> background: url(
3 | | /* test */
4 | | "test.png"
5 | `-> );
`----
x DeclarationName
,-[$DIR/tests/recovery/function/bad-comment-2/input.css:2:5] ,-[$DIR/tests/recovery/function/bad-comment-2/input.css:2:5]
2 | background: url( 2 | background: url(
: ^^^^^^^^^^ : ^^^^^^^^^^
`---- `----
x Ident x Ident { value: Atom('background' type=dynamic), raw: Atom('background' type=dynamic) }
,-[$DIR/tests/recovery/function/bad-comment-2/input.css:2:5] ,-[$DIR/tests/recovery/function/bad-comment-2/input.css:2:5]
2 | background: url( 2 | background: url(
: ^^^^^^^^^^ : ^^^^^^^^^^
`---- `----
x ComponentValue
,-[$DIR/tests/recovery/function/bad-comment-2/input.css:2:5]
2 | background: url(
: ^
`----
x Colon
,-[$DIR/tests/recovery/function/bad-comment-2/input.css:2:5]
2 | background: url(
: ^
`----
x ComponentValue
,-[$DIR/tests/recovery/function/bad-comment-2/input.css:2:5]
2 | background: url(
: ^
`----
x WhiteSpace { value: Atom(' ' type=inline) }
,-[$DIR/tests/recovery/function/bad-comment-2/input.css:2:5]
2 | background: url(
: ^
`----
x ComponentValue x ComponentValue
,-[$DIR/tests/recovery/function/bad-comment-2/input.css:2:5] ,-[$DIR/tests/recovery/function/bad-comment-2/input.css:2:5]
2 | ,-> background: url( 2 | ,-> background: url(
@ -144,3 +160,15 @@
4 | | "test.png" 4 | | "test.png"
5 | `-> ); 5 | `-> );
`---- `----
x ComponentValue
,-[$DIR/tests/recovery/function/bad-comment-2/input.css:5:5]
5 | );
: ^
`----
x Semi
,-[$DIR/tests/recovery/function/bad-comment-2/input.css:5:5]
5 | );
: ^
`----

View File

@ -88,23 +88,49 @@
}, },
"value": [ "value": [
{ {
"type": "Declaration", "type": "ListOfComponentValues",
"span": { "span": {
"start": 9, "start": 9,
"end": 67, "end": 68,
"ctxt": 0 "ctxt": 0
}, },
"name": { "children": [
"type": "Ident", {
"type": "PreservedToken",
"span": { "span": {
"start": 9, "start": 9,
"end": 19, "end": 19,
"ctxt": 0 "ctxt": 0
}, },
"token": {
"Ident": {
"value": "background", "value": "background",
"raw": "background" "raw": "background"
}
}
},
{
"type": "PreservedToken",
"span": {
"start": 19,
"end": 20,
"ctxt": 0
},
"token": "Colon"
},
{
"type": "PreservedToken",
"span": {
"start": 20,
"end": 21,
"ctxt": 0
},
"token": {
"WhiteSpace": {
"value": " "
}
}
}, },
"value": [
{ {
"type": "PreservedToken", "type": "PreservedToken",
"span": { "span": {
@ -120,9 +146,17 @@
"raw_value": "\n /* test */\n test.png\n " "raw_value": "\n /* test */\n test.png\n "
} }
} }
},
{
"type": "PreservedToken",
"span": {
"start": 67,
"end": 68,
"ctxt": 0
},
"token": "Semi"
} }
], ]
"important": null
} }
] ]
} }

View File

@ -6,3 +6,11 @@
4 | | test.png 4 | | test.png
5 | `-> ); 5 | `-> );
`---- `----
x Unexpected token in <declaration-value>
,-[$DIR/tests/recovery/function/bad-comment/input.css:2:5]
2 | ,-> background: url(
3 | | /* test */
4 | | test.png
5 | `-> );
`----

View File

@ -103,26 +103,42 @@
5 | `-> ); 5 | `-> );
`---- `----
x Declaration x ComponentValue
,-[$DIR/tests/recovery/function/bad-comment/input.css:2:5]
2 | ,-> background: url(
3 | | /* test */
4 | | test.png
5 | `-> );
`----
x DeclarationName
,-[$DIR/tests/recovery/function/bad-comment/input.css:2:5] ,-[$DIR/tests/recovery/function/bad-comment/input.css:2:5]
2 | background: url( 2 | background: url(
: ^^^^^^^^^^ : ^^^^^^^^^^
`---- `----
x Ident x Ident { value: Atom('background' type=dynamic), raw: Atom('background' type=dynamic) }
,-[$DIR/tests/recovery/function/bad-comment/input.css:2:5] ,-[$DIR/tests/recovery/function/bad-comment/input.css:2:5]
2 | background: url( 2 | background: url(
: ^^^^^^^^^^ : ^^^^^^^^^^
`---- `----
x ComponentValue
,-[$DIR/tests/recovery/function/bad-comment/input.css:2:5]
2 | background: url(
: ^
`----
x Colon
,-[$DIR/tests/recovery/function/bad-comment/input.css:2:5]
2 | background: url(
: ^
`----
x ComponentValue
,-[$DIR/tests/recovery/function/bad-comment/input.css:2:5]
2 | background: url(
: ^
`----
x WhiteSpace { value: Atom(' ' type=inline) }
,-[$DIR/tests/recovery/function/bad-comment/input.css:2:5]
2 | background: url(
: ^
`----
x ComponentValue x ComponentValue
,-[$DIR/tests/recovery/function/bad-comment/input.css:2:5] ,-[$DIR/tests/recovery/function/bad-comment/input.css:2:5]
2 | ,-> background: url( 2 | ,-> background: url(
@ -144,3 +160,15 @@
4 | | test.png 4 | | test.png
5 | `-> ); 5 | `-> );
`---- `----
x ComponentValue
,-[$DIR/tests/recovery/function/bad-comment/input.css:5:5]
5 | );
: ^
`----
x Semi
,-[$DIR/tests/recovery/function/bad-comment/input.css:5:5]
5 | );
: ^
`----

View File

@ -108,23 +108,49 @@
}, },
"value": [ "value": [
{ {
"type": "Declaration", "type": "ListOfComponentValues",
"span": { "span": {
"start": 17, "start": 17,
"end": 38, "end": 39,
"ctxt": 0 "ctxt": 0
}, },
"name": { "children": [
"type": "Ident", {
"type": "PreservedToken",
"span": { "span": {
"start": 17, "start": 17,
"end": 24, "end": 24,
"ctxt": 0 "ctxt": 0
}, },
"token": {
"Ident": {
"value": "content", "value": "content",
"raw": "content" "raw": "content"
}
}
},
{
"type": "PreservedToken",
"span": {
"start": 24,
"end": 25,
"ctxt": 0
},
"token": "Colon"
},
{
"type": "PreservedToken",
"span": {
"start": 25,
"end": 26,
"ctxt": 0
},
"token": {
"WhiteSpace": {
"value": " "
}
}
}, },
"value": [
{ {
"type": "PreservedToken", "type": "PreservedToken",
"span": { "span": {
@ -140,14 +166,31 @@
} }
}, },
{ {
"type": "Ident", "type": "PreservedToken",
"span": {
"start": 30,
"end": 35,
"ctxt": 0
},
"token": {
"WhiteSpace": {
"value": "\n "
}
}
},
{
"type": "PreservedToken",
"span": { "span": {
"start": 35, "start": 35,
"end": 36, "end": 36,
"ctxt": 0 "ctxt": 0
}, },
"token": {
"Ident": {
"value": "t", "value": "t",
"raw": "t" "raw": "t"
}
}
}, },
{ {
"type": "PreservedToken", "type": "PreservedToken",
@ -162,9 +205,21 @@
"raw": "\";" "raw": "\";"
} }
} }
},
{
"type": "PreservedToken",
"span": {
"start": 38,
"end": 39,
"ctxt": 0
},
"token": {
"WhiteSpace": {
"value": "\n"
} }
], }
"important": null }
]
} }
] ]
} }

View File

@ -24,3 +24,9 @@
: ^ : ^
4 | } 4 | }
`---- `----
x Unexpected token in <declaration-value>
,-[$DIR/tests/recovery/value/quotes/input.css:3:5]
3 | t";
: ^^
`----

View File

@ -101,32 +101,52 @@
,-[$DIR/tests/recovery/value/quotes/input.css:2:5] ,-[$DIR/tests/recovery/value/quotes/input.css:2:5]
2 | ,-> content: "tes 2 | ,-> content: "tes
3 | `-> t"; 3 | `-> t";
4 | }
`---- `----
x StyleBlock x StyleBlock
,-[$DIR/tests/recovery/value/quotes/input.css:2:5] ,-[$DIR/tests/recovery/value/quotes/input.css:2:5]
2 | ,-> content: "tes 2 | ,-> content: "tes
3 | `-> t"; 3 | `-> t";
4 | }
`---- `----
x Declaration x ComponentValue
,-[$DIR/tests/recovery/value/quotes/input.css:2:5]
2 | ,-> content: "tes
3 | `-> t";
`----
x DeclarationName
,-[$DIR/tests/recovery/value/quotes/input.css:2:5] ,-[$DIR/tests/recovery/value/quotes/input.css:2:5]
2 | content: "tes 2 | content: "tes
: ^^^^^^^ : ^^^^^^^
`---- `----
x Ident x Ident { value: Atom('content' type=static), raw: Atom('content' type=static) }
,-[$DIR/tests/recovery/value/quotes/input.css:2:5] ,-[$DIR/tests/recovery/value/quotes/input.css:2:5]
2 | content: "tes 2 | content: "tes
: ^^^^^^^ : ^^^^^^^
`---- `----
x ComponentValue
,-[$DIR/tests/recovery/value/quotes/input.css:2:5]
2 | content: "tes
: ^
`----
x Colon
,-[$DIR/tests/recovery/value/quotes/input.css:2:5]
2 | content: "tes
: ^
`----
x ComponentValue
,-[$DIR/tests/recovery/value/quotes/input.css:2:5]
2 | content: "tes
: ^
`----
x WhiteSpace { value: Atom(' ' type=inline) }
,-[$DIR/tests/recovery/value/quotes/input.css:2:5]
2 | content: "tes
: ^
`----
x ComponentValue x ComponentValue
,-[$DIR/tests/recovery/value/quotes/input.css:2:5] ,-[$DIR/tests/recovery/value/quotes/input.css:2:5]
2 | content: "tes 2 | content: "tes
@ -139,13 +159,26 @@
: ^^^^ : ^^^^
`---- `----
x ComponentValue
,-[$DIR/tests/recovery/value/quotes/input.css:2:5]
2 | ,-> content: "tes
3 | `-> t";
`----
x WhiteSpace { value: Atom('
| ' type=inline) }
,-[$DIR/tests/recovery/value/quotes/input.css:2:5]
2 | ,-> content: "tes
3 | `-> t";
`----
x ComponentValue x ComponentValue
,-[$DIR/tests/recovery/value/quotes/input.css:3:5] ,-[$DIR/tests/recovery/value/quotes/input.css:3:5]
3 | t"; 3 | t";
: ^ : ^
`---- `----
x Ident x Ident { value: Atom('t' type=inline), raw: Atom('t' type=inline) }
,-[$DIR/tests/recovery/value/quotes/input.css:3:5] ,-[$DIR/tests/recovery/value/quotes/input.css:3:5]
3 | t"; 3 | t";
: ^ : ^
@ -162,3 +195,18 @@
3 | t"; 3 | t";
: ^^ : ^^
`---- `----
x ComponentValue
,-[$DIR/tests/recovery/value/quotes/input.css:3:5]
3 | t";
: ^
4 | }
`----
x WhiteSpace { value: Atom('
| ' type=inline) }
,-[$DIR/tests/recovery/value/quotes/input.css:3:5]
3 | t";
: ^
4 | }
`----

View File

@ -88,23 +88,49 @@
}, },
"value": [ "value": [
{ {
"type": "Declaration", "type": "ListOfComponentValues",
"span": { "span": {
"start": 9, "start": 9,
"end": 16, "end": 17,
"ctxt": 0 "ctxt": 0
}, },
"name": { "children": [
"type": "Ident", {
"type": "PreservedToken",
"span": { "span": {
"start": 9, "start": 9,
"end": 13, "end": 13,
"ctxt": 0 "ctxt": 0
}, },
"token": {
"Ident": {
"value": "prop", "value": "prop",
"raw": "prop" "raw": "prop"
}
}
},
{
"type": "PreservedToken",
"span": {
"start": 13,
"end": 14,
"ctxt": 0
},
"token": "Colon"
},
{
"type": "PreservedToken",
"span": {
"start": 14,
"end": 15,
"ctxt": 0
},
"token": {
"WhiteSpace": {
"value": " "
}
}
}, },
"value": [
{ {
"type": "PreservedToken", "type": "PreservedToken",
"span": { "span": {
@ -118,9 +144,21 @@
"raw": "\"" "raw": "\""
} }
} }
},
{
"type": "PreservedToken",
"span": {
"start": 16,
"end": 17,
"ctxt": 0
},
"token": {
"WhiteSpace": {
"value": "\n"
} }
], }
"important": null }
]
} }
] ]
} }

View File

@ -16,3 +16,9 @@
2 | 2 |
: ^ : ^
`---- `----
x Unexpected token in <declaration-value>
,-[$DIR/tests/recovery/value/string/newline/input.css:2:5]
2 | prop: "
: ^
`----

View File

@ -74,28 +74,22 @@
x ComponentValue x ComponentValue
,-[$DIR/tests/recovery/value/string/newline/input.css:2:5] ,-[$DIR/tests/recovery/value/string/newline/input.css:2:5]
2 | prop: " 2 | prop: "
: ^^^^^^^ : ^^^^^^^^
`---- `----
x StyleBlock x StyleBlock
,-[$DIR/tests/recovery/value/string/newline/input.css:2:5] ,-[$DIR/tests/recovery/value/string/newline/input.css:2:5]
2 | prop: " 2 | prop: "
: ^^^^^^^ : ^^^^^^^^
`---- `----
x Declaration x ComponentValue
,-[$DIR/tests/recovery/value/string/newline/input.css:2:5]
2 | prop: "
: ^^^^^^^
`----
x DeclarationName
,-[$DIR/tests/recovery/value/string/newline/input.css:2:5] ,-[$DIR/tests/recovery/value/string/newline/input.css:2:5]
2 | prop: " 2 | prop: "
: ^^^^ : ^^^^
`---- `----
x Ident x Ident { value: Atom('prop' type=inline), raw: Atom('prop' 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: "
: ^^^^ : ^^^^
@ -107,8 +101,45 @@
: ^ : ^
`---- `----
x Colon
,-[$DIR/tests/recovery/value/string/newline/input.css:2:5]
2 | prop: "
: ^
`----
x ComponentValue
,-[$DIR/tests/recovery/value/string/newline/input.css:2:5]
2 | prop: "
: ^
`----
x WhiteSpace { value: Atom(' ' type=inline) }
,-[$DIR/tests/recovery/value/string/newline/input.css:2:5]
2 | prop: "
: ^
`----
x ComponentValue
,-[$DIR/tests/recovery/value/string/newline/input.css:2:5]
2 | prop: "
: ^
`----
x BadString { value: Atom('' type=static), raw: Atom('"' type=inline) } x BadString { value: Atom('' type=static), raw: 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: "
: ^ : ^
`---- `----
x ComponentValue
,-[$DIR/tests/recovery/value/string/newline/input.css:2:5]
2 | prop: "
: ^
`----
x WhiteSpace { value: Atom('
| ' type=inline) }
,-[$DIR/tests/recovery/value/string/newline/input.css:2:5]
2 | prop: "
: ^
`----

View File

@ -123,23 +123,49 @@
"important": null "important": null
}, },
{ {
"type": "Declaration", "type": "ListOfComponentValues",
"span": { "span": {
"start": 60, "start": 60,
"end": 86, "end": 88,
"ctxt": 0 "ctxt": 0
}, },
"name": { "children": [
"type": "Ident", {
"type": "PreservedToken",
"span": { "span": {
"start": 60, "start": 60,
"end": 70, "end": 70,
"ctxt": 0 "ctxt": 0
}, },
"token": {
"Ident": {
"value": "background", "value": "background",
"raw": "background" "raw": "background"
}
}
},
{
"type": "PreservedToken",
"span": {
"start": 70,
"end": 71,
"ctxt": 0
},
"token": "Colon"
},
{
"type": "PreservedToken",
"span": {
"start": 71,
"end": 72,
"ctxt": 0
},
"token": {
"WhiteSpace": {
"value": " "
}
}
}, },
"value": [
{ {
"type": "PreservedToken", "type": "PreservedToken",
"span": { "span": {
@ -155,18 +181,7 @@
"raw_value": "var(--foo" "raw_value": "var(--foo"
} }
} }
}
],
"important": null
}, },
{
"type": "ListOfComponentValues",
"span": {
"start": 86,
"end": 88,
"ctxt": 0
},
"children": [
{ {
"type": "PreservedToken", "type": "PreservedToken",
"span": { "span": {
@ -556,23 +571,49 @@
}, },
"value": [ "value": [
{ {
"type": "Declaration", "type": "ListOfComponentValues",
"span": { "span": {
"start": 305, "start": 305,
"end": 347, "end": 350,
"ctxt": 0 "ctxt": 0
}, },
"name": { "children": [
"type": "Ident", {
"type": "PreservedToken",
"span": { "span": {
"start": 305, "start": 305,
"end": 315, "end": 315,
"ctxt": 0 "ctxt": 0
}, },
"token": {
"Ident": {
"value": "background", "value": "background",
"raw": "background" "raw": "background"
}
}
},
{
"type": "PreservedToken",
"span": {
"start": 315,
"end": 316,
"ctxt": 0
},
"token": "Colon"
},
{
"type": "PreservedToken",
"span": {
"start": 316,
"end": 317,
"ctxt": 0
},
"token": {
"WhiteSpace": {
"value": " "
}
}
}, },
"value": [
{ {
"type": "PreservedToken", "type": "PreservedToken",
"span": { "span": {
@ -588,18 +629,7 @@
"raw_value": "image.png param(var(--url" "raw_value": "image.png param(var(--url"
} }
} }
}
],
"important": null
}, },
{
"type": "ListOfComponentValues",
"span": {
"start": 347,
"end": 350,
"ctxt": 0
},
"children": [
{ {
"type": "PreservedToken", "type": "PreservedToken",
"span": { "span": {

View File

@ -17,20 +17,20 @@
: ^ : ^
`---- `----
x Expected whitespace, semicolon, EOF, at-keyword or ident token
,-[$DIR/tests/recovery/value/url/basic/input.css:3:5]
3 | background: url(var(--foo));
: ^
`----
x Expected whitespace, semicolon, EOF, at-keyword or ident token
,-[$DIR/tests/recovery/value/url/basic/input.css:13:5]
13 | background: url(image.png param(var(--url)));
: ^
`----
x Unexpected character in url x Unexpected character in url
,-[$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));
: ^ : ^
`---- `----
x Unexpected token in <declaration-value>
,-[$DIR/tests/recovery/value/url/basic/input.css:3:5]
3 | background: url(var(--foo));
: ^^^^^^^^^^^^^^
`----
x Unexpected token in <declaration-value>
,-[$DIR/tests/recovery/value/url/basic/input.css:13:5]
13 | background: url(image.png param(var(--url)));
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`----

View File

@ -156,33 +156,51 @@
x ComponentValue x ComponentValue
,-[$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));
: ^^^^^^^^^^^^^^^^^^^^^^^^^^ : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`---- `----
x StyleBlock x StyleBlock
,-[$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));
: ^^^^^^^^^^^^^^^^^^^^^^^^^^ : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`---- `----
x Declaration x ComponentValue
,-[$DIR/tests/recovery/value/url/basic/input.css:3:5]
3 | background: url(var(--foo));
: ^^^^^^^^^^^^^^^^^^^^^^^^^^
`----
x DeclarationName
,-[$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));
: ^^^^^^^^^^ : ^^^^^^^^^^
`---- `----
x Ident x Ident { value: Atom('background' type=dynamic), raw: Atom('background' 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));
: ^^^^^^^^^^ : ^^^^^^^^^^
`---- `----
x ComponentValue
,-[$DIR/tests/recovery/value/url/basic/input.css:3:5]
3 | background: url(var(--foo));
: ^
`----
x Colon
,-[$DIR/tests/recovery/value/url/basic/input.css:3:5]
3 | background: url(var(--foo));
: ^
`----
x ComponentValue
,-[$DIR/tests/recovery/value/url/basic/input.css:3:5]
3 | background: url(var(--foo));
: ^
`----
x WhiteSpace { value: Atom(' ' type=inline) }
,-[$DIR/tests/recovery/value/url/basic/input.css:3:5]
3 | background: url(var(--foo));
: ^
`----
x ComponentValue x ComponentValue
,-[$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));
@ -195,18 +213,6 @@
: ^^^^^^^^^^^^^^ : ^^^^^^^^^^^^^^
`---- `----
x ComponentValue
,-[$DIR/tests/recovery/value/url/basic/input.css:3:5]
3 | background: url(var(--foo));
: ^^
`----
x StyleBlock
,-[$DIR/tests/recovery/value/url/basic/input.css:3:5]
3 | background: url(var(--foo));
: ^^
`----
x ComponentValue x ComponentValue
,-[$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));
@ -639,33 +645,51 @@
x ComponentValue x ComponentValue
,-[$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)));
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`---- `----
x StyleBlock x StyleBlock
,-[$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)));
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`---- `----
x Declaration x ComponentValue
,-[$DIR/tests/recovery/value/url/basic/input.css:13:5]
13 | background: url(image.png param(var(--url)));
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`----
x DeclarationName
,-[$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)));
: ^^^^^^^^^^ : ^^^^^^^^^^
`---- `----
x Ident x Ident { value: Atom('background' type=dynamic), raw: Atom('background' 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)));
: ^^^^^^^^^^ : ^^^^^^^^^^
`---- `----
x ComponentValue
,-[$DIR/tests/recovery/value/url/basic/input.css:13:5]
13 | background: url(image.png param(var(--url)));
: ^
`----
x Colon
,-[$DIR/tests/recovery/value/url/basic/input.css:13:5]
13 | background: url(image.png param(var(--url)));
: ^
`----
x ComponentValue
,-[$DIR/tests/recovery/value/url/basic/input.css:13:5]
13 | background: url(image.png param(var(--url)));
: ^
`----
x WhiteSpace { value: Atom(' ' type=inline) }
,-[$DIR/tests/recovery/value/url/basic/input.css:13:5]
13 | background: url(image.png param(var(--url)));
: ^
`----
x ComponentValue x ComponentValue
,-[$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)));
@ -678,18 +702,6 @@
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`---- `----
x ComponentValue
,-[$DIR/tests/recovery/value/url/basic/input.css:13:5]
13 | background: url(image.png param(var(--url)));
: ^^^
`----
x StyleBlock
,-[$DIR/tests/recovery/value/url/basic/input.css:13:5]
13 | background: url(image.png param(var(--url)));
: ^^^
`----
x ComponentValue x ComponentValue
,-[$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

@ -88,23 +88,49 @@
}, },
"value": [ "value": [
{ {
"type": "Declaration", "type": "ListOfComponentValues",
"span": { "span": {
"start": 9, "start": 9,
"end": 34, "end": 34,
"ctxt": 0 "ctxt": 0
}, },
"name": { "children": [
"type": "Ident", {
"type": "PreservedToken",
"span": { "span": {
"start": 9, "start": 9,
"end": 19, "end": 19,
"ctxt": 0 "ctxt": 0
}, },
"token": {
"Ident": {
"value": "background", "value": "background",
"raw": "background" "raw": "background"
}
}
},
{
"type": "PreservedToken",
"span": {
"start": 19,
"end": 20,
"ctxt": 0
},
"token": "Colon"
},
{
"type": "PreservedToken",
"span": {
"start": 20,
"end": 21,
"ctxt": 0
},
"token": {
"WhiteSpace": {
"value": " "
}
}
}, },
"value": [
{ {
"type": "PreservedToken", "type": "PreservedToken",
"span": { "span": {
@ -121,8 +147,7 @@
} }
} }
} }
], ]
"important": null
} }
] ]
} }

View File

@ -10,3 +10,9 @@
3 | } 3 | }
: ^ : ^
`---- `----
x Unexpected token in <declaration-value>
,-[$DIR/tests/recovery/value/url/parenthesis/input.css:2:5]
2 | ,-> background: url(test\);
3 | `-> }
`----

View File

@ -87,24 +87,42 @@
3 | `-> } 3 | `-> }
`---- `----
x Declaration x ComponentValue
,-[$DIR/tests/recovery/value/url/parenthesis/input.css:2:5]
2 | ,-> background: url(test\);
3 | `-> }
`----
x DeclarationName
,-[$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\);
: ^^^^^^^^^^ : ^^^^^^^^^^
`---- `----
x Ident x Ident { value: Atom('background' type=dynamic), raw: Atom('background' 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\);
: ^^^^^^^^^^ : ^^^^^^^^^^
`---- `----
x ComponentValue
,-[$DIR/tests/recovery/value/url/parenthesis/input.css:2:5]
2 | background: url(test\);
: ^
`----
x Colon
,-[$DIR/tests/recovery/value/url/parenthesis/input.css:2:5]
2 | background: url(test\);
: ^
`----
x ComponentValue
,-[$DIR/tests/recovery/value/url/parenthesis/input.css:2:5]
2 | background: url(test\);
: ^
`----
x WhiteSpace { value: Atom(' ' type=inline) }
,-[$DIR/tests/recovery/value/url/parenthesis/input.css:2:5]
2 | background: url(test\);
: ^
`----
x ComponentValue x ComponentValue
,-[$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

@ -106,19 +106,19 @@
x ComponentValue x ComponentValue
,-[$DIR/tests/recovery/whitespaces/input.css:2:5] ,-[$DIR/tests/recovery/whitespaces/input.css:2:5]
2 | prop: ; 2 | prop: ;
: ^^^^^^^ : ^^^^^^
`---- `----
x StyleBlock x StyleBlock
,-[$DIR/tests/recovery/whitespaces/input.css:2:5] ,-[$DIR/tests/recovery/whitespaces/input.css:2:5]
2 | prop: ; 2 | prop: ;
: ^^^^^^^ : ^^^^^^
`---- `----
x Declaration x Declaration
,-[$DIR/tests/recovery/whitespaces/input.css:2:5] ,-[$DIR/tests/recovery/whitespaces/input.css:2:5]
2 | prop: ; 2 | prop: ;
: ^^^^^^^ : ^^^^^^
`---- `----
x DeclarationName x DeclarationName
@ -136,19 +136,19 @@
x ComponentValue x ComponentValue
,-[$DIR/tests/recovery/whitespaces/input.css:3:5] ,-[$DIR/tests/recovery/whitespaces/input.css:3:5]
3 | prop: ; 3 | prop: ;
: ^^^^^^^^^^ : ^^^^^^^^^
`---- `----
x StyleBlock x StyleBlock
,-[$DIR/tests/recovery/whitespaces/input.css:3:5] ,-[$DIR/tests/recovery/whitespaces/input.css:3:5]
3 | prop: ; 3 | prop: ;
: ^^^^^^^^^^ : ^^^^^^^^^
`---- `----
x Declaration x Declaration
,-[$DIR/tests/recovery/whitespaces/input.css:3:5] ,-[$DIR/tests/recovery/whitespaces/input.css:3:5]
3 | prop: ; 3 | prop: ;
: ^^^^^^^^^^ : ^^^^^^^^^
`---- `----
x DeclarationName x DeclarationName
@ -166,22 +166,22 @@
x ComponentValue x ComponentValue
,-[$DIR/tests/recovery/whitespaces/input.css:4:5] ,-[$DIR/tests/recovery/whitespaces/input.css:4:5]
4 | ,-> prop: 4 | ,-> prop:
5 | | 5 | `->
6 | `-> ; 6 | ;
`---- `----
x StyleBlock x StyleBlock
,-[$DIR/tests/recovery/whitespaces/input.css:4:5] ,-[$DIR/tests/recovery/whitespaces/input.css:4:5]
4 | ,-> prop: 4 | ,-> prop:
5 | | 5 | `->
6 | `-> ; 6 | ;
`---- `----
x Declaration x Declaration
,-[$DIR/tests/recovery/whitespaces/input.css:4:5] ,-[$DIR/tests/recovery/whitespaces/input.css:4:5]
4 | ,-> prop: 4 | ,-> prop:
5 | | 5 | `->
6 | `-> ; 6 | ;
`---- `----
x DeclarationName x DeclarationName