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\"');
}
.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 {
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::UnexpectedChar(c) => format!("Unexpected character `{:?}`", c).into(),
ErrorKind::Expected(s) => format!("Expected {}", s).into(),
ErrorKind::Unexpected(s) => format!("Unexpected {}", s).into(),
ErrorKind::ExpectedButGot(s) => format!("Expected {}", s).into(),
ErrorKind::ExpectedSelectorText => "Expected a text for selector".into(),
ErrorKind::UnterminatedBlockComment => "Unterminated block comment".into(),
@ -91,6 +92,7 @@ pub enum ErrorKind {
Ignore,
UnexpectedChar(char),
Expected(&'static str),
Unexpected(&'static str),
ExpectedButGot(&'static str),
ExpectedSelectorText,
UnterminatedBlockComment,

View File

@ -1,4 +1,4 @@
use swc_common::Span;
use swc_common::{Span, Spanned};
use swc_css_ast::*;
use super::{input::ParserInput, PResult, Parser};
@ -252,19 +252,33 @@ where
// <semicolon-token>
// Do nothing.
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>
// Reconsume the current input token. Consume an at-rule, and append the result to
// rules.
tok!("@") => {
let ctx = Ctx {
block_contents_grammar: BlockContentsGrammar::StyleBlock,
..self.ctx
};
rules.push(StyleBlock::AtRule(Box::new(
self.with_ctx(ctx).parse_as::<AtRule>()?,
self.with_ctx(Ctx {
block_contents_grammar: BlockContentsGrammar::StyleBlock,
..self.ctx
})
.parse_as::<AtRule>()?,
)));
}
// <ident-token>
@ -276,11 +290,12 @@ where
tok!("ident") => {
if self.config.legacy_nesting {
let state = self.input.state();
let ctx = Ctx {
is_trying_legacy_nesting: true,
..self.ctx
};
let legacy_nested = self.with_ctx(ctx).parse_as::<QualifiedRule>();
let legacy_nested = self
.with_ctx(Ctx {
is_trying_legacy_nesting: true,
..self.ctx
})
.parse_as::<QualifiedRule>();
match legacy_nested {
Ok(legacy_nested) => {
@ -294,39 +309,36 @@ where
};
}
let state = self.input.state();
let prop = match self.parse() {
Ok(v) => StyleBlock::Declaration(v),
Err(err) => {
self.errors.push(err);
self.input.reset(&state);
let span = self.input.cur_span();
let mut children = vec![];
while !is_one_of!(self, EOF) {
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,
})
}
let span = self.input.cur_span();
let mut temporary_list = ListOfComponentValues {
span: Default::default(),
children: vec![],
};
declarations.push(prop);
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) => {
self.errors.push(err);
temporary_list.span = span!(self, span.lo);
StyleBlock::ListOfComponentValues(temporary_list)
}
};
declarations.push(decl_or_list_of_component_values);
}
// <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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -10,3 +10,9 @@
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
,-[$DIR/tests/recovery/bad-url-token/double-quotes/input.css:2:5]
2 | background: url(image".png);
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`----
x StyleBlock
,-[$DIR/tests/recovery/bad-url-token/double-quotes/input.css:2:5]
2 | background: url(image".png);
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`----
x Declaration
,-[$DIR/tests/recovery/bad-url-token/double-quotes/input.css:2:5]
2 | background: url(image".png);
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^
`----
x DeclarationName
x ComponentValue
,-[$DIR/tests/recovery/bad-url-token/double-quotes/input.css:2:5]
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]
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
,-[$DIR/tests/recovery/bad-url-token/double-quotes/input.css:2:5]
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
,-[$DIR/tests/recovery/bad-url-token/double-quotes/input.css:3:5]
3 | color: red;

View File

@ -88,23 +88,49 @@
},
"value": [
{
"type": "Declaration",
"type": "ListOfComponentValues",
"span": {
"start": 11,
"end": 43,
"end": 44,
"ctxt": 0
},
"name": {
"type": "Ident",
"span": {
"start": 11,
"end": 21,
"ctxt": 0
"children": [
{
"type": "PreservedToken",
"span": {
"start": 11,
"end": 21,
"ctxt": 0
},
"token": {
"Ident": {
"value": "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": "background",
"raw": "background"
},
"value": [
{
"type": "PreservedToken",
"span": {
@ -120,9 +146,17 @@
"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\
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 | `-> );
`----
x Declaration
,-[$DIR/tests/recovery/bad-url-token/invalid-escape/input.css:2:5]
2 | ,-> background: url(image.png\
3 | `-> );
`----
x DeclarationName
x ComponentValue
,-[$DIR/tests/recovery/bad-url-token/invalid-escape/input.css:2:5]
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]
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
,-[$DIR/tests/recovery/bad-url-token/invalid-escape/input.css:2:5]
2 | ,-> background: url(image.png\
@ -122,3 +140,15 @@
2 | ,-> background: url(image.png\
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": [
{
"type": "Declaration",
"type": "ListOfComponentValues",
"span": {
"start": 11,
"end": 38,
"end": 39,
"ctxt": 0
},
"name": {
"type": "Ident",
"span": {
"start": 11,
"end": 21,
"ctxt": 0
"children": [
{
"type": "PreservedToken",
"span": {
"start": 11,
"end": 21,
"ctxt": 0
},
"token": {
"Ident": {
"value": "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": "background",
"raw": "background"
},
"value": [
{
"type": "PreservedToken",
"span": {
@ -120,9 +146,17 @@
"raw_value": "image(.png"
}
}
},
{
"type": "PreservedToken",
"span": {
"start": 38,
"end": 39,
"ctxt": 0
},
"token": "Semi"
}
],
"important": null
]
},
{
"type": "Declaration",

View File

@ -10,3 +10,9 @@
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
,-[$DIR/tests/recovery/bad-url-token/left-parenthesis/input.css:2:5]
2 | background: url(image(.png);
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`----
x StyleBlock
,-[$DIR/tests/recovery/bad-url-token/left-parenthesis/input.css:2:5]
2 | background: url(image(.png);
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`----
x Declaration
,-[$DIR/tests/recovery/bad-url-token/left-parenthesis/input.css:2:5]
2 | background: url(image(.png);
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^
`----
x DeclarationName
x ComponentValue
,-[$DIR/tests/recovery/bad-url-token/left-parenthesis/input.css:2:5]
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]
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
,-[$DIR/tests/recovery/bad-url-token/left-parenthesis/input.css:2:5]
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
,-[$DIR/tests/recovery/bad-url-token/left-parenthesis/input.css:3:5]
3 | color: red;

View File

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

View File

@ -10,3 +10,9 @@
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
,-[$DIR/tests/recovery/bad-url-token/single-quotes/input.css:2:5]
2 | background: url(image'.png);
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`----
x StyleBlock
,-[$DIR/tests/recovery/bad-url-token/single-quotes/input.css:2:5]
2 | background: url(image'.png);
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`----
x Declaration
,-[$DIR/tests/recovery/bad-url-token/single-quotes/input.css:2:5]
2 | background: url(image'.png);
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^
`----
x DeclarationName
x ComponentValue
,-[$DIR/tests/recovery/bad-url-token/single-quotes/input.css:2:5]
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]
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
,-[$DIR/tests/recovery/bad-url-token/single-quotes/input.css:2:5]
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
,-[$DIR/tests/recovery/bad-url-token/single-quotes/input.css:3:5]
3 | color: red;

View File

@ -88,23 +88,49 @@
},
"value": [
{
"type": "Declaration",
"type": "ListOfComponentValues",
"span": {
"start": 9,
"end": 51,
"end": 52,
"ctxt": 0
},
"name": {
"type": "Ident",
"span": {
"start": 9,
"end": 25,
"ctxt": 0
"children": [
{
"type": "PreservedToken",
"span": {
"start": 9,
"end": 25,
"ctxt": 0
},
"token": {
"Ident": {
"value": "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": "background-image",
"raw": "background-image"
},
"value": [
{
"type": "PreservedToken",
"span": {
@ -120,9 +146,17 @@
"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 );
: ^^^^^^^^^^^^^^^^^^^^^^^^
`----
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
,-[$DIR/tests/recovery/bad-url-token/whitespace-in-middle/input.css:2:5]
2 | background-image: url( ./image.jpg a );
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`----
x StyleBlock
,-[$DIR/tests/recovery/bad-url-token/whitespace-in-middle/input.css:2:5]
2 | background-image: url( ./image.jpg a );
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`----
x Declaration
,-[$DIR/tests/recovery/bad-url-token/whitespace-in-middle/input.css:2:5]
2 | background-image: url( ./image.jpg a );
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`----
x DeclarationName
x ComponentValue
,-[$DIR/tests/recovery/bad-url-token/whitespace-in-middle/input.css:2:5]
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]
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
,-[$DIR/tests/recovery/bad-url-token/whitespace-in-middle/input.css:2:5]
2 | background-image: url( ./image.jpg a );
@ -116,3 +134,15 @@
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": [
{
"type": "Declaration",
"type": "ListOfComponentValues",
"span": {
"start": 11,
"end": 42,
"end": 43,
"ctxt": 0
},
"name": {
"type": "Ident",
"span": {
"start": 11,
"end": 21,
"ctxt": 0
"children": [
{
"type": "PreservedToken",
"span": {
"start": 11,
"end": 21,
"ctxt": 0
},
"token": {
"Ident": {
"value": "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": "background",
"raw": "background"
},
"value": [
{
"type": "PreservedToken",
"span": {
@ -120,9 +146,17 @@
"raw_value": "image.\n png"
}
}
},
{
"type": "PreservedToken",
"span": {
"start": 42,
"end": 43,
"ctxt": 0
},
"token": "Semi"
}
],
"important": null
]
},
{
"type": "Declaration",

View File

@ -4,3 +4,9 @@
2 | ,-> background: url(image.
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);
`----
x Declaration
,-[$DIR/tests/recovery/bad-url-token/whitespace/input.css:2:5]
2 | ,-> background: url(image.
3 | `-> png);
`----
x DeclarationName
x ComponentValue
,-[$DIR/tests/recovery/bad-url-token/whitespace/input.css:2:5]
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]
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
,-[$DIR/tests/recovery/bad-url-token/whitespace/input.css:2:5]
2 | ,-> background: url(image.
@ -127,6 +145,18 @@
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
,-[$DIR/tests/recovery/bad-url-token/whitespace/input.css:4:5]
4 | color: red;

View File

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

View File

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

View File

@ -88,23 +88,49 @@
},
"value": [
{
"type": "Declaration",
"type": "ListOfComponentValues",
"span": {
"start": 9,
"end": 69,
"end": 70,
"ctxt": 0
},
"name": {
"type": "Ident",
"span": {
"start": 9,
"end": 19,
"ctxt": 0
"children": [
{
"type": "PreservedToken",
"span": {
"start": 9,
"end": 19,
"ctxt": 0
},
"token": {
"Ident": {
"value": "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": "background",
"raw": "background"
},
"value": [
{
"type": "PreservedToken",
"span": {
@ -120,9 +146,17 @@
"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"
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 | `-> );
`----
x Declaration
,-[$DIR/tests/recovery/function/bad-comment-2/input.css:2:5]
2 | ,-> background: url(
3 | | /* test */
4 | | "test.png"
5 | `-> );
`----
x DeclarationName
x ComponentValue
,-[$DIR/tests/recovery/function/bad-comment-2/input.css:2:5]
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]
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
,-[$DIR/tests/recovery/function/bad-comment-2/input.css:2:5]
2 | ,-> background: url(
@ -144,3 +160,15 @@
4 | | "test.png"
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": [
{
"type": "Declaration",
"type": "ListOfComponentValues",
"span": {
"start": 9,
"end": 67,
"end": 68,
"ctxt": 0
},
"name": {
"type": "Ident",
"span": {
"start": 9,
"end": 19,
"ctxt": 0
"children": [
{
"type": "PreservedToken",
"span": {
"start": 9,
"end": 19,
"ctxt": 0
},
"token": {
"Ident": {
"value": "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": "background",
"raw": "background"
},
"value": [
{
"type": "PreservedToken",
"span": {
@ -120,9 +146,17 @@
"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
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 | `-> );
`----
x Declaration
,-[$DIR/tests/recovery/function/bad-comment/input.css:2:5]
2 | ,-> background: url(
3 | | /* test */
4 | | test.png
5 | `-> );
`----
x DeclarationName
x ComponentValue
,-[$DIR/tests/recovery/function/bad-comment/input.css:2:5]
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]
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
,-[$DIR/tests/recovery/function/bad-comment/input.css:2:5]
2 | ,-> background: url(
@ -144,3 +160,15 @@
4 | | test.png
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": [
{
"type": "Declaration",
"type": "ListOfComponentValues",
"span": {
"start": 17,
"end": 38,
"end": 39,
"ctxt": 0
},
"name": {
"type": "Ident",
"span": {
"start": 17,
"end": 24,
"ctxt": 0
"children": [
{
"type": "PreservedToken",
"span": {
"start": 17,
"end": 24,
"ctxt": 0
},
"token": {
"Ident": {
"value": "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": "content",
"raw": "content"
},
"value": [
{
"type": "PreservedToken",
"span": {
@ -140,14 +166,31 @@
}
},
{
"type": "Ident",
"type": "PreservedToken",
"span": {
"start": 30,
"end": 35,
"ctxt": 0
},
"token": {
"WhiteSpace": {
"value": "\n "
}
}
},
{
"type": "PreservedToken",
"span": {
"start": 35,
"end": 36,
"ctxt": 0
},
"value": "t",
"raw": "t"
"token": {
"Ident": {
"value": "t",
"raw": "t"
}
}
},
{
"type": "PreservedToken",
@ -162,9 +205,21 @@
"raw": "\";"
}
}
},
{
"type": "PreservedToken",
"span": {
"start": 38,
"end": 39,
"ctxt": 0
},
"token": {
"WhiteSpace": {
"value": "\n"
}
}
}
],
"important": null
]
}
]
}

View File

@ -24,3 +24,9 @@
: ^
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]
2 | ,-> content: "tes
3 | `-> t";
4 | }
`----
x StyleBlock
,-[$DIR/tests/recovery/value/quotes/input.css:2:5]
2 | ,-> content: "tes
3 | `-> t";
4 | }
`----
x Declaration
,-[$DIR/tests/recovery/value/quotes/input.css:2:5]
2 | ,-> content: "tes
3 | `-> t";
`----
x DeclarationName
x ComponentValue
,-[$DIR/tests/recovery/value/quotes/input.css:2:5]
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]
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
,-[$DIR/tests/recovery/value/quotes/input.css:2:5]
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
,-[$DIR/tests/recovery/value/quotes/input.css:3:5]
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]
3 | t";
: ^
@ -162,3 +195,18 @@
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": [
{
"type": "Declaration",
"type": "ListOfComponentValues",
"span": {
"start": 9,
"end": 16,
"end": 17,
"ctxt": 0
},
"name": {
"type": "Ident",
"span": {
"start": 9,
"end": 13,
"ctxt": 0
"children": [
{
"type": "PreservedToken",
"span": {
"start": 9,
"end": 13,
"ctxt": 0
},
"token": {
"Ident": {
"value": "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": "prop",
"raw": "prop"
},
"value": [
{
"type": "PreservedToken",
"span": {
@ -118,9 +144,21 @@
"raw": "\""
}
}
},
{
"type": "PreservedToken",
"span": {
"start": 16,
"end": 17,
"ctxt": 0
},
"token": {
"WhiteSpace": {
"value": "\n"
}
}
}
],
"important": null
]
}
]
}

View File

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

View File

@ -74,33 +74,51 @@
x ComponentValue
,-[$DIR/tests/recovery/value/string/newline/input.css:2:5]
2 | prop: "
: ^^^^^^^
: ^^^^^^^^
`----
x StyleBlock
,-[$DIR/tests/recovery/value/string/newline/input.css:2:5]
2 | prop: "
: ^^^^^^^
: ^^^^^^^^
`----
x Declaration
,-[$DIR/tests/recovery/value/string/newline/input.css:2:5]
2 | prop: "
: ^^^^^^^
`----
x DeclarationName
x ComponentValue
,-[$DIR/tests/recovery/value/string/newline/input.css:2:5]
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]
2 | prop: "
: ^^^^
`----
x ComponentValue
,-[$DIR/tests/recovery/value/string/newline/input.css:2:5]
2 | prop: "
: ^
`----
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: "
@ -112,3 +130,16 @@
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
},
{
"type": "Declaration",
"type": "ListOfComponentValues",
"span": {
"start": 60,
"end": 86,
"end": 88,
"ctxt": 0
},
"name": {
"type": "Ident",
"span": {
"start": 60,
"end": 70,
"ctxt": 0
"children": [
{
"type": "PreservedToken",
"span": {
"start": 60,
"end": 70,
"ctxt": 0
},
"token": {
"Ident": {
"value": "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": "background",
"raw": "background"
},
"value": [
{
"type": "PreservedToken",
"span": {
@ -155,18 +181,7 @@
"raw_value": "var(--foo"
}
}
}
],
"important": null
},
{
"type": "ListOfComponentValues",
"span": {
"start": 86,
"end": 88,
"ctxt": 0
},
"children": [
},
{
"type": "PreservedToken",
"span": {
@ -556,23 +571,49 @@
},
"value": [
{
"type": "Declaration",
"type": "ListOfComponentValues",
"span": {
"start": 305,
"end": 347,
"end": 350,
"ctxt": 0
},
"name": {
"type": "Ident",
"span": {
"start": 305,
"end": 315,
"ctxt": 0
"children": [
{
"type": "PreservedToken",
"span": {
"start": 305,
"end": 315,
"ctxt": 0
},
"token": {
"Ident": {
"value": "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": "background",
"raw": "background"
},
"value": [
{
"type": "PreservedToken",
"span": {
@ -588,18 +629,7 @@
"raw_value": "image.png param(var(--url"
}
}
}
],
"important": null
},
{
"type": "ListOfComponentValues",
"span": {
"start": 347,
"end": 350,
"ctxt": 0
},
"children": [
},
{
"type": "PreservedToken",
"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
,-[$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: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
,-[$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 Declaration
,-[$DIR/tests/recovery/value/url/basic/input.css:3:5]
3 | background: url(var(--foo));
: ^^^^^^^^^^^^^^^^^^^^^^^^^^
`----
x DeclarationName
x ComponentValue
,-[$DIR/tests/recovery/value/url/basic/input.css:3:5]
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]
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
,-[$DIR/tests/recovery/value/url/basic/input.css:3:5]
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
,-[$DIR/tests/recovery/value/url/basic/input.css:3:5]
3 | background: url(var(--foo));
@ -639,33 +645,51 @@
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 Declaration
,-[$DIR/tests/recovery/value/url/basic/input.css:13:5]
13 | background: url(image.png param(var(--url)));
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`----
x DeclarationName
x ComponentValue
,-[$DIR/tests/recovery/value/url/basic/input.css:13:5]
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]
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
,-[$DIR/tests/recovery/value/url/basic/input.css:13:5]
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
,-[$DIR/tests/recovery/value/url/basic/input.css:13:5]
13 | background: url(image.png param(var(--url)));

View File

@ -88,23 +88,49 @@
},
"value": [
{
"type": "Declaration",
"type": "ListOfComponentValues",
"span": {
"start": 9,
"end": 34,
"ctxt": 0
},
"name": {
"type": "Ident",
"span": {
"start": 9,
"end": 19,
"ctxt": 0
"children": [
{
"type": "PreservedToken",
"span": {
"start": 9,
"end": 19,
"ctxt": 0
},
"token": {
"Ident": {
"value": "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": "background",
"raw": "background"
},
"value": [
{
"type": "PreservedToken",
"span": {
@ -121,8 +147,7 @@
}
}
}
],
"important": null
]
}
]
}

View File

@ -10,3 +10,9 @@
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 | `-> }
`----
x Declaration
,-[$DIR/tests/recovery/value/url/parenthesis/input.css:2:5]
2 | ,-> background: url(test\);
3 | `-> }
`----
x DeclarationName
x ComponentValue
,-[$DIR/tests/recovery/value/url/parenthesis/input.css:2:5]
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]
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
,-[$DIR/tests/recovery/value/url/parenthesis/input.css:2:5]
2 | ,-> background: url(test\);

View File

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