refactor(css/parser): Refactor parser (#6395)

This commit is contained in:
Alexander Akait 2022-11-11 10:27:19 +03:00 committed by GitHub
parent c1588eb3e5
commit 983ab91435
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
62 changed files with 5875 additions and 536 deletions

View File

@ -49,14 +49,14 @@ pub enum QualifiedRulePrelude {
#[ast_node]
#[derive(Eq, Hash, Is, EqIgnoreSpan)]
pub enum StyleBlock {
#[tag("ListOfComponentValues")]
ListOfComponentValues(ListOfComponentValues),
#[tag("AtRule")]
AtRule(Box<AtRule>),
#[tag("Declaration")]
Declaration(Box<Declaration>),
#[tag("QualifiedRule")]
QualifiedRule(Box<QualifiedRule>),
#[tag("ListOfComponentValues")]
ListOfComponentValues(Box<ListOfComponentValues>),
}
#[ast_node("SimpleBlock")]
@ -158,7 +158,7 @@ pub enum DeclarationOrAtRule {
AtRule(Box<AtRule>),
// For recovery mode
#[tag("ListOfComponentValues")]
ListOfComponentValues(ListOfComponentValues),
ListOfComponentValues(Box<ListOfComponentValues>),
}
#[ast_node("Declaration")]

View File

@ -362,10 +362,9 @@ where
// Otherwise, append a <semicolon-token> to the qualified rules prelude.
tok!(";") => {
if self.ctx.mixed_with_declarations {
return Err(Error::new(
span!(self, span.lo),
ErrorKind::EofButExpected("'{'"),
));
let span = self.input.cur_span();
return Err(Error::new(span, ErrorKind::Expected("'{'")));
} else {
let component_value = self.parse_as::<ComponentValue>()?;
@ -505,19 +504,17 @@ where
temporary_list.children.push(component_value);
}
let decl_or_list_of_component_values = match self
.parse_according_to_grammar::<Declaration>(&temporary_list, |parser| {
parser.parse_as()
}) {
Ok(decl) => StyleBlock::Declaration(Box::new(decl)),
Err(err) => {
self.errors.push(err);
let decl_or_list_of_component_values =
match self.parse_declaration_from_temporary_list(&temporary_list) {
Ok(decl) => StyleBlock::Declaration(Box::new(decl)),
Err(err) => {
self.errors.push(err);
temporary_list.span = span!(self, span.lo);
temporary_list.span = span!(self, span.lo);
StyleBlock::ListOfComponentValues(temporary_list)
}
};
StyleBlock::ListOfComponentValues(Box::new(temporary_list))
}
};
declarations.push(decl_or_list_of_component_values);
}
@ -528,6 +525,7 @@ where
let state = self.input.state();
let qualified_rule = self
.with_ctx(Ctx {
block_contents_grammar: BlockContentsGrammar::StyleBlock,
mixed_with_declarations: true,
..self.ctx
})
@ -550,7 +548,6 @@ where
children: vec![],
};
// TODO verify error recovery (copied from prev spec)
while !is_one_of!(self, ";", EOF) {
let component_value = self.parse_as::<ComponentValue>()?;
@ -559,8 +556,9 @@ where
list_of_component_values.span = span!(self, span.lo);
declarations
.push(StyleBlock::ListOfComponentValues(list_of_component_values));
declarations.push(StyleBlock::ListOfComponentValues(Box::new(
list_of_component_values,
)));
}
};
}
@ -615,7 +613,14 @@ where
// Reconsume the current input token. Consume an at-rule. Append the returned rule
// to the list of declarations.
tok!("@") => {
declarations.push(DeclarationOrAtRule::AtRule(self.parse()?));
let at_rule = self
.with_ctx(Ctx {
block_contents_grammar: BlockContentsGrammar::DeclarationList,
..self.ctx
})
.parse_as::<AtRule>()?;
declarations.push(DeclarationOrAtRule::AtRule(Box::new(at_rule)));
}
// <ident-token>
// Initialize a temporary list initially filled with the current input token. As
@ -625,9 +630,10 @@ where
// it to the list of declarations.
tok!("ident") => {
let span = self.input.cur_span();
let cur = self.input.bump().unwrap();
let mut temporary_list = ListOfComponentValues {
span: Default::default(),
children: vec![],
children: vec![ComponentValue::PreservedToken(cur)],
};
while !is_one_of!(self, ";", EOF) {
@ -636,19 +642,17 @@ where
temporary_list.children.push(component_value);
}
let decl_or_list_of_component_values = match self
.parse_according_to_grammar::<Declaration>(&temporary_list, |parser| {
parser.parse_as()
}) {
Ok(decl) => DeclarationOrAtRule::Declaration(Box::new(decl)),
Err(err) => {
self.errors.push(err);
let decl_or_list_of_component_values =
match self.parse_declaration_from_temporary_list(&temporary_list) {
Ok(decl) => DeclarationOrAtRule::Declaration(Box::new(decl)),
Err(err) => {
self.errors.push(err);
temporary_list.span = span!(self, span.lo);
temporary_list.span = span!(self, span.lo);
DeclarationOrAtRule::ListOfComponentValues(temporary_list)
}
};
DeclarationOrAtRule::ListOfComponentValues(Box::new(temporary_list))
}
};
declarations.push(decl_or_list_of_component_values);
}
@ -664,9 +668,7 @@ where
self.errors.push(Error::new(
span,
ErrorKind::Expected(
"whitespace, semicolon, EOF, at-keyword or ident token",
),
ErrorKind::Expected("whitespace, ';', '@', ident or EOF"),
));
// For recovery mode
@ -683,9 +685,9 @@ where
list_of_component_values.span = span!(self, span.lo);
declarations.push(DeclarationOrAtRule::ListOfComponentValues(
declarations.push(DeclarationOrAtRule::ListOfComponentValues(Box::new(
list_of_component_values,
));
)));
}
}
}
@ -718,7 +720,7 @@ where
let is_dashed_ident = match cur!(self) {
Token::Ident { value, .. } => value.starts_with("--"),
_ => {
return Err(Error::new(span, ErrorKind::Expected("Ident")));
return Err(Error::new(span, ErrorKind::Expected("ident")));
}
};
let name = if is_dashed_ident {
@ -879,30 +881,31 @@ where
}
// Grammar parsing
let locv = self.create_locv(declaration.value);
let list_of_component_values = self.create_locv(declaration.value);
declaration.value = match self.parse_according_to_grammar(&locv, |parser| {
let mut values = vec![];
declaration.value =
match self.parse_according_to_grammar(&list_of_component_values, |parser| {
let mut values = vec![];
loop {
if is!(parser, EOF) {
break;
loop {
if is!(parser, EOF) {
break;
}
values.push(parser.parse_generic_value()?);
}
values.push(parser.parse_generic_value()?);
}
Ok(values)
}) {
Ok(values) => values,
Err(err) => {
if *err.kind() != ErrorKind::Ignore {
self.errors.push(err);
}
Ok(values)
}) {
Ok(values) => values,
Err(err) => {
if *err.kind() != ErrorKind::Ignore {
self.errors.push(err);
list_of_component_values.children
}
locv.children
}
};
};
// 8. Return the declaration.
Ok(declaration)
@ -1098,6 +1101,7 @@ where
function.span = span!(self, span.lo);
// Grammar parsing
match self.ctx.block_contents_grammar {
BlockContentsGrammar::DeclarationList => {}
_ => {

View File

@ -7,6 +7,7 @@ use super::{
input::{Input, InputType, ParserInput},
Ctx, Error, PResult, Parse, Parser,
};
use crate::parser::BlockContentsGrammar;
impl<I> Parser<I>
where
@ -77,6 +78,7 @@ where
let state = self.input.state();
let qualified_rule = self
.with_ctx(Ctx {
block_contents_grammar: BlockContentsGrammar::StyleBlock,
mixed_with_declarations: true,
..self.ctx
})
@ -114,6 +116,13 @@ where
Err(_) => None,
}
}
pub(super) fn parse_declaration_from_temporary_list(
&mut self,
temporary_list: &ListOfComponentValues,
) -> PResult<Declaration> {
self.parse_according_to_grammar::<Declaration>(temporary_list, |parser| parser.parse_as())
}
}
pub(super) struct WithCtx<'w, I: 'w + ParserInput> {

View File

@ -113,3 +113,27 @@ a/**/
}
;
}
a {
color: red;
.class {
color: green;
}
color: blue;
}
.foo {
color: red;
+ .bar {
color: blue;
}
}
article {
color: green;
& { color: blue; }
color: red;
}

View File

@ -2,7 +2,7 @@
"type": "Stylesheet",
"span": {
"start": 1,
"end": 1444,
"end": 1664,
"ctxt": 0
},
"rules": [
@ -4491,6 +4491,753 @@
}
]
}
},
{
"type": "QualifiedRule",
"span": {
"start": 1445,
"end": 1526,
"ctxt": 0
},
"prelude": {
"type": "SelectorList",
"span": {
"start": 1445,
"end": 1446,
"ctxt": 0
},
"children": [
{
"type": "ComplexSelector",
"span": {
"start": 1445,
"end": 1446,
"ctxt": 0
},
"children": [
{
"type": "CompoundSelector",
"span": {
"start": 1445,
"end": 1446,
"ctxt": 0
},
"nestingSelector": null,
"typeSelector": {
"type": "TagNameSelector",
"span": {
"start": 1445,
"end": 1446,
"ctxt": 0
},
"name": {
"type": "WqName",
"span": {
"start": 1445,
"end": 1446,
"ctxt": 0
},
"prefix": null,
"value": {
"type": "Ident",
"span": {
"start": 1445,
"end": 1446,
"ctxt": 0
},
"value": "a",
"raw": "a"
}
}
},
"subclassSelectors": []
}
]
}
]
},
"block": {
"type": "SimpleBlock",
"span": {
"start": 1447,
"end": 1526,
"ctxt": 0
},
"name": {
"type": "PreservedToken",
"span": {
"start": 1447,
"end": 1448,
"ctxt": 0
},
"token": "LBrace"
},
"value": [
{
"type": "Declaration",
"span": {
"start": 1453,
"end": 1463,
"ctxt": 0
},
"name": {
"type": "Ident",
"span": {
"start": 1453,
"end": 1458,
"ctxt": 0
},
"value": "color",
"raw": "color"
},
"value": [
{
"type": "Ident",
"span": {
"start": 1460,
"end": 1463,
"ctxt": 0
},
"value": "red",
"raw": "red"
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 1512,
"end": 1523,
"ctxt": 0
},
"name": {
"type": "Ident",
"span": {
"start": 1512,
"end": 1517,
"ctxt": 0
},
"value": "color",
"raw": "color"
},
"value": [
{
"type": "Ident",
"span": {
"start": 1519,
"end": 1523,
"ctxt": 0
},
"value": "blue",
"raw": "blue"
}
],
"important": null
},
{
"type": "QualifiedRule",
"span": {
"start": 1470,
"end": 1506,
"ctxt": 0
},
"prelude": {
"type": "RelativeSelectorList",
"span": {
"start": 1470,
"end": 1476,
"ctxt": 0
},
"children": [
{
"type": "RelativeSelector",
"span": {
"start": 1470,
"end": 1476,
"ctxt": 0
},
"combinator": null,
"selector": {
"type": "ComplexSelector",
"span": {
"start": 1470,
"end": 1476,
"ctxt": 0
},
"children": [
{
"type": "CompoundSelector",
"span": {
"start": 1470,
"end": 1476,
"ctxt": 0
},
"nestingSelector": null,
"typeSelector": null,
"subclassSelectors": [
{
"type": "ClassSelector",
"span": {
"start": 1470,
"end": 1476,
"ctxt": 0
},
"text": {
"type": "Ident",
"span": {
"start": 1471,
"end": 1476,
"ctxt": 0
},
"value": "class",
"raw": "class"
}
}
]
}
]
}
}
]
},
"block": {
"type": "SimpleBlock",
"span": {
"start": 1477,
"end": 1506,
"ctxt": 0
},
"name": {
"type": "PreservedToken",
"span": {
"start": 1477,
"end": 1478,
"ctxt": 0
},
"token": "LBrace"
},
"value": [
{
"type": "Declaration",
"span": {
"start": 1487,
"end": 1499,
"ctxt": 0
},
"name": {
"type": "Ident",
"span": {
"start": 1487,
"end": 1492,
"ctxt": 0
},
"value": "color",
"raw": "color"
},
"value": [
{
"type": "Ident",
"span": {
"start": 1494,
"end": 1499,
"ctxt": 0
},
"value": "green",
"raw": "green"
}
],
"important": null
}
]
}
}
]
}
},
{
"type": "QualifiedRule",
"span": {
"start": 1528,
"end": 1593,
"ctxt": 0
},
"prelude": {
"type": "SelectorList",
"span": {
"start": 1528,
"end": 1532,
"ctxt": 0
},
"children": [
{
"type": "ComplexSelector",
"span": {
"start": 1528,
"end": 1532,
"ctxt": 0
},
"children": [
{
"type": "CompoundSelector",
"span": {
"start": 1528,
"end": 1532,
"ctxt": 0
},
"nestingSelector": null,
"typeSelector": null,
"subclassSelectors": [
{
"type": "ClassSelector",
"span": {
"start": 1528,
"end": 1532,
"ctxt": 0
},
"text": {
"type": "Ident",
"span": {
"start": 1529,
"end": 1532,
"ctxt": 0
},
"value": "foo",
"raw": "foo"
}
}
]
}
]
}
]
},
"block": {
"type": "SimpleBlock",
"span": {
"start": 1533,
"end": 1593,
"ctxt": 0
},
"name": {
"type": "PreservedToken",
"span": {
"start": 1533,
"end": 1534,
"ctxt": 0
},
"token": "LBrace"
},
"value": [
{
"type": "Declaration",
"span": {
"start": 1539,
"end": 1549,
"ctxt": 0
},
"name": {
"type": "Ident",
"span": {
"start": 1539,
"end": 1544,
"ctxt": 0
},
"value": "color",
"raw": "color"
},
"value": [
{
"type": "Ident",
"span": {
"start": 1546,
"end": 1549,
"ctxt": 0
},
"value": "red",
"raw": "red"
}
],
"important": null
},
{
"type": "QualifiedRule",
"span": {
"start": 1556,
"end": 1591,
"ctxt": 0
},
"prelude": {
"type": "RelativeSelectorList",
"span": {
"start": 1556,
"end": 1562,
"ctxt": 0
},
"children": [
{
"type": "RelativeSelector",
"span": {
"start": 1556,
"end": 1562,
"ctxt": 0
},
"combinator": {
"type": "Combinator",
"span": {
"start": 1556,
"end": 1557,
"ctxt": 0
},
"value": "+"
},
"selector": {
"type": "ComplexSelector",
"span": {
"start": 1558,
"end": 1562,
"ctxt": 0
},
"children": [
{
"type": "CompoundSelector",
"span": {
"start": 1558,
"end": 1562,
"ctxt": 0
},
"nestingSelector": null,
"typeSelector": null,
"subclassSelectors": [
{
"type": "ClassSelector",
"span": {
"start": 1558,
"end": 1562,
"ctxt": 0
},
"text": {
"type": "Ident",
"span": {
"start": 1559,
"end": 1562,
"ctxt": 0
},
"value": "bar",
"raw": "bar"
}
}
]
}
]
}
}
]
},
"block": {
"type": "SimpleBlock",
"span": {
"start": 1563,
"end": 1591,
"ctxt": 0
},
"name": {
"type": "PreservedToken",
"span": {
"start": 1563,
"end": 1564,
"ctxt": 0
},
"token": "LBrace"
},
"value": [
{
"type": "Declaration",
"span": {
"start": 1573,
"end": 1584,
"ctxt": 0
},
"name": {
"type": "Ident",
"span": {
"start": 1573,
"end": 1578,
"ctxt": 0
},
"value": "color",
"raw": "color"
},
"value": [
{
"type": "Ident",
"span": {
"start": 1580,
"end": 1584,
"ctxt": 0
},
"value": "blue",
"raw": "blue"
}
],
"important": null
}
]
}
}
]
}
},
{
"type": "QualifiedRule",
"span": {
"start": 1595,
"end": 1663,
"ctxt": 0
},
"prelude": {
"type": "SelectorList",
"span": {
"start": 1595,
"end": 1602,
"ctxt": 0
},
"children": [
{
"type": "ComplexSelector",
"span": {
"start": 1595,
"end": 1602,
"ctxt": 0
},
"children": [
{
"type": "CompoundSelector",
"span": {
"start": 1595,
"end": 1602,
"ctxt": 0
},
"nestingSelector": null,
"typeSelector": {
"type": "TagNameSelector",
"span": {
"start": 1595,
"end": 1602,
"ctxt": 0
},
"name": {
"type": "WqName",
"span": {
"start": 1595,
"end": 1602,
"ctxt": 0
},
"prefix": null,
"value": {
"type": "Ident",
"span": {
"start": 1595,
"end": 1602,
"ctxt": 0
},
"value": "article",
"raw": "article"
}
}
},
"subclassSelectors": []
}
]
}
]
},
"block": {
"type": "SimpleBlock",
"span": {
"start": 1603,
"end": 1663,
"ctxt": 0
},
"name": {
"type": "PreservedToken",
"span": {
"start": 1603,
"end": 1604,
"ctxt": 0
},
"token": "LBrace"
},
"value": [
{
"type": "Declaration",
"span": {
"start": 1609,
"end": 1621,
"ctxt": 0
},
"name": {
"type": "Ident",
"span": {
"start": 1609,
"end": 1614,
"ctxt": 0
},
"value": "color",
"raw": "color"
},
"value": [
{
"type": "Ident",
"span": {
"start": 1616,
"end": 1621,
"ctxt": 0
},
"value": "green",
"raw": "green"
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 1650,
"end": 1660,
"ctxt": 0
},
"name": {
"type": "Ident",
"span": {
"start": 1650,
"end": 1655,
"ctxt": 0
},
"value": "color",
"raw": "color"
},
"value": [
{
"type": "Ident",
"span": {
"start": 1657,
"end": 1660,
"ctxt": 0
},
"value": "red",
"raw": "red"
}
],
"important": null
},
{
"type": "QualifiedRule",
"span": {
"start": 1627,
"end": 1645,
"ctxt": 0
},
"prelude": {
"type": "RelativeSelectorList",
"span": {
"start": 1627,
"end": 1628,
"ctxt": 0
},
"children": [
{
"type": "RelativeSelector",
"span": {
"start": 1627,
"end": 1628,
"ctxt": 0
},
"combinator": null,
"selector": {
"type": "ComplexSelector",
"span": {
"start": 1627,
"end": 1628,
"ctxt": 0
},
"children": [
{
"type": "CompoundSelector",
"span": {
"start": 1627,
"end": 1628,
"ctxt": 0
},
"nestingSelector": {
"type": "NestingSelector",
"span": {
"start": 1627,
"end": 1628,
"ctxt": 0
}
},
"typeSelector": null,
"subclassSelectors": []
}
]
}
}
]
},
"block": {
"type": "SimpleBlock",
"span": {
"start": 1629,
"end": 1645,
"ctxt": 0
},
"name": {
"type": "PreservedToken",
"span": {
"start": 1629,
"end": 1630,
"ctxt": 0
},
"token": "LBrace"
},
"value": [
{
"type": "Declaration",
"span": {
"start": 1631,
"end": 1642,
"ctxt": 0
},
"name": {
"type": "Ident",
"span": {
"start": 1631,
"end": 1636,
"ctxt": 0
},
"value": "color",
"raw": "color"
},
"value": [
{
"type": "Ident",
"span": {
"start": 1638,
"end": 1642,
"ctxt": 0
},
"value": "blue",
"raw": "blue"
}
],
"important": null
}
]
}
}
]
}
}
]
}

View File

@ -115,7 +115,31 @@
112 | | height: 16px;
113 | | }
114 | | ;
115 | `-> }
115 | | }
116 | |
117 | | a {
118 | | color: red;
119 | |
120 | | .class {
121 | | color: green;
122 | | }
123 | |
124 | | color: blue;
125 | | }
126 | |
127 | | .foo {
128 | | color: red;
129 | |
130 | | + .bar {
131 | | color: blue;
132 | | }
133 | | }
134 | |
135 | | article {
136 | | color: green;
137 | | & { color: blue; }
138 | | color: red;
139 | `-> }
`----
x Rule
@ -4808,3 +4832,794 @@
112 | ,-> height: 16px;
113 | `-> }
`----
x Rule
,-[$DIR/tests/fixture/style-block/input.css:117:1]
117 | ,-> a {
118 | | color: red;
119 | |
120 | | .class {
121 | | color: green;
122 | | }
123 | |
124 | | color: blue;
125 | `-> }
`----
x QualifiedRule
,-[$DIR/tests/fixture/style-block/input.css:117:1]
117 | ,-> a {
118 | | color: red;
119 | |
120 | | .class {
121 | | color: green;
122 | | }
123 | |
124 | | color: blue;
125 | `-> }
`----
x SelectorList
,-[$DIR/tests/fixture/style-block/input.css:117:1]
117 | a {
: ^
`----
x ComplexSelector
,-[$DIR/tests/fixture/style-block/input.css:117:1]
117 | a {
: ^
`----
x CompoundSelector
,-[$DIR/tests/fixture/style-block/input.css:117:1]
117 | a {
: ^
`----
x TypeSelector
,-[$DIR/tests/fixture/style-block/input.css:117:1]
117 | a {
: ^
`----
x TagNameSelector
,-[$DIR/tests/fixture/style-block/input.css:117:1]
117 | a {
: ^
`----
x WqName
,-[$DIR/tests/fixture/style-block/input.css:117:1]
117 | a {
: ^
`----
x Ident
,-[$DIR/tests/fixture/style-block/input.css:117:1]
117 | a {
: ^
`----
x SimpleBlock
,-[$DIR/tests/fixture/style-block/input.css:117:1]
117 | ,-> a {
118 | | color: red;
119 | |
120 | | .class {
121 | | color: green;
122 | | }
123 | |
124 | | color: blue;
125 | `-> }
`----
x LBrace
,-[$DIR/tests/fixture/style-block/input.css:117:1]
117 | a {
: ^
`----
x ComponentValue
,-[$DIR/tests/fixture/style-block/input.css:118:5]
118 | color: red;
: ^^^^^^^^^^
`----
x StyleBlock
,-[$DIR/tests/fixture/style-block/input.css:118:5]
118 | color: red;
: ^^^^^^^^^^
`----
x Declaration
,-[$DIR/tests/fixture/style-block/input.css:118:5]
118 | color: red;
: ^^^^^^^^^^
`----
x DeclarationName
,-[$DIR/tests/fixture/style-block/input.css:118:5]
118 | color: red;
: ^^^^^
`----
x Ident
,-[$DIR/tests/fixture/style-block/input.css:118:5]
118 | color: red;
: ^^^^^
`----
x ComponentValue
,-[$DIR/tests/fixture/style-block/input.css:118:5]
118 | color: red;
: ^^^
`----
x Ident
,-[$DIR/tests/fixture/style-block/input.css:118:5]
118 | color: red;
: ^^^
`----
x ComponentValue
,-[$DIR/tests/fixture/style-block/input.css:124:5]
124 | color: blue;
: ^^^^^^^^^^^
`----
x StyleBlock
,-[$DIR/tests/fixture/style-block/input.css:124:5]
124 | color: blue;
: ^^^^^^^^^^^
`----
x Declaration
,-[$DIR/tests/fixture/style-block/input.css:124:5]
124 | color: blue;
: ^^^^^^^^^^^
`----
x DeclarationName
,-[$DIR/tests/fixture/style-block/input.css:124:5]
124 | color: blue;
: ^^^^^
`----
x Ident
,-[$DIR/tests/fixture/style-block/input.css:124:5]
124 | color: blue;
: ^^^^^
`----
x ComponentValue
,-[$DIR/tests/fixture/style-block/input.css:124:5]
124 | color: blue;
: ^^^^
`----
x Ident
,-[$DIR/tests/fixture/style-block/input.css:124:5]
124 | color: blue;
: ^^^^
`----
x ComponentValue
,-[$DIR/tests/fixture/style-block/input.css:120:5]
120 | ,-> .class {
121 | | color: green;
122 | `-> }
`----
x StyleBlock
,-[$DIR/tests/fixture/style-block/input.css:120:5]
120 | ,-> .class {
121 | | color: green;
122 | `-> }
`----
x QualifiedRule
,-[$DIR/tests/fixture/style-block/input.css:120:5]
120 | ,-> .class {
121 | | color: green;
122 | `-> }
`----
x RelativeSelectorList
,-[$DIR/tests/fixture/style-block/input.css:120:5]
120 | .class {
: ^^^^^^
`----
x RelativeSelector
,-[$DIR/tests/fixture/style-block/input.css:120:5]
120 | .class {
: ^^^^^^
`----
x ComplexSelector
,-[$DIR/tests/fixture/style-block/input.css:120:5]
120 | .class {
: ^^^^^^
`----
x CompoundSelector
,-[$DIR/tests/fixture/style-block/input.css:120:5]
120 | .class {
: ^^^^^^
`----
x SubclassSelector
,-[$DIR/tests/fixture/style-block/input.css:120:5]
120 | .class {
: ^^^^^^
`----
x ClassSelector
,-[$DIR/tests/fixture/style-block/input.css:120:5]
120 | .class {
: ^^^^^^
`----
x Ident
,-[$DIR/tests/fixture/style-block/input.css:120:5]
120 | .class {
: ^^^^^
`----
x SimpleBlock
,-[$DIR/tests/fixture/style-block/input.css:120:5]
120 | ,-> .class {
121 | | color: green;
122 | `-> }
`----
x LBrace
,-[$DIR/tests/fixture/style-block/input.css:120:5]
120 | .class {
: ^
`----
x ComponentValue
,-[$DIR/tests/fixture/style-block/input.css:121:9]
121 | color: green;
: ^^^^^^^^^^^^
`----
x StyleBlock
,-[$DIR/tests/fixture/style-block/input.css:121:9]
121 | color: green;
: ^^^^^^^^^^^^
`----
x Declaration
,-[$DIR/tests/fixture/style-block/input.css:121:9]
121 | color: green;
: ^^^^^^^^^^^^
`----
x DeclarationName
,-[$DIR/tests/fixture/style-block/input.css:121:9]
121 | color: green;
: ^^^^^
`----
x Ident
,-[$DIR/tests/fixture/style-block/input.css:121:9]
121 | color: green;
: ^^^^^
`----
x ComponentValue
,-[$DIR/tests/fixture/style-block/input.css:121:9]
121 | color: green;
: ^^^^^
`----
x Ident
,-[$DIR/tests/fixture/style-block/input.css:121:9]
121 | color: green;
: ^^^^^
`----
x Rule
,-[$DIR/tests/fixture/style-block/input.css:127:1]
127 | ,-> .foo {
128 | | color: red;
129 | |
130 | | + .bar {
131 | | color: blue;
132 | | }
133 | `-> }
`----
x QualifiedRule
,-[$DIR/tests/fixture/style-block/input.css:127:1]
127 | ,-> .foo {
128 | | color: red;
129 | |
130 | | + .bar {
131 | | color: blue;
132 | | }
133 | `-> }
`----
x SelectorList
,-[$DIR/tests/fixture/style-block/input.css:127:1]
127 | .foo {
: ^^^^
`----
x ComplexSelector
,-[$DIR/tests/fixture/style-block/input.css:127:1]
127 | .foo {
: ^^^^
`----
x CompoundSelector
,-[$DIR/tests/fixture/style-block/input.css:127:1]
127 | .foo {
: ^^^^
`----
x SubclassSelector
,-[$DIR/tests/fixture/style-block/input.css:127:1]
127 | .foo {
: ^^^^
`----
x ClassSelector
,-[$DIR/tests/fixture/style-block/input.css:127:1]
127 | .foo {
: ^^^^
`----
x Ident
,-[$DIR/tests/fixture/style-block/input.css:127:1]
127 | .foo {
: ^^^
`----
x SimpleBlock
,-[$DIR/tests/fixture/style-block/input.css:127:1]
127 | ,-> .foo {
128 | | color: red;
129 | |
130 | | + .bar {
131 | | color: blue;
132 | | }
133 | `-> }
`----
x LBrace
,-[$DIR/tests/fixture/style-block/input.css:127:1]
127 | .foo {
: ^
`----
x ComponentValue
,-[$DIR/tests/fixture/style-block/input.css:128:5]
128 | color: red;
: ^^^^^^^^^^
`----
x StyleBlock
,-[$DIR/tests/fixture/style-block/input.css:128:5]
128 | color: red;
: ^^^^^^^^^^
`----
x Declaration
,-[$DIR/tests/fixture/style-block/input.css:128:5]
128 | color: red;
: ^^^^^^^^^^
`----
x DeclarationName
,-[$DIR/tests/fixture/style-block/input.css:128:5]
128 | color: red;
: ^^^^^
`----
x Ident
,-[$DIR/tests/fixture/style-block/input.css:128:5]
128 | color: red;
: ^^^^^
`----
x ComponentValue
,-[$DIR/tests/fixture/style-block/input.css:128:5]
128 | color: red;
: ^^^
`----
x Ident
,-[$DIR/tests/fixture/style-block/input.css:128:5]
128 | color: red;
: ^^^
`----
x ComponentValue
,-[$DIR/tests/fixture/style-block/input.css:130:5]
130 | ,-> + .bar {
131 | | color: blue;
132 | `-> }
`----
x StyleBlock
,-[$DIR/tests/fixture/style-block/input.css:130:5]
130 | ,-> + .bar {
131 | | color: blue;
132 | `-> }
`----
x QualifiedRule
,-[$DIR/tests/fixture/style-block/input.css:130:5]
130 | ,-> + .bar {
131 | | color: blue;
132 | `-> }
`----
x RelativeSelectorList
,-[$DIR/tests/fixture/style-block/input.css:130:5]
130 | + .bar {
: ^^^^^^
`----
x RelativeSelector
,-[$DIR/tests/fixture/style-block/input.css:130:5]
130 | + .bar {
: ^^^^^^
`----
x Combinator
,-[$DIR/tests/fixture/style-block/input.css:130:5]
130 | + .bar {
: ^
`----
x ComplexSelector
,-[$DIR/tests/fixture/style-block/input.css:130:5]
130 | + .bar {
: ^^^^
`----
x CompoundSelector
,-[$DIR/tests/fixture/style-block/input.css:130:5]
130 | + .bar {
: ^^^^
`----
x SubclassSelector
,-[$DIR/tests/fixture/style-block/input.css:130:5]
130 | + .bar {
: ^^^^
`----
x ClassSelector
,-[$DIR/tests/fixture/style-block/input.css:130:5]
130 | + .bar {
: ^^^^
`----
x Ident
,-[$DIR/tests/fixture/style-block/input.css:130:5]
130 | + .bar {
: ^^^
`----
x SimpleBlock
,-[$DIR/tests/fixture/style-block/input.css:130:5]
130 | ,-> + .bar {
131 | | color: blue;
132 | `-> }
`----
x LBrace
,-[$DIR/tests/fixture/style-block/input.css:130:5]
130 | + .bar {
: ^
`----
x ComponentValue
,-[$DIR/tests/fixture/style-block/input.css:131:9]
131 | color: blue;
: ^^^^^^^^^^^
`----
x StyleBlock
,-[$DIR/tests/fixture/style-block/input.css:131:9]
131 | color: blue;
: ^^^^^^^^^^^
`----
x Declaration
,-[$DIR/tests/fixture/style-block/input.css:131:9]
131 | color: blue;
: ^^^^^^^^^^^
`----
x DeclarationName
,-[$DIR/tests/fixture/style-block/input.css:131:9]
131 | color: blue;
: ^^^^^
`----
x Ident
,-[$DIR/tests/fixture/style-block/input.css:131:9]
131 | color: blue;
: ^^^^^
`----
x ComponentValue
,-[$DIR/tests/fixture/style-block/input.css:131:9]
131 | color: blue;
: ^^^^
`----
x Ident
,-[$DIR/tests/fixture/style-block/input.css:131:9]
131 | color: blue;
: ^^^^
`----
x Rule
,-[$DIR/tests/fixture/style-block/input.css:135:1]
135 | ,-> article {
136 | | color: green;
137 | | & { color: blue; }
138 | | color: red;
139 | `-> }
`----
x QualifiedRule
,-[$DIR/tests/fixture/style-block/input.css:135:1]
135 | ,-> article {
136 | | color: green;
137 | | & { color: blue; }
138 | | color: red;
139 | `-> }
`----
x SelectorList
,-[$DIR/tests/fixture/style-block/input.css:135:1]
135 | article {
: ^^^^^^^
`----
x ComplexSelector
,-[$DIR/tests/fixture/style-block/input.css:135:1]
135 | article {
: ^^^^^^^
`----
x CompoundSelector
,-[$DIR/tests/fixture/style-block/input.css:135:1]
135 | article {
: ^^^^^^^
`----
x TypeSelector
,-[$DIR/tests/fixture/style-block/input.css:135:1]
135 | article {
: ^^^^^^^
`----
x TagNameSelector
,-[$DIR/tests/fixture/style-block/input.css:135:1]
135 | article {
: ^^^^^^^
`----
x WqName
,-[$DIR/tests/fixture/style-block/input.css:135:1]
135 | article {
: ^^^^^^^
`----
x Ident
,-[$DIR/tests/fixture/style-block/input.css:135:1]
135 | article {
: ^^^^^^^
`----
x SimpleBlock
,-[$DIR/tests/fixture/style-block/input.css:135:1]
135 | ,-> article {
136 | | color: green;
137 | | & { color: blue; }
138 | | color: red;
139 | `-> }
`----
x LBrace
,-[$DIR/tests/fixture/style-block/input.css:135:1]
135 | article {
: ^
`----
x ComponentValue
,-[$DIR/tests/fixture/style-block/input.css:136:5]
136 | color: green;
: ^^^^^^^^^^^^
`----
x StyleBlock
,-[$DIR/tests/fixture/style-block/input.css:136:5]
136 | color: green;
: ^^^^^^^^^^^^
`----
x Declaration
,-[$DIR/tests/fixture/style-block/input.css:136:5]
136 | color: green;
: ^^^^^^^^^^^^
`----
x DeclarationName
,-[$DIR/tests/fixture/style-block/input.css:136:5]
136 | color: green;
: ^^^^^
`----
x Ident
,-[$DIR/tests/fixture/style-block/input.css:136:5]
136 | color: green;
: ^^^^^
`----
x ComponentValue
,-[$DIR/tests/fixture/style-block/input.css:136:5]
136 | color: green;
: ^^^^^
`----
x Ident
,-[$DIR/tests/fixture/style-block/input.css:136:5]
136 | color: green;
: ^^^^^
`----
x ComponentValue
,-[$DIR/tests/fixture/style-block/input.css:138:5]
138 | color: red;
: ^^^^^^^^^^
`----
x StyleBlock
,-[$DIR/tests/fixture/style-block/input.css:138:5]
138 | color: red;
: ^^^^^^^^^^
`----
x Declaration
,-[$DIR/tests/fixture/style-block/input.css:138:5]
138 | color: red;
: ^^^^^^^^^^
`----
x DeclarationName
,-[$DIR/tests/fixture/style-block/input.css:138:5]
138 | color: red;
: ^^^^^
`----
x Ident
,-[$DIR/tests/fixture/style-block/input.css:138:5]
138 | color: red;
: ^^^^^
`----
x ComponentValue
,-[$DIR/tests/fixture/style-block/input.css:138:5]
138 | color: red;
: ^^^
`----
x Ident
,-[$DIR/tests/fixture/style-block/input.css:138:5]
138 | color: red;
: ^^^
`----
x ComponentValue
,-[$DIR/tests/fixture/style-block/input.css:137:5]
137 | & { color: blue; }
: ^^^^^^^^^^^^^^^^^^
`----
x StyleBlock
,-[$DIR/tests/fixture/style-block/input.css:137:5]
137 | & { color: blue; }
: ^^^^^^^^^^^^^^^^^^
`----
x QualifiedRule
,-[$DIR/tests/fixture/style-block/input.css:137:5]
137 | & { color: blue; }
: ^^^^^^^^^^^^^^^^^^
`----
x RelativeSelectorList
,-[$DIR/tests/fixture/style-block/input.css:137:5]
137 | & { color: blue; }
: ^
`----
x RelativeSelector
,-[$DIR/tests/fixture/style-block/input.css:137:5]
137 | & { color: blue; }
: ^
`----
x ComplexSelector
,-[$DIR/tests/fixture/style-block/input.css:137:5]
137 | & { color: blue; }
: ^
`----
x CompoundSelector
,-[$DIR/tests/fixture/style-block/input.css:137:5]
137 | & { color: blue; }
: ^
`----
x NestingSelector
,-[$DIR/tests/fixture/style-block/input.css:137:5]
137 | & { color: blue; }
: ^
`----
x SimpleBlock
,-[$DIR/tests/fixture/style-block/input.css:137:5]
137 | & { color: blue; }
: ^^^^^^^^^^^^^^^^
`----
x LBrace
,-[$DIR/tests/fixture/style-block/input.css:137:5]
137 | & { color: blue; }
: ^
`----
x ComponentValue
,-[$DIR/tests/fixture/style-block/input.css:137:5]
137 | & { color: blue; }
: ^^^^^^^^^^^
`----
x StyleBlock
,-[$DIR/tests/fixture/style-block/input.css:137:5]
137 | & { color: blue; }
: ^^^^^^^^^^^
`----
x Declaration
,-[$DIR/tests/fixture/style-block/input.css:137:5]
137 | & { color: blue; }
: ^^^^^^^^^^^
`----
x DeclarationName
,-[$DIR/tests/fixture/style-block/input.css:137:5]
137 | & { color: blue; }
: ^^^^^
`----
x Ident
,-[$DIR/tests/fixture/style-block/input.css:137:5]
137 | & { color: blue; }
: ^^^^^
`----
x ComponentValue
,-[$DIR/tests/fixture/style-block/input.css:137:5]
137 | & { color: blue; }
: ^^^^
`----
x Ident
,-[$DIR/tests/fixture/style-block/input.css:137:5]
137 | & { color: blue; }
: ^^^^
`----

View File

@ -0,0 +1,7 @@
<!-- a {
color: red;
}
--> a {
color: red;
}

View File

@ -0,0 +1,240 @@
{
"type": "Stylesheet",
"span": {
"start": 1,
"end": 55,
"ctxt": 0
},
"rules": [
{
"type": "QualifiedRule",
"span": {
"start": 6,
"end": 27,
"ctxt": 0
},
"prelude": {
"type": "SelectorList",
"span": {
"start": 6,
"end": 7,
"ctxt": 0
},
"children": [
{
"type": "ComplexSelector",
"span": {
"start": 6,
"end": 7,
"ctxt": 0
},
"children": [
{
"type": "CompoundSelector",
"span": {
"start": 6,
"end": 7,
"ctxt": 0
},
"nestingSelector": null,
"typeSelector": {
"type": "TagNameSelector",
"span": {
"start": 6,
"end": 7,
"ctxt": 0
},
"name": {
"type": "WqName",
"span": {
"start": 6,
"end": 7,
"ctxt": 0
},
"prefix": null,
"value": {
"type": "Ident",
"span": {
"start": 6,
"end": 7,
"ctxt": 0
},
"value": "a",
"raw": "a"
}
}
},
"subclassSelectors": []
}
]
}
]
},
"block": {
"type": "SimpleBlock",
"span": {
"start": 8,
"end": 27,
"ctxt": 0
},
"name": {
"type": "PreservedToken",
"span": {
"start": 8,
"end": 9,
"ctxt": 0
},
"token": "LBrace"
},
"value": [
{
"type": "Declaration",
"span": {
"start": 14,
"end": 24,
"ctxt": 0
},
"name": {
"type": "Ident",
"span": {
"start": 14,
"end": 19,
"ctxt": 0
},
"value": "color",
"raw": "color"
},
"value": [
{
"type": "Ident",
"span": {
"start": 21,
"end": 24,
"ctxt": 0
},
"value": "red",
"raw": "red"
}
],
"important": null
}
]
}
},
{
"type": "QualifiedRule",
"span": {
"start": 33,
"end": 54,
"ctxt": 0
},
"prelude": {
"type": "SelectorList",
"span": {
"start": 33,
"end": 34,
"ctxt": 0
},
"children": [
{
"type": "ComplexSelector",
"span": {
"start": 33,
"end": 34,
"ctxt": 0
},
"children": [
{
"type": "CompoundSelector",
"span": {
"start": 33,
"end": 34,
"ctxt": 0
},
"nestingSelector": null,
"typeSelector": {
"type": "TagNameSelector",
"span": {
"start": 33,
"end": 34,
"ctxt": 0
},
"name": {
"type": "WqName",
"span": {
"start": 33,
"end": 34,
"ctxt": 0
},
"prefix": null,
"value": {
"type": "Ident",
"span": {
"start": 33,
"end": 34,
"ctxt": 0
},
"value": "a",
"raw": "a"
}
}
},
"subclassSelectors": []
}
]
}
]
},
"block": {
"type": "SimpleBlock",
"span": {
"start": 35,
"end": 54,
"ctxt": 0
},
"name": {
"type": "PreservedToken",
"span": {
"start": 35,
"end": 36,
"ctxt": 0
},
"token": "LBrace"
},
"value": [
{
"type": "Declaration",
"span": {
"start": 41,
"end": 51,
"ctxt": 0
},
"name": {
"type": "Ident",
"span": {
"start": 41,
"end": 46,
"ctxt": 0
},
"value": "color",
"raw": "color"
},
"value": [
{
"type": "Ident",
"span": {
"start": 48,
"end": 51,
"ctxt": 0
},
"value": "red",
"raw": "red"
}
],
"important": null
}
]
}
}
]
}

View File

@ -0,0 +1,233 @@
x Stylesheet
,-[$DIR/tests/fixture/stylesheet/cdo-and-cdc/input.css:1:1]
1 | ,-> <!-- a {
2 | | color: red;
3 | | }
4 | |
5 | | --> a {
6 | | color: red;
7 | `-> }
`----
x Rule
,-[$DIR/tests/fixture/stylesheet/cdo-and-cdc/input.css:1:1]
1 | ,-> <!-- a {
2 | | color: red;
3 | `-> }
`----
x QualifiedRule
,-[$DIR/tests/fixture/stylesheet/cdo-and-cdc/input.css:1:1]
1 | ,-> <!-- a {
2 | | color: red;
3 | `-> }
`----
x SelectorList
,-[$DIR/tests/fixture/stylesheet/cdo-and-cdc/input.css:1:1]
1 | <!-- a {
: ^
`----
x ComplexSelector
,-[$DIR/tests/fixture/stylesheet/cdo-and-cdc/input.css:1:1]
1 | <!-- a {
: ^
`----
x CompoundSelector
,-[$DIR/tests/fixture/stylesheet/cdo-and-cdc/input.css:1:1]
1 | <!-- a {
: ^
`----
x TypeSelector
,-[$DIR/tests/fixture/stylesheet/cdo-and-cdc/input.css:1:1]
1 | <!-- a {
: ^
`----
x TagNameSelector
,-[$DIR/tests/fixture/stylesheet/cdo-and-cdc/input.css:1:1]
1 | <!-- a {
: ^
`----
x WqName
,-[$DIR/tests/fixture/stylesheet/cdo-and-cdc/input.css:1:1]
1 | <!-- a {
: ^
`----
x Ident
,-[$DIR/tests/fixture/stylesheet/cdo-and-cdc/input.css:1:1]
1 | <!-- a {
: ^
`----
x SimpleBlock
,-[$DIR/tests/fixture/stylesheet/cdo-and-cdc/input.css:1:1]
1 | ,-> <!-- a {
2 | | color: red;
3 | `-> }
`----
x LBrace
,-[$DIR/tests/fixture/stylesheet/cdo-and-cdc/input.css:1:1]
1 | <!-- a {
: ^
`----
x ComponentValue
,-[$DIR/tests/fixture/stylesheet/cdo-and-cdc/input.css:2:5]
2 | color: red;
: ^^^^^^^^^^
`----
x StyleBlock
,-[$DIR/tests/fixture/stylesheet/cdo-and-cdc/input.css:2:5]
2 | color: red;
: ^^^^^^^^^^
`----
x Declaration
,-[$DIR/tests/fixture/stylesheet/cdo-and-cdc/input.css:2:5]
2 | color: red;
: ^^^^^^^^^^
`----
x DeclarationName
,-[$DIR/tests/fixture/stylesheet/cdo-and-cdc/input.css:2:5]
2 | color: red;
: ^^^^^
`----
x Ident
,-[$DIR/tests/fixture/stylesheet/cdo-and-cdc/input.css:2:5]
2 | color: red;
: ^^^^^
`----
x ComponentValue
,-[$DIR/tests/fixture/stylesheet/cdo-and-cdc/input.css:2:5]
2 | color: red;
: ^^^
`----
x Ident
,-[$DIR/tests/fixture/stylesheet/cdo-and-cdc/input.css:2:5]
2 | color: red;
: ^^^
`----
x Rule
,-[$DIR/tests/fixture/stylesheet/cdo-and-cdc/input.css:5:1]
5 | ,-> --> a {
6 | | color: red;
7 | `-> }
`----
x QualifiedRule
,-[$DIR/tests/fixture/stylesheet/cdo-and-cdc/input.css:5:1]
5 | ,-> --> a {
6 | | color: red;
7 | `-> }
`----
x SelectorList
,-[$DIR/tests/fixture/stylesheet/cdo-and-cdc/input.css:5:1]
5 | --> a {
: ^
`----
x ComplexSelector
,-[$DIR/tests/fixture/stylesheet/cdo-and-cdc/input.css:5:1]
5 | --> a {
: ^
`----
x CompoundSelector
,-[$DIR/tests/fixture/stylesheet/cdo-and-cdc/input.css:5:1]
5 | --> a {
: ^
`----
x TypeSelector
,-[$DIR/tests/fixture/stylesheet/cdo-and-cdc/input.css:5:1]
5 | --> a {
: ^
`----
x TagNameSelector
,-[$DIR/tests/fixture/stylesheet/cdo-and-cdc/input.css:5:1]
5 | --> a {
: ^
`----
x WqName
,-[$DIR/tests/fixture/stylesheet/cdo-and-cdc/input.css:5:1]
5 | --> a {
: ^
`----
x Ident
,-[$DIR/tests/fixture/stylesheet/cdo-and-cdc/input.css:5:1]
5 | --> a {
: ^
`----
x SimpleBlock
,-[$DIR/tests/fixture/stylesheet/cdo-and-cdc/input.css:5:1]
5 | ,-> --> a {
6 | | color: red;
7 | `-> }
`----
x LBrace
,-[$DIR/tests/fixture/stylesheet/cdo-and-cdc/input.css:5:1]
5 | --> a {
: ^
`----
x ComponentValue
,-[$DIR/tests/fixture/stylesheet/cdo-and-cdc/input.css:6:5]
6 | color: red;
: ^^^^^^^^^^
`----
x StyleBlock
,-[$DIR/tests/fixture/stylesheet/cdo-and-cdc/input.css:6:5]
6 | color: red;
: ^^^^^^^^^^
`----
x Declaration
,-[$DIR/tests/fixture/stylesheet/cdo-and-cdc/input.css:6:5]
6 | color: red;
: ^^^^^^^^^^
`----
x DeclarationName
,-[$DIR/tests/fixture/stylesheet/cdo-and-cdc/input.css:6:5]
6 | color: red;
: ^^^^^
`----
x Ident
,-[$DIR/tests/fixture/stylesheet/cdo-and-cdc/input.css:6:5]
6 | color: red;
: ^^^^^
`----
x ComponentValue
,-[$DIR/tests/fixture/stylesheet/cdo-and-cdc/input.css:6:5]
6 | color: red;
: ^^^
`----
x Ident
,-[$DIR/tests/fixture/stylesheet/cdo-and-cdc/input.css:6:5]
6 | color: red;
: ^^^
`----

View File

@ -23,13 +23,13 @@
: ^^^
`----
x Expected whitespace, semicolon, EOF, at-keyword or ident token
x Expected whitespace, ';', '@', ident or EOF
,-[$DIR/tests/recovery/at-rule/font-face/input.css:10:5]
10 | 123
: ^^^
`----
x Expected whitespace, semicolon, EOF, at-keyword or ident token
x Expected whitespace, ';', '@', ident or EOF
,-[$DIR/tests/recovery/at-rule/font-face/input.css:14:5]
14 | 123;
: ^^^

View File

@ -30,3 +30,9 @@ test
color: blue;
}
a {
<!-- .class {
color: red;
}
}

View File

@ -2,7 +2,7 @@
"type": "Stylesheet",
"span": {
"start": 1,
"end": 174,
"end": 227,
"ctxt": 0
},
"rules": [
@ -709,6 +709,220 @@
}
]
}
},
{
"type": "QualifiedRule",
"span": {
"start": 175,
"end": 226,
"ctxt": 0
},
"prelude": {
"type": "SelectorList",
"span": {
"start": 175,
"end": 176,
"ctxt": 0
},
"children": [
{
"type": "ComplexSelector",
"span": {
"start": 175,
"end": 176,
"ctxt": 0
},
"children": [
{
"type": "CompoundSelector",
"span": {
"start": 175,
"end": 176,
"ctxt": 0
},
"nestingSelector": null,
"typeSelector": {
"type": "TagNameSelector",
"span": {
"start": 175,
"end": 176,
"ctxt": 0
},
"name": {
"type": "WqName",
"span": {
"start": 175,
"end": 176,
"ctxt": 0
},
"prefix": null,
"value": {
"type": "Ident",
"span": {
"start": 175,
"end": 176,
"ctxt": 0
},
"value": "a",
"raw": "a"
}
}
},
"subclassSelectors": []
}
]
}
]
},
"block": {
"type": "SimpleBlock",
"span": {
"start": 177,
"end": 226,
"ctxt": 0
},
"name": {
"type": "PreservedToken",
"span": {
"start": 177,
"end": 178,
"ctxt": 0
},
"token": "LBrace"
},
"value": [
{
"type": "QualifiedRule",
"span": {
"start": 183,
"end": 224,
"ctxt": 0
},
"prelude": {
"type": "ListOfComponentValues",
"span": {
"start": 183,
"end": 195,
"ctxt": 0
},
"children": [
{
"type": "PreservedToken",
"span": {
"start": 183,
"end": 187,
"ctxt": 0
},
"token": "CDO"
},
{
"type": "PreservedToken",
"span": {
"start": 187,
"end": 188,
"ctxt": 0
},
"token": {
"WhiteSpace": {
"value": " "
}
}
},
{
"type": "PreservedToken",
"span": {
"start": 188,
"end": 189,
"ctxt": 0
},
"token": {
"Delim": {
"value": "."
}
}
},
{
"type": "PreservedToken",
"span": {
"start": 189,
"end": 194,
"ctxt": 0
},
"token": {
"Ident": {
"value": "class",
"raw": "class"
}
}
},
{
"type": "PreservedToken",
"span": {
"start": 194,
"end": 195,
"ctxt": 0
},
"token": {
"WhiteSpace": {
"value": " "
}
}
}
]
},
"block": {
"type": "SimpleBlock",
"span": {
"start": 195,
"end": 224,
"ctxt": 0
},
"name": {
"type": "PreservedToken",
"span": {
"start": 195,
"end": 196,
"ctxt": 0
},
"token": "LBrace"
},
"value": [
{
"type": "Declaration",
"span": {
"start": 206,
"end": 216,
"ctxt": 0
},
"name": {
"type": "Ident",
"span": {
"start": 206,
"end": 211,
"ctxt": 0
},
"value": "color",
"raw": "color"
},
"value": [
{
"type": "Ident",
"span": {
"start": 213,
"end": 216,
"ctxt": 0
},
"value": "red",
"raw": "red"
}
],
"important": null
}
]
}
}
]
}
}
]
}

View File

@ -1,10 +1,28 @@
x Expected '{'
,-[$DIR/tests/recovery/cdo-and-cdc/input.css:20:5]
20 | color: blue;
: ^
`----
x Expected '{'
,-[$DIR/tests/recovery/cdo-and-cdc/input.css:29:1]
29 | -->;
: ^
`----
x Invalid selector
,-[$DIR/tests/recovery/cdo-and-cdc/input.css:1:1]
1 | <!-- 123 -->
: ^^^
`----
x Invalid selector
,-[$DIR/tests/recovery/cdo-and-cdc/input.css:35:5]
35 | <!-- .class {
: ^^^^
`----
x Unexpected end of file, but expected '{'
,-[$DIR/tests/recovery/cdo-and-cdc/input.css:5:1]
5 | ,-> <!--
@ -15,26 +33,6 @@
10 | }
`----
x Unexpected end of file, but expected '{'
,-[$DIR/tests/recovery/cdo-and-cdc/input.css:14:1]
14 | ,-> <!--
15 | |
16 | | test
17 | |
18 | | -->
19 | |
20 | `-> color: blue;
`----
x Unexpected end of file, but expected '{'
,-[$DIR/tests/recovery/cdo-and-cdc/input.css:25:1]
25 | ,-> <!--
26 | |
27 | | test
28 | |
29 | `-> -->;
`----
x Unexpected token
,-[$DIR/tests/recovery/cdo-and-cdc/input.css:5:1]
5 | <!--

View File

@ -32,7 +32,13 @@
29 | | -->;
30 | |
31 | | color: blue;
32 | `-> }
32 | | }
33 | |
34 | | a {
35 | | <!-- .class {
36 | | color: red;
37 | | }
38 | `-> }
`----
x Rule
@ -854,3 +860,214 @@
31 | color: blue;
: ^^^^
`----
x Rule
,-[$DIR/tests/recovery/cdo-and-cdc/input.css:34:1]
34 | ,-> a {
35 | | <!-- .class {
36 | | color: red;
37 | | }
38 | `-> }
`----
x QualifiedRule
,-[$DIR/tests/recovery/cdo-and-cdc/input.css:34:1]
34 | ,-> a {
35 | | <!-- .class {
36 | | color: red;
37 | | }
38 | `-> }
`----
x SelectorList
,-[$DIR/tests/recovery/cdo-and-cdc/input.css:34:1]
34 | a {
: ^
`----
x ComplexSelector
,-[$DIR/tests/recovery/cdo-and-cdc/input.css:34:1]
34 | a {
: ^
`----
x CompoundSelector
,-[$DIR/tests/recovery/cdo-and-cdc/input.css:34:1]
34 | a {
: ^
`----
x TypeSelector
,-[$DIR/tests/recovery/cdo-and-cdc/input.css:34:1]
34 | a {
: ^
`----
x TagNameSelector
,-[$DIR/tests/recovery/cdo-and-cdc/input.css:34:1]
34 | a {
: ^
`----
x WqName
,-[$DIR/tests/recovery/cdo-and-cdc/input.css:34:1]
34 | a {
: ^
`----
x Ident
,-[$DIR/tests/recovery/cdo-and-cdc/input.css:34:1]
34 | a {
: ^
`----
x SimpleBlock
,-[$DIR/tests/recovery/cdo-and-cdc/input.css:34:1]
34 | ,-> a {
35 | | <!-- .class {
36 | | color: red;
37 | | }
38 | `-> }
`----
x LBrace
,-[$DIR/tests/recovery/cdo-and-cdc/input.css:34:1]
34 | a {
: ^
`----
x ComponentValue
,-[$DIR/tests/recovery/cdo-and-cdc/input.css:35:5]
35 | ,-> <!-- .class {
36 | | color: red;
37 | `-> }
`----
x StyleBlock
,-[$DIR/tests/recovery/cdo-and-cdc/input.css:35:5]
35 | ,-> <!-- .class {
36 | | color: red;
37 | `-> }
`----
x QualifiedRule
,-[$DIR/tests/recovery/cdo-and-cdc/input.css:35:5]
35 | ,-> <!-- .class {
36 | | color: red;
37 | `-> }
`----
x ComponentValue
,-[$DIR/tests/recovery/cdo-and-cdc/input.css:35:5]
35 | <!-- .class {
: ^^^^
`----
x CDO
,-[$DIR/tests/recovery/cdo-and-cdc/input.css:35:5]
35 | <!-- .class {
: ^^^^
`----
x ComponentValue
,-[$DIR/tests/recovery/cdo-and-cdc/input.css:35:5]
35 | <!-- .class {
: ^
`----
x WhiteSpace { value: " " }
,-[$DIR/tests/recovery/cdo-and-cdc/input.css:35:5]
35 | <!-- .class {
: ^
`----
x ComponentValue
,-[$DIR/tests/recovery/cdo-and-cdc/input.css:35:5]
35 | <!-- .class {
: ^
`----
x Delim { value: '.' }
,-[$DIR/tests/recovery/cdo-and-cdc/input.css:35:5]
35 | <!-- .class {
: ^
`----
x ComponentValue
,-[$DIR/tests/recovery/cdo-and-cdc/input.css:35:5]
35 | <!-- .class {
: ^^^^^
`----
x Ident { value: Atom('class' type=static), raw: "class" }
,-[$DIR/tests/recovery/cdo-and-cdc/input.css:35:5]
35 | <!-- .class {
: ^^^^^
`----
x ComponentValue
,-[$DIR/tests/recovery/cdo-and-cdc/input.css:35:5]
35 | <!-- .class {
: ^
`----
x WhiteSpace { value: " " }
,-[$DIR/tests/recovery/cdo-and-cdc/input.css:35:5]
35 | <!-- .class {
: ^
`----
x SimpleBlock
,-[$DIR/tests/recovery/cdo-and-cdc/input.css:35:5]
35 | ,-> <!-- .class {
36 | | color: red;
37 | `-> }
`----
x LBrace
,-[$DIR/tests/recovery/cdo-and-cdc/input.css:35:5]
35 | <!-- .class {
: ^
`----
x ComponentValue
,-[$DIR/tests/recovery/cdo-and-cdc/input.css:36:10]
36 | color: red;
: ^^^^^^^^^^
`----
x StyleBlock
,-[$DIR/tests/recovery/cdo-and-cdc/input.css:36:10]
36 | color: red;
: ^^^^^^^^^^
`----
x Declaration
,-[$DIR/tests/recovery/cdo-and-cdc/input.css:36:10]
36 | color: red;
: ^^^^^^^^^^
`----
x DeclarationName
,-[$DIR/tests/recovery/cdo-and-cdc/input.css:36:10]
36 | color: red;
: ^^^^^
`----
x Ident
,-[$DIR/tests/recovery/cdo-and-cdc/input.css:36:10]
36 | color: red;
: ^^^^^
`----
x ComponentValue
,-[$DIR/tests/recovery/cdo-and-cdc/input.css:36:10]
36 | color: red;
: ^^^
`----
x Ident
,-[$DIR/tests/recovery/cdo-and-cdc/input.css:36:10]
36 | color: red;
: ^^^
`----

View File

@ -0,0 +1,3 @@
a {
color: red !importan;
}

View File

@ -0,0 +1,169 @@
{
"type": "Stylesheet",
"span": {
"start": 1,
"end": 33,
"ctxt": 0
},
"rules": [
{
"type": "QualifiedRule",
"span": {
"start": 1,
"end": 32,
"ctxt": 0
},
"prelude": {
"type": "SelectorList",
"span": {
"start": 1,
"end": 2,
"ctxt": 0
},
"children": [
{
"type": "ComplexSelector",
"span": {
"start": 1,
"end": 2,
"ctxt": 0
},
"children": [
{
"type": "CompoundSelector",
"span": {
"start": 1,
"end": 2,
"ctxt": 0
},
"nestingSelector": null,
"typeSelector": {
"type": "TagNameSelector",
"span": {
"start": 1,
"end": 2,
"ctxt": 0
},
"name": {
"type": "WqName",
"span": {
"start": 1,
"end": 2,
"ctxt": 0
},
"prefix": null,
"value": {
"type": "Ident",
"span": {
"start": 1,
"end": 2,
"ctxt": 0
},
"value": "a",
"raw": "a"
}
}
},
"subclassSelectors": []
}
]
}
]
},
"block": {
"type": "SimpleBlock",
"span": {
"start": 3,
"end": 32,
"ctxt": 0
},
"name": {
"type": "PreservedToken",
"span": {
"start": 3,
"end": 4,
"ctxt": 0
},
"token": "LBrace"
},
"value": [
{
"type": "Declaration",
"span": {
"start": 9,
"end": 29,
"ctxt": 0
},
"name": {
"type": "Ident",
"span": {
"start": 9,
"end": 14,
"ctxt": 0
},
"value": "color",
"raw": "color"
},
"value": [
{
"type": "PreservedToken",
"span": {
"start": 16,
"end": 19,
"ctxt": 0
},
"token": {
"Ident": {
"value": "red",
"raw": "red"
}
}
},
{
"type": "PreservedToken",
"span": {
"start": 19,
"end": 20,
"ctxt": 0
},
"token": {
"WhiteSpace": {
"value": " "
}
}
},
{
"type": "PreservedToken",
"span": {
"start": 20,
"end": 21,
"ctxt": 0
},
"token": {
"Delim": {
"value": "!"
}
}
},
{
"type": "PreservedToken",
"span": {
"start": 21,
"end": 29,
"ctxt": 0
},
"token": {
"Ident": {
"value": "importan",
"raw": "importan"
}
}
}
],
"important": null
}
]
}
}
]
}

View File

@ -0,0 +1,12 @@
x Expected Declaration value
,-[$DIR/tests/recovery/declaration/important-1/input.css:2:5]
2 | color: red !importan;
: ^
`----
x Unexpected '!' in <declaration-value>
,-[$DIR/tests/recovery/declaration/important-1/input.css:2:5]
2 | color: red !importan;
: ^
`----

View File

@ -0,0 +1,154 @@
x Stylesheet
,-[$DIR/tests/recovery/declaration/important-1/input.css:1:1]
1 | ,-> a {
2 | | color: red !importan;
3 | `-> }
`----
x Rule
,-[$DIR/tests/recovery/declaration/important-1/input.css:1:1]
1 | ,-> a {
2 | | color: red !importan;
3 | `-> }
`----
x QualifiedRule
,-[$DIR/tests/recovery/declaration/important-1/input.css:1:1]
1 | ,-> a {
2 | | color: red !importan;
3 | `-> }
`----
x SelectorList
,-[$DIR/tests/recovery/declaration/important-1/input.css:1:1]
1 | a {
: ^
`----
x ComplexSelector
,-[$DIR/tests/recovery/declaration/important-1/input.css:1:1]
1 | a {
: ^
`----
x CompoundSelector
,-[$DIR/tests/recovery/declaration/important-1/input.css:1:1]
1 | a {
: ^
`----
x TypeSelector
,-[$DIR/tests/recovery/declaration/important-1/input.css:1:1]
1 | a {
: ^
`----
x TagNameSelector
,-[$DIR/tests/recovery/declaration/important-1/input.css:1:1]
1 | a {
: ^
`----
x WqName
,-[$DIR/tests/recovery/declaration/important-1/input.css:1:1]
1 | a {
: ^
`----
x Ident
,-[$DIR/tests/recovery/declaration/important-1/input.css:1:1]
1 | a {
: ^
`----
x SimpleBlock
,-[$DIR/tests/recovery/declaration/important-1/input.css:1:1]
1 | ,-> a {
2 | | color: red !importan;
3 | `-> }
`----
x LBrace
,-[$DIR/tests/recovery/declaration/important-1/input.css:1:1]
1 | a {
: ^
`----
x ComponentValue
,-[$DIR/tests/recovery/declaration/important-1/input.css:2:5]
2 | color: red !importan;
: ^^^^^^^^^^^^^^^^^^^^
`----
x StyleBlock
,-[$DIR/tests/recovery/declaration/important-1/input.css:2:5]
2 | color: red !importan;
: ^^^^^^^^^^^^^^^^^^^^
`----
x Declaration
,-[$DIR/tests/recovery/declaration/important-1/input.css:2:5]
2 | color: red !importan;
: ^^^^^^^^^^^^^^^^^^^^
`----
x DeclarationName
,-[$DIR/tests/recovery/declaration/important-1/input.css:2:5]
2 | color: red !importan;
: ^^^^^
`----
x Ident
,-[$DIR/tests/recovery/declaration/important-1/input.css:2:5]
2 | color: red !importan;
: ^^^^^
`----
x ComponentValue
,-[$DIR/tests/recovery/declaration/important-1/input.css:2:5]
2 | color: red !importan;
: ^^^
`----
x Ident { value: Atom('red' type=inline), raw: "red" }
,-[$DIR/tests/recovery/declaration/important-1/input.css:2:5]
2 | color: red !importan;
: ^^^
`----
x ComponentValue
,-[$DIR/tests/recovery/declaration/important-1/input.css:2:5]
2 | color: red !importan;
: ^
`----
x WhiteSpace { value: " " }
,-[$DIR/tests/recovery/declaration/important-1/input.css:2:5]
2 | color: red !importan;
: ^
`----
x ComponentValue
,-[$DIR/tests/recovery/declaration/important-1/input.css:2:5]
2 | color: red !importan;
: ^
`----
x Delim { value: '!' }
,-[$DIR/tests/recovery/declaration/important-1/input.css:2:5]
2 | color: red !importan;
: ^
`----
x ComponentValue
,-[$DIR/tests/recovery/declaration/important-1/input.css:2:5]
2 | color: red !importan;
: ^^^^^^^^
`----
x Ident { value: Atom('importan' type=dynamic), raw: "importan" }
,-[$DIR/tests/recovery/declaration/important-1/input.css:2:5]
2 | color: red !importan;
: ^^^^^^^^
`----

View File

@ -0,0 +1,3 @@
a {
func();
}

View File

@ -0,0 +1,132 @@
{
"type": "Stylesheet",
"span": {
"start": 1,
"end": 19,
"ctxt": 0
},
"rules": [
{
"type": "QualifiedRule",
"span": {
"start": 1,
"end": 18,
"ctxt": 0
},
"prelude": {
"type": "SelectorList",
"span": {
"start": 1,
"end": 2,
"ctxt": 0
},
"children": [
{
"type": "ComplexSelector",
"span": {
"start": 1,
"end": 2,
"ctxt": 0
},
"children": [
{
"type": "CompoundSelector",
"span": {
"start": 1,
"end": 2,
"ctxt": 0
},
"nestingSelector": null,
"typeSelector": {
"type": "TagNameSelector",
"span": {
"start": 1,
"end": 2,
"ctxt": 0
},
"name": {
"type": "WqName",
"span": {
"start": 1,
"end": 2,
"ctxt": 0
},
"prefix": null,
"value": {
"type": "Ident",
"span": {
"start": 1,
"end": 2,
"ctxt": 0
},
"value": "a",
"raw": "a"
}
}
},
"subclassSelectors": []
}
]
}
]
},
"block": {
"type": "SimpleBlock",
"span": {
"start": 3,
"end": 18,
"ctxt": 0
},
"name": {
"type": "PreservedToken",
"span": {
"start": 3,
"end": 4,
"ctxt": 0
},
"token": "LBrace"
},
"value": [
{
"type": "ListOfComponentValues",
"span": {
"start": 9,
"end": 16,
"ctxt": 0
},
"children": [
{
"type": "Function",
"span": {
"start": 9,
"end": 15,
"ctxt": 0
},
"name": {
"type": "Ident",
"span": {
"start": 9,
"end": 13,
"ctxt": 0
},
"value": "func",
"raw": "func"
},
"value": []
},
{
"type": "PreservedToken",
"span": {
"start": 15,
"end": 16,
"ctxt": 0
},
"token": "Semi"
}
]
}
]
}
}
]
}

View File

@ -0,0 +1,6 @@
x Expected ident
,-[$DIR/tests/recovery/declaration/wrong-name-2/input.css:2:5]
2 | func();
: ^^^^^
`----

View File

@ -0,0 +1,118 @@
x Stylesheet
,-[$DIR/tests/recovery/declaration/wrong-name-2/input.css:1:1]
1 | ,-> a {
2 | | func();
3 | `-> }
`----
x Rule
,-[$DIR/tests/recovery/declaration/wrong-name-2/input.css:1:1]
1 | ,-> a {
2 | | func();
3 | `-> }
`----
x QualifiedRule
,-[$DIR/tests/recovery/declaration/wrong-name-2/input.css:1:1]
1 | ,-> a {
2 | | func();
3 | `-> }
`----
x SelectorList
,-[$DIR/tests/recovery/declaration/wrong-name-2/input.css:1:1]
1 | a {
: ^
`----
x ComplexSelector
,-[$DIR/tests/recovery/declaration/wrong-name-2/input.css:1:1]
1 | a {
: ^
`----
x CompoundSelector
,-[$DIR/tests/recovery/declaration/wrong-name-2/input.css:1:1]
1 | a {
: ^
`----
x TypeSelector
,-[$DIR/tests/recovery/declaration/wrong-name-2/input.css:1:1]
1 | a {
: ^
`----
x TagNameSelector
,-[$DIR/tests/recovery/declaration/wrong-name-2/input.css:1:1]
1 | a {
: ^
`----
x WqName
,-[$DIR/tests/recovery/declaration/wrong-name-2/input.css:1:1]
1 | a {
: ^
`----
x Ident
,-[$DIR/tests/recovery/declaration/wrong-name-2/input.css:1:1]
1 | a {
: ^
`----
x SimpleBlock
,-[$DIR/tests/recovery/declaration/wrong-name-2/input.css:1:1]
1 | ,-> a {
2 | | func();
3 | `-> }
`----
x LBrace
,-[$DIR/tests/recovery/declaration/wrong-name-2/input.css:1:1]
1 | a {
: ^
`----
x ComponentValue
,-[$DIR/tests/recovery/declaration/wrong-name-2/input.css:2:5]
2 | func();
: ^^^^^^^
`----
x StyleBlock
,-[$DIR/tests/recovery/declaration/wrong-name-2/input.css:2:5]
2 | func();
: ^^^^^^^
`----
x ComponentValue
,-[$DIR/tests/recovery/declaration/wrong-name-2/input.css:2:5]
2 | func();
: ^^^^^^
`----
x Function
,-[$DIR/tests/recovery/declaration/wrong-name-2/input.css:2:5]
2 | func();
: ^^^^^^
`----
x Ident
,-[$DIR/tests/recovery/declaration/wrong-name-2/input.css:2:5]
2 | func();
: ^^^^
`----
x ComponentValue
,-[$DIR/tests/recovery/declaration/wrong-name-2/input.css:2:5]
2 | func();
: ^
`----
x Semi
,-[$DIR/tests/recovery/declaration/wrong-name-2/input.css:2:5]
2 | func();
: ^
`----

View File

@ -0,0 +1,3 @@
a {
func(20px);
}

View File

@ -0,0 +1,150 @@
{
"type": "Stylesheet",
"span": {
"start": 1,
"end": 23,
"ctxt": 0
},
"rules": [
{
"type": "QualifiedRule",
"span": {
"start": 1,
"end": 22,
"ctxt": 0
},
"prelude": {
"type": "SelectorList",
"span": {
"start": 1,
"end": 2,
"ctxt": 0
},
"children": [
{
"type": "ComplexSelector",
"span": {
"start": 1,
"end": 2,
"ctxt": 0
},
"children": [
{
"type": "CompoundSelector",
"span": {
"start": 1,
"end": 2,
"ctxt": 0
},
"nestingSelector": null,
"typeSelector": {
"type": "TagNameSelector",
"span": {
"start": 1,
"end": 2,
"ctxt": 0
},
"name": {
"type": "WqName",
"span": {
"start": 1,
"end": 2,
"ctxt": 0
},
"prefix": null,
"value": {
"type": "Ident",
"span": {
"start": 1,
"end": 2,
"ctxt": 0
},
"value": "a",
"raw": "a"
}
}
},
"subclassSelectors": []
}
]
}
]
},
"block": {
"type": "SimpleBlock",
"span": {
"start": 3,
"end": 22,
"ctxt": 0
},
"name": {
"type": "PreservedToken",
"span": {
"start": 3,
"end": 4,
"ctxt": 0
},
"token": "LBrace"
},
"value": [
{
"type": "ListOfComponentValues",
"span": {
"start": 9,
"end": 20,
"ctxt": 0
},
"children": [
{
"type": "Function",
"span": {
"start": 9,
"end": 19,
"ctxt": 0
},
"name": {
"type": "Ident",
"span": {
"start": 9,
"end": 13,
"ctxt": 0
},
"value": "func",
"raw": "func"
},
"value": [
{
"type": "PreservedToken",
"span": {
"start": 14,
"end": 18,
"ctxt": 0
},
"token": {
"Dimension": {
"value": 20.0,
"raw_value": "20",
"unit": "px",
"raw_unit": "px",
"type": "integer"
}
}
}
]
},
{
"type": "PreservedToken",
"span": {
"start": 19,
"end": 20,
"ctxt": 0
},
"token": "Semi"
}
]
}
]
}
}
]
}

View File

@ -0,0 +1,6 @@
x Expected ident
,-[$DIR/tests/recovery/declaration/wrong-name-3/input.css:2:5]
2 | func(20px);
: ^^^^^
`----

View File

@ -0,0 +1,130 @@
x Stylesheet
,-[$DIR/tests/recovery/declaration/wrong-name-3/input.css:1:1]
1 | ,-> a {
2 | | func(20px);
3 | `-> }
`----
x Rule
,-[$DIR/tests/recovery/declaration/wrong-name-3/input.css:1:1]
1 | ,-> a {
2 | | func(20px);
3 | `-> }
`----
x QualifiedRule
,-[$DIR/tests/recovery/declaration/wrong-name-3/input.css:1:1]
1 | ,-> a {
2 | | func(20px);
3 | `-> }
`----
x SelectorList
,-[$DIR/tests/recovery/declaration/wrong-name-3/input.css:1:1]
1 | a {
: ^
`----
x ComplexSelector
,-[$DIR/tests/recovery/declaration/wrong-name-3/input.css:1:1]
1 | a {
: ^
`----
x CompoundSelector
,-[$DIR/tests/recovery/declaration/wrong-name-3/input.css:1:1]
1 | a {
: ^
`----
x TypeSelector
,-[$DIR/tests/recovery/declaration/wrong-name-3/input.css:1:1]
1 | a {
: ^
`----
x TagNameSelector
,-[$DIR/tests/recovery/declaration/wrong-name-3/input.css:1:1]
1 | a {
: ^
`----
x WqName
,-[$DIR/tests/recovery/declaration/wrong-name-3/input.css:1:1]
1 | a {
: ^
`----
x Ident
,-[$DIR/tests/recovery/declaration/wrong-name-3/input.css:1:1]
1 | a {
: ^
`----
x SimpleBlock
,-[$DIR/tests/recovery/declaration/wrong-name-3/input.css:1:1]
1 | ,-> a {
2 | | func(20px);
3 | `-> }
`----
x LBrace
,-[$DIR/tests/recovery/declaration/wrong-name-3/input.css:1:1]
1 | a {
: ^
`----
x ComponentValue
,-[$DIR/tests/recovery/declaration/wrong-name-3/input.css:2:5]
2 | func(20px);
: ^^^^^^^^^^^
`----
x StyleBlock
,-[$DIR/tests/recovery/declaration/wrong-name-3/input.css:2:5]
2 | func(20px);
: ^^^^^^^^^^^
`----
x ComponentValue
,-[$DIR/tests/recovery/declaration/wrong-name-3/input.css:2:5]
2 | func(20px);
: ^^^^^^^^^^
`----
x Function
,-[$DIR/tests/recovery/declaration/wrong-name-3/input.css:2:5]
2 | func(20px);
: ^^^^^^^^^^
`----
x Ident
,-[$DIR/tests/recovery/declaration/wrong-name-3/input.css:2:5]
2 | func(20px);
: ^^^^
`----
x ComponentValue
,-[$DIR/tests/recovery/declaration/wrong-name-3/input.css:2:5]
2 | func(20px);
: ^^^^
`----
x Dimension { value: 20.0, raw_value: "20", unit: Atom('px' type=static), raw_unit: "px", type_flag: Integer }
,-[$DIR/tests/recovery/declaration/wrong-name-3/input.css:2:5]
2 | func(20px);
: ^^^^
`----
x ComponentValue
,-[$DIR/tests/recovery/declaration/wrong-name-3/input.css:2:5]
2 | func(20px);
: ^
`----
x Semi
,-[$DIR/tests/recovery/declaration/wrong-name-3/input.css:2:5]
2 | func(20px);
: ^
`----

View File

@ -0,0 +1,3 @@
a {
20: red;
}

View File

@ -0,0 +1,164 @@
{
"type": "Stylesheet",
"span": {
"start": 1,
"end": 20,
"ctxt": 0
},
"rules": [
{
"type": "QualifiedRule",
"span": {
"start": 1,
"end": 19,
"ctxt": 0
},
"prelude": {
"type": "SelectorList",
"span": {
"start": 1,
"end": 2,
"ctxt": 0
},
"children": [
{
"type": "ComplexSelector",
"span": {
"start": 1,
"end": 2,
"ctxt": 0
},
"children": [
{
"type": "CompoundSelector",
"span": {
"start": 1,
"end": 2,
"ctxt": 0
},
"nestingSelector": null,
"typeSelector": {
"type": "TagNameSelector",
"span": {
"start": 1,
"end": 2,
"ctxt": 0
},
"name": {
"type": "WqName",
"span": {
"start": 1,
"end": 2,
"ctxt": 0
},
"prefix": null,
"value": {
"type": "Ident",
"span": {
"start": 1,
"end": 2,
"ctxt": 0
},
"value": "a",
"raw": "a"
}
}
},
"subclassSelectors": []
}
]
}
]
},
"block": {
"type": "SimpleBlock",
"span": {
"start": 3,
"end": 19,
"ctxt": 0
},
"name": {
"type": "PreservedToken",
"span": {
"start": 3,
"end": 4,
"ctxt": 0
},
"token": "LBrace"
},
"value": [
{
"type": "ListOfComponentValues",
"span": {
"start": 9,
"end": 17,
"ctxt": 0
},
"children": [
{
"type": "PreservedToken",
"span": {
"start": 9,
"end": 11,
"ctxt": 0
},
"token": {
"Number": {
"value": 20.0,
"raw": "20",
"type": "integer"
}
}
},
{
"type": "PreservedToken",
"span": {
"start": 11,
"end": 12,
"ctxt": 0
},
"token": "Colon"
},
{
"type": "PreservedToken",
"span": {
"start": 12,
"end": 13,
"ctxt": 0
},
"token": {
"WhiteSpace": {
"value": " "
}
}
},
{
"type": "PreservedToken",
"span": {
"start": 13,
"end": 16,
"ctxt": 0
},
"token": {
"Ident": {
"value": "red",
"raw": "red"
}
}
},
{
"type": "PreservedToken",
"span": {
"start": 16,
"end": 17,
"ctxt": 0
},
"token": "Semi"
}
]
}
]
}
}
]
}

View File

@ -0,0 +1,12 @@
x Expected '{'
,-[$DIR/tests/recovery/declaration/wrong-name/input.css:2:5]
2 | 20: red;
: ^
`----
x Unexpected token
,-[$DIR/tests/recovery/declaration/wrong-name/input.css:2:5]
2 | 20: red;
: ^^
`----

View File

@ -0,0 +1,148 @@
x Stylesheet
,-[$DIR/tests/recovery/declaration/wrong-name/input.css:1:1]
1 | ,-> a {
2 | | 20: red;
3 | `-> }
`----
x Rule
,-[$DIR/tests/recovery/declaration/wrong-name/input.css:1:1]
1 | ,-> a {
2 | | 20: red;
3 | `-> }
`----
x QualifiedRule
,-[$DIR/tests/recovery/declaration/wrong-name/input.css:1:1]
1 | ,-> a {
2 | | 20: red;
3 | `-> }
`----
x SelectorList
,-[$DIR/tests/recovery/declaration/wrong-name/input.css:1:1]
1 | a {
: ^
`----
x ComplexSelector
,-[$DIR/tests/recovery/declaration/wrong-name/input.css:1:1]
1 | a {
: ^
`----
x CompoundSelector
,-[$DIR/tests/recovery/declaration/wrong-name/input.css:1:1]
1 | a {
: ^
`----
x TypeSelector
,-[$DIR/tests/recovery/declaration/wrong-name/input.css:1:1]
1 | a {
: ^
`----
x TagNameSelector
,-[$DIR/tests/recovery/declaration/wrong-name/input.css:1:1]
1 | a {
: ^
`----
x WqName
,-[$DIR/tests/recovery/declaration/wrong-name/input.css:1:1]
1 | a {
: ^
`----
x Ident
,-[$DIR/tests/recovery/declaration/wrong-name/input.css:1:1]
1 | a {
: ^
`----
x SimpleBlock
,-[$DIR/tests/recovery/declaration/wrong-name/input.css:1:1]
1 | ,-> a {
2 | | 20: red;
3 | `-> }
`----
x LBrace
,-[$DIR/tests/recovery/declaration/wrong-name/input.css:1:1]
1 | a {
: ^
`----
x ComponentValue
,-[$DIR/tests/recovery/declaration/wrong-name/input.css:2:5]
2 | 20: red;
: ^^^^^^^^
`----
x StyleBlock
,-[$DIR/tests/recovery/declaration/wrong-name/input.css:2:5]
2 | 20: red;
: ^^^^^^^^
`----
x ComponentValue
,-[$DIR/tests/recovery/declaration/wrong-name/input.css:2:5]
2 | 20: red;
: ^^
`----
x Number { value: 20.0, raw: "20", type_flag: Integer }
,-[$DIR/tests/recovery/declaration/wrong-name/input.css:2:5]
2 | 20: red;
: ^^
`----
x ComponentValue
,-[$DIR/tests/recovery/declaration/wrong-name/input.css:2:5]
2 | 20: red;
: ^
`----
x Colon
,-[$DIR/tests/recovery/declaration/wrong-name/input.css:2:5]
2 | 20: red;
: ^
`----
x ComponentValue
,-[$DIR/tests/recovery/declaration/wrong-name/input.css:2:5]
2 | 20: red;
: ^
`----
x WhiteSpace { value: " " }
,-[$DIR/tests/recovery/declaration/wrong-name/input.css:2:5]
2 | 20: red;
: ^
`----
x ComponentValue
,-[$DIR/tests/recovery/declaration/wrong-name/input.css:2:5]
2 | 20: red;
: ^^^
`----
x Ident { value: Atom('red' type=inline), raw: "red" }
,-[$DIR/tests/recovery/declaration/wrong-name/input.css:2:5]
2 | 20: red;
: ^^^
`----
x ComponentValue
,-[$DIR/tests/recovery/declaration/wrong-name/input.css:2:5]
2 | 20: red;
: ^
`----
x Semi
,-[$DIR/tests/recovery/declaration/wrong-name/input.css:2:5]
2 | 20: red;
: ^
`----

View File

@ -1,6 +1,6 @@
x Expected Declaration value
,-[$DIR/tests/recovery/function-token/input.css:2:5]
,-[$DIR/tests/recovery/function/nested-unclosed/input.css:2:5]
2 | prop: url("test") :
: ^
`----

View File

@ -1,163 +1,163 @@
x Stylesheet
,-[$DIR/tests/recovery/function-token/input.css:1:1]
,-[$DIR/tests/recovery/function/nested-unclosed/input.css:1:1]
1 | ,-> a {
2 | | prop: url("test") :
3 | `-> }
`----
x Rule
,-[$DIR/tests/recovery/function-token/input.css:1:1]
,-[$DIR/tests/recovery/function/nested-unclosed/input.css:1:1]
1 | ,-> a {
2 | | prop: url("test") :
3 | `-> }
`----
x QualifiedRule
,-[$DIR/tests/recovery/function-token/input.css:1:1]
,-[$DIR/tests/recovery/function/nested-unclosed/input.css:1:1]
1 | ,-> a {
2 | | prop: url("test") :
3 | `-> }
`----
x SelectorList
,-[$DIR/tests/recovery/function-token/input.css:1:1]
,-[$DIR/tests/recovery/function/nested-unclosed/input.css:1:1]
1 | a {
: ^
`----
x ComplexSelector
,-[$DIR/tests/recovery/function-token/input.css:1:1]
,-[$DIR/tests/recovery/function/nested-unclosed/input.css:1:1]
1 | a {
: ^
`----
x CompoundSelector
,-[$DIR/tests/recovery/function-token/input.css:1:1]
,-[$DIR/tests/recovery/function/nested-unclosed/input.css:1:1]
1 | a {
: ^
`----
x TypeSelector
,-[$DIR/tests/recovery/function-token/input.css:1:1]
,-[$DIR/tests/recovery/function/nested-unclosed/input.css:1:1]
1 | a {
: ^
`----
x TagNameSelector
,-[$DIR/tests/recovery/function-token/input.css:1:1]
,-[$DIR/tests/recovery/function/nested-unclosed/input.css:1:1]
1 | a {
: ^
`----
x WqName
,-[$DIR/tests/recovery/function-token/input.css:1:1]
,-[$DIR/tests/recovery/function/nested-unclosed/input.css:1:1]
1 | a {
: ^
`----
x Ident
,-[$DIR/tests/recovery/function-token/input.css:1:1]
,-[$DIR/tests/recovery/function/nested-unclosed/input.css:1:1]
1 | a {
: ^
`----
x SimpleBlock
,-[$DIR/tests/recovery/function-token/input.css:1:1]
,-[$DIR/tests/recovery/function/nested-unclosed/input.css:1:1]
1 | ,-> a {
2 | | prop: url("test") :
3 | `-> }
`----
x LBrace
,-[$DIR/tests/recovery/function-token/input.css:1:1]
,-[$DIR/tests/recovery/function/nested-unclosed/input.css:1:1]
1 | a {
: ^
`----
x ComponentValue
,-[$DIR/tests/recovery/function-token/input.css:2:5]
,-[$DIR/tests/recovery/function/nested-unclosed/input.css:2:5]
2 | prop: url("test") :
: ^^^^^^^^^^^^^^^^^^^^
3 | }
`----
x StyleBlock
,-[$DIR/tests/recovery/function-token/input.css:2:5]
,-[$DIR/tests/recovery/function/nested-unclosed/input.css:2:5]
2 | prop: url("test") :
: ^^^^^^^^^^^^^^^^^^^^
3 | }
`----
x Declaration
,-[$DIR/tests/recovery/function-token/input.css:2:5]
,-[$DIR/tests/recovery/function/nested-unclosed/input.css:2:5]
2 | prop: url("test") :
: ^^^^^^^^^^^^^^^^^^^^
3 | }
`----
x DeclarationName
,-[$DIR/tests/recovery/function-token/input.css:2:5]
,-[$DIR/tests/recovery/function/nested-unclosed/input.css:2:5]
2 | prop: url("test") :
: ^^^^
`----
x Ident
,-[$DIR/tests/recovery/function-token/input.css:2:5]
,-[$DIR/tests/recovery/function/nested-unclosed/input.css:2:5]
2 | prop: url("test") :
: ^^^^
`----
x ComponentValue
,-[$DIR/tests/recovery/function-token/input.css:2:5]
,-[$DIR/tests/recovery/function/nested-unclosed/input.css:2:5]
2 | prop: url("test") :
: ^^^^^^^^^^^
`----
x Function
,-[$DIR/tests/recovery/function-token/input.css:2:5]
,-[$DIR/tests/recovery/function/nested-unclosed/input.css:2:5]
2 | prop: url("test") :
: ^^^^^^^^^^^
`----
x Ident
,-[$DIR/tests/recovery/function-token/input.css:2:5]
,-[$DIR/tests/recovery/function/nested-unclosed/input.css:2:5]
2 | prop: url("test") :
: ^^^
`----
x ComponentValue
,-[$DIR/tests/recovery/function-token/input.css:2:5]
,-[$DIR/tests/recovery/function/nested-unclosed/input.css:2:5]
2 | prop: url("test") :
: ^^^^^^
`----
x String { value: Atom('test' type=inline), raw: "\"test\"" }
,-[$DIR/tests/recovery/function-token/input.css:2:5]
,-[$DIR/tests/recovery/function/nested-unclosed/input.css:2:5]
2 | prop: url("test") :
: ^^^^^^
`----
x ComponentValue
,-[$DIR/tests/recovery/function-token/input.css:2:5]
,-[$DIR/tests/recovery/function/nested-unclosed/input.css:2:5]
2 | prop: url("test") :
: ^
`----
x WhiteSpace { value: " " }
,-[$DIR/tests/recovery/function-token/input.css:2:5]
,-[$DIR/tests/recovery/function/nested-unclosed/input.css:2:5]
2 | prop: url("test") :
: ^
`----
x ComponentValue
,-[$DIR/tests/recovery/function-token/input.css:2:5]
,-[$DIR/tests/recovery/function/nested-unclosed/input.css:2:5]
2 | prop: url("test") :
: ^
`----
x Colon
,-[$DIR/tests/recovery/function-token/input.css:2:5]
,-[$DIR/tests/recovery/function/nested-unclosed/input.css:2:5]
2 | prop: url("test") :
: ^
`----

View File

@ -1,4 +1,160 @@
x Expected '{'
,-[$DIR/tests/recovery/hacks/input.css:13:1]
13 | .selector { (;property: value;); }
: ^
`----
x Expected '{'
,-[$DIR/tests/recovery/hacks/input.css:14:1]
14 | .selector { [;property: value;]; }
: ^
`----
x Expected '{'
,-[$DIR/tests/recovery/hacks/input.css:104:5]
104 | !property: value;
: ^
`----
x Expected '{'
,-[$DIR/tests/recovery/hacks/input.css:108:5]
108 | $property: value;
: ^
`----
x Expected '{'
,-[$DIR/tests/recovery/hacks/input.css:112:5]
112 | &property: value;
: ^
`----
x Expected '{'
,-[$DIR/tests/recovery/hacks/input.css:116:5]
116 | *property: value;
: ^
`----
x Expected '{'
,-[$DIR/tests/recovery/hacks/input.css:120:5]
120 | )property: value;
: ^
`----
x Expected '{'
,-[$DIR/tests/recovery/hacks/input.css:124:5]
124 | =property: value;
: ^
`----
x Expected '{'
,-[$DIR/tests/recovery/hacks/input.css:128:5]
128 | %property: value;
: ^
`----
x Expected '{'
,-[$DIR/tests/recovery/hacks/input.css:132:5]
132 | +property: value;
: ^
`----
x Expected '{'
,-[$DIR/tests/recovery/hacks/input.css:140:5]
140 | ,property: value;
: ^
`----
x Expected '{'
,-[$DIR/tests/recovery/hacks/input.css:144:5]
144 | .property: value;
: ^
`----
x Expected '{'
,-[$DIR/tests/recovery/hacks/input.css:148:5]
148 | /property: value;
: ^
`----
x Expected '{'
,-[$DIR/tests/recovery/hacks/input.css:152:5]
152 | `property: value;
: ^
`----
x Expected '{'
,-[$DIR/tests/recovery/hacks/input.css:156:5]
156 | ]property: value;
: ^
`----
x Expected '{'
,-[$DIR/tests/recovery/hacks/input.css:160:5]
160 | #property: value;
: ^
`----
x Expected '{'
,-[$DIR/tests/recovery/hacks/input.css:164:5]
164 | ~property: value;
: ^
`----
x Expected '{'
,-[$DIR/tests/recovery/hacks/input.css:168:5]
168 | ?property: value;
: ^
`----
x Expected '{'
,-[$DIR/tests/recovery/hacks/input.css:172:5]
172 | :property: value;
: ^
`----
x Expected '{'
,-[$DIR/tests/recovery/hacks/input.css:176:5]
176 | |property: value;
: ^
`----
x Expected '{'
,-[$DIR/tests/recovery/hacks/input.css:204:1]
204 | .selector { (;property: value;); }
: ^
`----
x Expected '{'
,-[$DIR/tests/recovery/hacks/input.css:205:1]
205 | .selector { [;property: value;]; }
: ^
`----
x Expected '{'
,-[$DIR/tests/recovery/hacks/input.css:225:1]
225 | .selector { (;property: value;); }
: ^
`----
x Expected '{'
,-[$DIR/tests/recovery/hacks/input.css:226:1]
226 | .selector { [;property: value;]; }
: ^
`----
x Expected '{'
,-[$DIR/tests/recovery/hacks/input.css:244:5]
244 | *color : black;
: ^
`----
x Expected '{'
,-[$DIR/tests/recovery/hacks/input.css:247:5]
247 | $(var)-size: 100%;
: ^
`----
x Expected Declaration value
,-[$DIR/tests/recovery/hacks/input.css:180:1]
180 | .selector { property: value !ie; }
@ -17,162 +173,6 @@
: ^
`----
x Unexpected end of file, but expected '{'
,-[$DIR/tests/recovery/hacks/input.css:13:1]
13 | .selector { (;property: value;); }
: ^^^^^^^^^^^^^^^^^^^
`----
x Unexpected end of file, but expected '{'
,-[$DIR/tests/recovery/hacks/input.css:14:1]
14 | .selector { [;property: value;]; }
: ^^^^^^^^^^^^^^^^^^^
`----
x Unexpected end of file, but expected '{'
,-[$DIR/tests/recovery/hacks/input.css:104:5]
104 | !property: value;
: ^^^^^^^^^^^^^^^^
`----
x Unexpected end of file, but expected '{'
,-[$DIR/tests/recovery/hacks/input.css:108:5]
108 | $property: value;
: ^^^^^^^^^^^^^^^^
`----
x Unexpected end of file, but expected '{'
,-[$DIR/tests/recovery/hacks/input.css:112:5]
112 | &property: value;
: ^^^^^^^^^^^^^^^^
`----
x Unexpected end of file, but expected '{'
,-[$DIR/tests/recovery/hacks/input.css:116:5]
116 | *property: value;
: ^^^^^^^^^^^^^^^^
`----
x Unexpected end of file, but expected '{'
,-[$DIR/tests/recovery/hacks/input.css:120:5]
120 | )property: value;
: ^^^^^^^^^^^^^^^^
`----
x Unexpected end of file, but expected '{'
,-[$DIR/tests/recovery/hacks/input.css:124:5]
124 | =property: value;
: ^^^^^^^^^^^^^^^^
`----
x Unexpected end of file, but expected '{'
,-[$DIR/tests/recovery/hacks/input.css:128:5]
128 | %property: value;
: ^^^^^^^^^^^^^^^^
`----
x Unexpected end of file, but expected '{'
,-[$DIR/tests/recovery/hacks/input.css:132:5]
132 | +property: value;
: ^^^^^^^^^^^^^^^^
`----
x Unexpected end of file, but expected '{'
,-[$DIR/tests/recovery/hacks/input.css:140:5]
140 | ,property: value;
: ^^^^^^^^^^^^^^^^
`----
x Unexpected end of file, but expected '{'
,-[$DIR/tests/recovery/hacks/input.css:144:5]
144 | .property: value;
: ^^^^^^^^^^^^^^^^
`----
x Unexpected end of file, but expected '{'
,-[$DIR/tests/recovery/hacks/input.css:148:5]
148 | /property: value;
: ^^^^^^^^^^^^^^^^
`----
x Unexpected end of file, but expected '{'
,-[$DIR/tests/recovery/hacks/input.css:152:5]
152 | `property: value;
: ^^^^^^^^^^^^^^^^
`----
x Unexpected end of file, but expected '{'
,-[$DIR/tests/recovery/hacks/input.css:156:5]
156 | ]property: value;
: ^^^^^^^^^^^^^^^^
`----
x Unexpected end of file, but expected '{'
,-[$DIR/tests/recovery/hacks/input.css:160:5]
160 | #property: value;
: ^^^^^^^^^^^^^^^^
`----
x Unexpected end of file, but expected '{'
,-[$DIR/tests/recovery/hacks/input.css:164:5]
164 | ~property: value;
: ^^^^^^^^^^^^^^^^
`----
x Unexpected end of file, but expected '{'
,-[$DIR/tests/recovery/hacks/input.css:168:5]
168 | ?property: value;
: ^^^^^^^^^^^^^^^^
`----
x Unexpected end of file, but expected '{'
,-[$DIR/tests/recovery/hacks/input.css:172:5]
172 | :property: value;
: ^^^^^^^^^^^^^^^^
`----
x Unexpected end of file, but expected '{'
,-[$DIR/tests/recovery/hacks/input.css:176:5]
176 | |property: value;
: ^^^^^^^^^^^^^^^^
`----
x Unexpected end of file, but expected '{'
,-[$DIR/tests/recovery/hacks/input.css:204:1]
204 | .selector { (;property: value;); }
: ^^^^^^^^^^^^^^^^^^^
`----
x Unexpected end of file, but expected '{'
,-[$DIR/tests/recovery/hacks/input.css:205:1]
205 | .selector { [;property: value;]; }
: ^^^^^^^^^^^^^^^^^^^
`----
x Unexpected end of file, but expected '{'
,-[$DIR/tests/recovery/hacks/input.css:225:1]
225 | .selector { (;property: value;); }
: ^^^^^^^^^^^^^^^^^^^
`----
x Unexpected end of file, but expected '{'
,-[$DIR/tests/recovery/hacks/input.css:226:1]
226 | .selector { [;property: value;]; }
: ^^^^^^^^^^^^^^^^^^^
`----
x Unexpected end of file, but expected '{'
,-[$DIR/tests/recovery/hacks/input.css:244:5]
244 | *color : black;
: ^^^^^^^^^^^^^^
`----
x Unexpected end of file, but expected '{'
,-[$DIR/tests/recovery/hacks/input.css:247:5]
247 | $(var)-size: 100%;
: ^^^^^^^^^^^^^^^^^
`----
x Unexpected end of file, but expected '{'
,-[$DIR/tests/recovery/hacks/input.css:250:1]
250 | a{*b:c}

View File

@ -0,0 +1 @@
@media screen {

View File

@ -0,0 +1,77 @@
{
"type": "Stylesheet",
"span": {
"start": 1,
"end": 17,
"ctxt": 0
},
"rules": [
{
"type": "AtRule",
"span": {
"start": 1,
"end": 17,
"ctxt": 0
},
"name": {
"type": "Ident",
"span": {
"start": 2,
"end": 7,
"ctxt": 0
},
"value": "media",
"raw": "media"
},
"prelude": {
"type": "MediaQueryList",
"span": {
"start": 8,
"end": 14,
"ctxt": 0
},
"queries": [
{
"type": "MediaQuery",
"span": {
"start": 8,
"end": 14,
"ctxt": 0
},
"modifier": null,
"mediaType": {
"type": "Ident",
"span": {
"start": 8,
"end": 14,
"ctxt": 0
},
"value": "screen",
"raw": "screen"
},
"keyword": null,
"condition": null
}
]
},
"block": {
"type": "SimpleBlock",
"span": {
"start": 15,
"end": 17,
"ctxt": 0
},
"name": {
"type": "PreservedToken",
"span": {
"start": 15,
"end": 16,
"ctxt": 0
},
"token": "LBrace"
},
"value": []
}
}
]
}

View File

@ -0,0 +1,6 @@
x Unexpected end of file, but expected '}'
,-[$DIR/tests/recovery/simple-block/unclosed-1/input.css:1:1]
1 | @media screen {
: ^^
`----

View File

@ -0,0 +1,66 @@
x Stylesheet
,-[$DIR/tests/recovery/simple-block/unclosed-1/input.css:1:1]
1 | @media screen {
: ^^^^^^^^^^^^^^^^
`----
x Rule
,-[$DIR/tests/recovery/simple-block/unclosed-1/input.css:1:1]
1 | @media screen {
: ^^^^^^^^^^^^^^^^
`----
x AtRule
,-[$DIR/tests/recovery/simple-block/unclosed-1/input.css:1:1]
1 | @media screen {
: ^^^^^^^^^^^^^^^^
`----
x AtRuleName
,-[$DIR/tests/recovery/simple-block/unclosed-1/input.css:1:1]
1 | @media screen {
: ^^^^^
`----
x Ident
,-[$DIR/tests/recovery/simple-block/unclosed-1/input.css:1:1]
1 | @media screen {
: ^^^^^
`----
x MediaQueryList
,-[$DIR/tests/recovery/simple-block/unclosed-1/input.css:1:1]
1 | @media screen {
: ^^^^^^
`----
x MediaQuery
,-[$DIR/tests/recovery/simple-block/unclosed-1/input.css:1:1]
1 | @media screen {
: ^^^^^^
`----
x MediaType
,-[$DIR/tests/recovery/simple-block/unclosed-1/input.css:1:1]
1 | @media screen {
: ^^^^^^
`----
x Ident
,-[$DIR/tests/recovery/simple-block/unclosed-1/input.css:1:1]
1 | @media screen {
: ^^^^^^
`----
x SimpleBlock
,-[$DIR/tests/recovery/simple-block/unclosed-1/input.css:1:1]
1 | @media screen {
: ^^
`----
x LBrace
,-[$DIR/tests/recovery/simple-block/unclosed-1/input.css:1:1]
1 | @media screen {
: ^
`----

View File

@ -0,0 +1,3 @@
@media screen {
a {
color: red;

View File

@ -0,0 +1,193 @@
{
"type": "Stylesheet",
"span": {
"start": 1,
"end": 45,
"ctxt": 0
},
"rules": [
{
"type": "AtRule",
"span": {
"start": 1,
"end": 45,
"ctxt": 0
},
"name": {
"type": "Ident",
"span": {
"start": 2,
"end": 7,
"ctxt": 0
},
"value": "media",
"raw": "media"
},
"prelude": {
"type": "MediaQueryList",
"span": {
"start": 8,
"end": 14,
"ctxt": 0
},
"queries": [
{
"type": "MediaQuery",
"span": {
"start": 8,
"end": 14,
"ctxt": 0
},
"modifier": null,
"mediaType": {
"type": "Ident",
"span": {
"start": 8,
"end": 14,
"ctxt": 0
},
"value": "screen",
"raw": "screen"
},
"keyword": null,
"condition": null
}
]
},
"block": {
"type": "SimpleBlock",
"span": {
"start": 15,
"end": 45,
"ctxt": 0
},
"name": {
"type": "PreservedToken",
"span": {
"start": 15,
"end": 16,
"ctxt": 0
},
"token": "LBrace"
},
"value": [
{
"type": "QualifiedRule",
"span": {
"start": 21,
"end": 45,
"ctxt": 0
},
"prelude": {
"type": "SelectorList",
"span": {
"start": 21,
"end": 22,
"ctxt": 0
},
"children": [
{
"type": "ComplexSelector",
"span": {
"start": 21,
"end": 22,
"ctxt": 0
},
"children": [
{
"type": "CompoundSelector",
"span": {
"start": 21,
"end": 22,
"ctxt": 0
},
"nestingSelector": null,
"typeSelector": {
"type": "TagNameSelector",
"span": {
"start": 21,
"end": 22,
"ctxt": 0
},
"name": {
"type": "WqName",
"span": {
"start": 21,
"end": 22,
"ctxt": 0
},
"prefix": null,
"value": {
"type": "Ident",
"span": {
"start": 21,
"end": 22,
"ctxt": 0
},
"value": "a",
"raw": "a"
}
}
},
"subclassSelectors": []
}
]
}
]
},
"block": {
"type": "SimpleBlock",
"span": {
"start": 23,
"end": 45,
"ctxt": 0
},
"name": {
"type": "PreservedToken",
"span": {
"start": 23,
"end": 24,
"ctxt": 0
},
"token": "LBrace"
},
"value": [
{
"type": "Declaration",
"span": {
"start": 33,
"end": 43,
"ctxt": 0
},
"name": {
"type": "Ident",
"span": {
"start": 33,
"end": 38,
"ctxt": 0
},
"value": "color",
"raw": "color"
},
"value": [
{
"type": "Ident",
"span": {
"start": 40,
"end": 43,
"ctxt": 0
},
"value": "red",
"raw": "red"
}
],
"important": null
}
]
}
}
]
}
}
]
}

View File

@ -0,0 +1,13 @@
x Unexpected end of file, but expected '}'
,-[$DIR/tests/recovery/simple-block/unclosed-2/input.css:2:5]
2 | ,-> a {
3 | `-> color: red;
`----
x Unexpected end of file, but expected '}'
,-[$DIR/tests/recovery/simple-block/unclosed-2/input.css:1:1]
1 | ,-> @media screen {
2 | | a {
3 | `-> color: red;
`----

View File

@ -0,0 +1,184 @@
x Stylesheet
,-[$DIR/tests/recovery/simple-block/unclosed-2/input.css:1:1]
1 | ,-> @media screen {
2 | | a {
3 | `-> color: red;
`----
x Rule
,-[$DIR/tests/recovery/simple-block/unclosed-2/input.css:1:1]
1 | ,-> @media screen {
2 | | a {
3 | `-> color: red;
`----
x AtRule
,-[$DIR/tests/recovery/simple-block/unclosed-2/input.css:1:1]
1 | ,-> @media screen {
2 | | a {
3 | `-> color: red;
`----
x AtRuleName
,-[$DIR/tests/recovery/simple-block/unclosed-2/input.css:1:1]
1 | @media screen {
: ^^^^^
`----
x Ident
,-[$DIR/tests/recovery/simple-block/unclosed-2/input.css:1:1]
1 | @media screen {
: ^^^^^
`----
x MediaQueryList
,-[$DIR/tests/recovery/simple-block/unclosed-2/input.css:1:1]
1 | @media screen {
: ^^^^^^
`----
x MediaQuery
,-[$DIR/tests/recovery/simple-block/unclosed-2/input.css:1:1]
1 | @media screen {
: ^^^^^^
`----
x MediaType
,-[$DIR/tests/recovery/simple-block/unclosed-2/input.css:1:1]
1 | @media screen {
: ^^^^^^
`----
x Ident
,-[$DIR/tests/recovery/simple-block/unclosed-2/input.css:1:1]
1 | @media screen {
: ^^^^^^
`----
x SimpleBlock
,-[$DIR/tests/recovery/simple-block/unclosed-2/input.css:1:1]
1 | ,-> @media screen {
2 | | a {
3 | `-> color: red;
`----
x LBrace
,-[$DIR/tests/recovery/simple-block/unclosed-2/input.css:1:1]
1 | @media screen {
: ^
`----
x ComponentValue
,-[$DIR/tests/recovery/simple-block/unclosed-2/input.css:2:5]
2 | ,-> a {
3 | `-> color: red;
`----
x Rule
,-[$DIR/tests/recovery/simple-block/unclosed-2/input.css:2:5]
2 | ,-> a {
3 | `-> color: red;
`----
x QualifiedRule
,-[$DIR/tests/recovery/simple-block/unclosed-2/input.css:2:5]
2 | ,-> a {
3 | `-> color: red;
`----
x SelectorList
,-[$DIR/tests/recovery/simple-block/unclosed-2/input.css:2:5]
2 | a {
: ^
`----
x ComplexSelector
,-[$DIR/tests/recovery/simple-block/unclosed-2/input.css:2:5]
2 | a {
: ^
`----
x CompoundSelector
,-[$DIR/tests/recovery/simple-block/unclosed-2/input.css:2:5]
2 | a {
: ^
`----
x TypeSelector
,-[$DIR/tests/recovery/simple-block/unclosed-2/input.css:2:5]
2 | a {
: ^
`----
x TagNameSelector
,-[$DIR/tests/recovery/simple-block/unclosed-2/input.css:2:5]
2 | a {
: ^
`----
x WqName
,-[$DIR/tests/recovery/simple-block/unclosed-2/input.css:2:5]
2 | a {
: ^
`----
x Ident
,-[$DIR/tests/recovery/simple-block/unclosed-2/input.css:2:5]
2 | a {
: ^
`----
x SimpleBlock
,-[$DIR/tests/recovery/simple-block/unclosed-2/input.css:2:5]
2 | ,-> a {
3 | `-> color: red;
`----
x LBrace
,-[$DIR/tests/recovery/simple-block/unclosed-2/input.css:2:5]
2 | a {
: ^
`----
x ComponentValue
,-[$DIR/tests/recovery/simple-block/unclosed-2/input.css:3:9]
3 | color: red;
: ^^^^^^^^^^
`----
x StyleBlock
,-[$DIR/tests/recovery/simple-block/unclosed-2/input.css:3:9]
3 | color: red;
: ^^^^^^^^^^
`----
x Declaration
,-[$DIR/tests/recovery/simple-block/unclosed-2/input.css:3:9]
3 | color: red;
: ^^^^^^^^^^
`----
x DeclarationName
,-[$DIR/tests/recovery/simple-block/unclosed-2/input.css:3:9]
3 | color: red;
: ^^^^^
`----
x Ident
,-[$DIR/tests/recovery/simple-block/unclosed-2/input.css:3:9]
3 | color: red;
: ^^^^^
`----
x ComponentValue
,-[$DIR/tests/recovery/simple-block/unclosed-2/input.css:3:9]
3 | color: red;
: ^^^
`----
x Ident
,-[$DIR/tests/recovery/simple-block/unclosed-2/input.css:3:9]
3 | color: red;
: ^^^
`----

View File

@ -0,0 +1,2 @@
a {
color: red;

View File

@ -0,0 +1,125 @@
{
"type": "Stylesheet",
"span": {
"start": 1,
"end": 20,
"ctxt": 0
},
"rules": [
{
"type": "QualifiedRule",
"span": {
"start": 1,
"end": 20,
"ctxt": 0
},
"prelude": {
"type": "SelectorList",
"span": {
"start": 1,
"end": 2,
"ctxt": 0
},
"children": [
{
"type": "ComplexSelector",
"span": {
"start": 1,
"end": 2,
"ctxt": 0
},
"children": [
{
"type": "CompoundSelector",
"span": {
"start": 1,
"end": 2,
"ctxt": 0
},
"nestingSelector": null,
"typeSelector": {
"type": "TagNameSelector",
"span": {
"start": 1,
"end": 2,
"ctxt": 0
},
"name": {
"type": "WqName",
"span": {
"start": 1,
"end": 2,
"ctxt": 0
},
"prefix": null,
"value": {
"type": "Ident",
"span": {
"start": 1,
"end": 2,
"ctxt": 0
},
"value": "a",
"raw": "a"
}
}
},
"subclassSelectors": []
}
]
}
]
},
"block": {
"type": "SimpleBlock",
"span": {
"start": 3,
"end": 20,
"ctxt": 0
},
"name": {
"type": "PreservedToken",
"span": {
"start": 3,
"end": 4,
"ctxt": 0
},
"token": "LBrace"
},
"value": [
{
"type": "Declaration",
"span": {
"start": 9,
"end": 19,
"ctxt": 0
},
"name": {
"type": "Ident",
"span": {
"start": 9,
"end": 14,
"ctxt": 0
},
"value": "color",
"raw": "color"
},
"value": [
{
"type": "Ident",
"span": {
"start": 16,
"end": 19,
"ctxt": 0
},
"value": "red",
"raw": "red"
}
],
"important": null
}
]
}
}
]
}

View File

@ -0,0 +1,6 @@
x Unexpected end of file, but expected '}'
,-[$DIR/tests/recovery/simple-block/unclosed-3/input.css:1:1]
1 | ,-> a {
2 | `-> color: red;
`----

View File

@ -0,0 +1,114 @@
x Stylesheet
,-[$DIR/tests/recovery/simple-block/unclosed-3/input.css:1:1]
1 | ,-> a {
2 | `-> color: red;
`----
x Rule
,-[$DIR/tests/recovery/simple-block/unclosed-3/input.css:1:1]
1 | ,-> a {
2 | `-> color: red;
`----
x QualifiedRule
,-[$DIR/tests/recovery/simple-block/unclosed-3/input.css:1:1]
1 | ,-> a {
2 | `-> color: red;
`----
x SelectorList
,-[$DIR/tests/recovery/simple-block/unclosed-3/input.css:1:1]
1 | a {
: ^
`----
x ComplexSelector
,-[$DIR/tests/recovery/simple-block/unclosed-3/input.css:1:1]
1 | a {
: ^
`----
x CompoundSelector
,-[$DIR/tests/recovery/simple-block/unclosed-3/input.css:1:1]
1 | a {
: ^
`----
x TypeSelector
,-[$DIR/tests/recovery/simple-block/unclosed-3/input.css:1:1]
1 | a {
: ^
`----
x TagNameSelector
,-[$DIR/tests/recovery/simple-block/unclosed-3/input.css:1:1]
1 | a {
: ^
`----
x WqName
,-[$DIR/tests/recovery/simple-block/unclosed-3/input.css:1:1]
1 | a {
: ^
`----
x Ident
,-[$DIR/tests/recovery/simple-block/unclosed-3/input.css:1:1]
1 | a {
: ^
`----
x SimpleBlock
,-[$DIR/tests/recovery/simple-block/unclosed-3/input.css:1:1]
1 | ,-> a {
2 | `-> color: red;
`----
x LBrace
,-[$DIR/tests/recovery/simple-block/unclosed-3/input.css:1:1]
1 | a {
: ^
`----
x ComponentValue
,-[$DIR/tests/recovery/simple-block/unclosed-3/input.css:2:5]
2 | color: red;
: ^^^^^^^^^^
`----
x StyleBlock
,-[$DIR/tests/recovery/simple-block/unclosed-3/input.css:2:5]
2 | color: red;
: ^^^^^^^^^^
`----
x Declaration
,-[$DIR/tests/recovery/simple-block/unclosed-3/input.css:2:5]
2 | color: red;
: ^^^^^^^^^^
`----
x DeclarationName
,-[$DIR/tests/recovery/simple-block/unclosed-3/input.css:2:5]
2 | color: red;
: ^^^^^
`----
x Ident
,-[$DIR/tests/recovery/simple-block/unclosed-3/input.css:2:5]
2 | color: red;
: ^^^^^
`----
x ComponentValue
,-[$DIR/tests/recovery/simple-block/unclosed-3/input.css:2:5]
2 | color: red;
: ^^^
`----
x Ident
,-[$DIR/tests/recovery/simple-block/unclosed-3/input.css:2:5]
2 | color: red;
: ^^^
`----

View File

@ -1,3 +0,0 @@
.style {
grid-template-columns: repeat(4, [col-start);
}

View File

@ -1,233 +0,0 @@
{
"type": "Stylesheet",
"span": {
"start": 1,
"end": 59,
"ctxt": 0
},
"rules": [
{
"type": "QualifiedRule",
"span": {
"start": 1,
"end": 59,
"ctxt": 0
},
"prelude": {
"type": "SelectorList",
"span": {
"start": 1,
"end": 7,
"ctxt": 0
},
"children": [
{
"type": "ComplexSelector",
"span": {
"start": 1,
"end": 7,
"ctxt": 0
},
"children": [
{
"type": "CompoundSelector",
"span": {
"start": 1,
"end": 7,
"ctxt": 0
},
"nestingSelector": null,
"typeSelector": null,
"subclassSelectors": [
{
"type": "ClassSelector",
"span": {
"start": 1,
"end": 7,
"ctxt": 0
},
"text": {
"type": "Ident",
"span": {
"start": 2,
"end": 7,
"ctxt": 0
},
"value": "style",
"raw": "style"
}
}
]
}
]
}
]
},
"block": {
"type": "SimpleBlock",
"span": {
"start": 8,
"end": 59,
"ctxt": 0
},
"name": {
"type": "PreservedToken",
"span": {
"start": 8,
"end": 9,
"ctxt": 0
},
"token": "LBrace"
},
"value": [
{
"type": "Declaration",
"span": {
"start": 11,
"end": 59,
"ctxt": 0
},
"name": {
"type": "Ident",
"span": {
"start": 11,
"end": 32,
"ctxt": 0
},
"value": "grid-template-columns",
"raw": "grid-template-columns"
},
"value": [
{
"type": "Function",
"span": {
"start": 34,
"end": 59,
"ctxt": 0
},
"name": {
"type": "Ident",
"span": {
"start": 34,
"end": 40,
"ctxt": 0
},
"value": "repeat",
"raw": "repeat"
},
"value": [
{
"type": "Integer",
"span": {
"start": 41,
"end": 42,
"ctxt": 0
},
"value": 4,
"raw": "4"
},
{
"type": "Delimiter",
"span": {
"start": 42,
"end": 43,
"ctxt": 0
},
"value": ","
},
{
"type": "SimpleBlock",
"span": {
"start": 44,
"end": 59,
"ctxt": 0
},
"name": {
"type": "PreservedToken",
"span": {
"start": 44,
"end": 45,
"ctxt": 0
},
"token": "LBracket"
},
"value": [
{
"type": "PreservedToken",
"span": {
"start": 45,
"end": 54,
"ctxt": 0
},
"token": {
"Ident": {
"value": "col-start",
"raw": "col-start"
}
}
},
{
"type": "PreservedToken",
"span": {
"start": 54,
"end": 55,
"ctxt": 0
},
"token": "RParen"
},
{
"type": "PreservedToken",
"span": {
"start": 55,
"end": 56,
"ctxt": 0
},
"token": "Semi"
},
{
"type": "PreservedToken",
"span": {
"start": 56,
"end": 57,
"ctxt": 0
},
"token": {
"WhiteSpace": {
"value": "\n"
}
}
},
{
"type": "PreservedToken",
"span": {
"start": 57,
"end": 58,
"ctxt": 0
},
"token": "RBrace"
},
{
"type": "PreservedToken",
"span": {
"start": 58,
"end": 59,
"ctxt": 0
},
"token": {
"WhiteSpace": {
"value": "\n"
}
}
}
]
}
]
}
],
"important": null
}
]
}
}
]
}

View File

@ -1,25 +0,0 @@
x Expected Declaration value
,-[$DIR/tests/recovery/simple-block/unclosed-in-function/input.css:2:5]
2 | grid-template-columns: repeat(4, [col-start);
: ^
`----
x Unexpected end of file, but expected ')'
,-[$DIR/tests/recovery/simple-block/unclosed-in-function/input.css:2:5]
2 | ,-> grid-template-columns: repeat(4, [col-start);
3 | `-> }
`----
x Unexpected end of file, but expected ']'
,-[$DIR/tests/recovery/simple-block/unclosed-in-function/input.css:2:5]
2 | ,-> grid-template-columns: repeat(4, [col-start);
3 | `-> }
`----
x Unexpected end of file, but expected '}'
,-[$DIR/tests/recovery/simple-block/unclosed-in-function/input.css:1:1]
1 | ,-> .style {
2 | | grid-template-columns: repeat(4, [col-start);
3 | `-> }
`----

View File

@ -0,0 +1,4 @@
a {
color: red;
.class {
color: blue

View File

@ -0,0 +1,242 @@
{
"type": "Stylesheet",
"span": {
"start": 1,
"end": 53,
"ctxt": 0
},
"rules": [
{
"type": "QualifiedRule",
"span": {
"start": 1,
"end": 53,
"ctxt": 0
},
"prelude": {
"type": "SelectorList",
"span": {
"start": 1,
"end": 2,
"ctxt": 0
},
"children": [
{
"type": "ComplexSelector",
"span": {
"start": 1,
"end": 2,
"ctxt": 0
},
"children": [
{
"type": "CompoundSelector",
"span": {
"start": 1,
"end": 2,
"ctxt": 0
},
"nestingSelector": null,
"typeSelector": {
"type": "TagNameSelector",
"span": {
"start": 1,
"end": 2,
"ctxt": 0
},
"name": {
"type": "WqName",
"span": {
"start": 1,
"end": 2,
"ctxt": 0
},
"prefix": null,
"value": {
"type": "Ident",
"span": {
"start": 1,
"end": 2,
"ctxt": 0
},
"value": "a",
"raw": "a"
}
}
},
"subclassSelectors": []
}
]
}
]
},
"block": {
"type": "SimpleBlock",
"span": {
"start": 3,
"end": 53,
"ctxt": 0
},
"name": {
"type": "PreservedToken",
"span": {
"start": 3,
"end": 4,
"ctxt": 0
},
"token": "LBrace"
},
"value": [
{
"type": "Declaration",
"span": {
"start": 9,
"end": 19,
"ctxt": 0
},
"name": {
"type": "Ident",
"span": {
"start": 9,
"end": 14,
"ctxt": 0
},
"value": "color",
"raw": "color"
},
"value": [
{
"type": "Ident",
"span": {
"start": 16,
"end": 19,
"ctxt": 0
},
"value": "red",
"raw": "red"
}
],
"important": null
},
{
"type": "QualifiedRule",
"span": {
"start": 25,
"end": 53,
"ctxt": 0
},
"prelude": {
"type": "RelativeSelectorList",
"span": {
"start": 25,
"end": 31,
"ctxt": 0
},
"children": [
{
"type": "RelativeSelector",
"span": {
"start": 25,
"end": 31,
"ctxt": 0
},
"combinator": null,
"selector": {
"type": "ComplexSelector",
"span": {
"start": 25,
"end": 31,
"ctxt": 0
},
"children": [
{
"type": "CompoundSelector",
"span": {
"start": 25,
"end": 31,
"ctxt": 0
},
"nestingSelector": null,
"typeSelector": null,
"subclassSelectors": [
{
"type": "ClassSelector",
"span": {
"start": 25,
"end": 31,
"ctxt": 0
},
"text": {
"type": "Ident",
"span": {
"start": 26,
"end": 31,
"ctxt": 0
},
"value": "class",
"raw": "class"
}
}
]
}
]
}
}
]
},
"block": {
"type": "SimpleBlock",
"span": {
"start": 32,
"end": 53,
"ctxt": 0
},
"name": {
"type": "PreservedToken",
"span": {
"start": 32,
"end": 33,
"ctxt": 0
},
"token": "LBrace"
},
"value": [
{
"type": "Declaration",
"span": {
"start": 42,
"end": 53,
"ctxt": 0
},
"name": {
"type": "Ident",
"span": {
"start": 42,
"end": 47,
"ctxt": 0
},
"value": "color",
"raw": "color"
},
"value": [
{
"type": "Ident",
"span": {
"start": 49,
"end": 53,
"ctxt": 0
},
"value": "blue",
"raw": "blue"
}
],
"important": null
}
]
}
}
]
}
}
]
}

View File

@ -0,0 +1,14 @@
x Unexpected end of file, but expected '}'
,-[$DIR/tests/recovery/simple-block/unclosed/input.css:3:5]
3 | ,-> .class {
4 | `-> color: blue
`----
x Unexpected end of file, but expected '}'
,-[$DIR/tests/recovery/simple-block/unclosed/input.css:1:1]
1 | ,-> a {
2 | | color: red;
3 | | .class {
4 | `-> color: blue
`----

View File

@ -0,0 +1,236 @@
x Stylesheet
,-[$DIR/tests/recovery/simple-block/unclosed/input.css:1:1]
1 | ,-> a {
2 | | color: red;
3 | | .class {
4 | `-> color: blue
`----
x Rule
,-[$DIR/tests/recovery/simple-block/unclosed/input.css:1:1]
1 | ,-> a {
2 | | color: red;
3 | | .class {
4 | `-> color: blue
`----
x QualifiedRule
,-[$DIR/tests/recovery/simple-block/unclosed/input.css:1:1]
1 | ,-> a {
2 | | color: red;
3 | | .class {
4 | `-> color: blue
`----
x SelectorList
,-[$DIR/tests/recovery/simple-block/unclosed/input.css:1:1]
1 | a {
: ^
`----
x ComplexSelector
,-[$DIR/tests/recovery/simple-block/unclosed/input.css:1:1]
1 | a {
: ^
`----
x CompoundSelector
,-[$DIR/tests/recovery/simple-block/unclosed/input.css:1:1]
1 | a {
: ^
`----
x TypeSelector
,-[$DIR/tests/recovery/simple-block/unclosed/input.css:1:1]
1 | a {
: ^
`----
x TagNameSelector
,-[$DIR/tests/recovery/simple-block/unclosed/input.css:1:1]
1 | a {
: ^
`----
x WqName
,-[$DIR/tests/recovery/simple-block/unclosed/input.css:1:1]
1 | a {
: ^
`----
x Ident
,-[$DIR/tests/recovery/simple-block/unclosed/input.css:1:1]
1 | a {
: ^
`----
x SimpleBlock
,-[$DIR/tests/recovery/simple-block/unclosed/input.css:1:1]
1 | ,-> a {
2 | | color: red;
3 | | .class {
4 | `-> color: blue
`----
x LBrace
,-[$DIR/tests/recovery/simple-block/unclosed/input.css:1:1]
1 | a {
: ^
`----
x ComponentValue
,-[$DIR/tests/recovery/simple-block/unclosed/input.css:2:5]
2 | color: red;
: ^^^^^^^^^^
`----
x StyleBlock
,-[$DIR/tests/recovery/simple-block/unclosed/input.css:2:5]
2 | color: red;
: ^^^^^^^^^^
`----
x Declaration
,-[$DIR/tests/recovery/simple-block/unclosed/input.css:2:5]
2 | color: red;
: ^^^^^^^^^^
`----
x DeclarationName
,-[$DIR/tests/recovery/simple-block/unclosed/input.css:2:5]
2 | color: red;
: ^^^^^
`----
x Ident
,-[$DIR/tests/recovery/simple-block/unclosed/input.css:2:5]
2 | color: red;
: ^^^^^
`----
x ComponentValue
,-[$DIR/tests/recovery/simple-block/unclosed/input.css:2:5]
2 | color: red;
: ^^^
`----
x Ident
,-[$DIR/tests/recovery/simple-block/unclosed/input.css:2:5]
2 | color: red;
: ^^^
`----
x ComponentValue
,-[$DIR/tests/recovery/simple-block/unclosed/input.css:3:5]
3 | ,-> .class {
4 | `-> color: blue
`----
x StyleBlock
,-[$DIR/tests/recovery/simple-block/unclosed/input.css:3:5]
3 | ,-> .class {
4 | `-> color: blue
`----
x QualifiedRule
,-[$DIR/tests/recovery/simple-block/unclosed/input.css:3:5]
3 | ,-> .class {
4 | `-> color: blue
`----
x RelativeSelectorList
,-[$DIR/tests/recovery/simple-block/unclosed/input.css:3:5]
3 | .class {
: ^^^^^^
`----
x RelativeSelector
,-[$DIR/tests/recovery/simple-block/unclosed/input.css:3:5]
3 | .class {
: ^^^^^^
`----
x ComplexSelector
,-[$DIR/tests/recovery/simple-block/unclosed/input.css:3:5]
3 | .class {
: ^^^^^^
`----
x CompoundSelector
,-[$DIR/tests/recovery/simple-block/unclosed/input.css:3:5]
3 | .class {
: ^^^^^^
`----
x SubclassSelector
,-[$DIR/tests/recovery/simple-block/unclosed/input.css:3:5]
3 | .class {
: ^^^^^^
`----
x ClassSelector
,-[$DIR/tests/recovery/simple-block/unclosed/input.css:3:5]
3 | .class {
: ^^^^^^
`----
x Ident
,-[$DIR/tests/recovery/simple-block/unclosed/input.css:3:5]
3 | .class {
: ^^^^^
`----
x SimpleBlock
,-[$DIR/tests/recovery/simple-block/unclosed/input.css:3:5]
3 | ,-> .class {
4 | `-> color: blue
`----
x LBrace
,-[$DIR/tests/recovery/simple-block/unclosed/input.css:3:5]
3 | .class {
: ^
`----
x ComponentValue
,-[$DIR/tests/recovery/simple-block/unclosed/input.css:4:9]
4 | color: blue
: ^^^^^^^^^^^
`----
x StyleBlock
,-[$DIR/tests/recovery/simple-block/unclosed/input.css:4:9]
4 | color: blue
: ^^^^^^^^^^^
`----
x Declaration
,-[$DIR/tests/recovery/simple-block/unclosed/input.css:4:9]
4 | color: blue
: ^^^^^^^^^^^
`----
x DeclarationName
,-[$DIR/tests/recovery/simple-block/unclosed/input.css:4:9]
4 | color: blue
: ^^^^^
`----
x Ident
,-[$DIR/tests/recovery/simple-block/unclosed/input.css:4:9]
4 | color: blue
: ^^^^^
`----
x ComponentValue
,-[$DIR/tests/recovery/simple-block/unclosed/input.css:4:9]
4 | color: blue
: ^^^^
`----
x Ident
,-[$DIR/tests/recovery/simple-block/unclosed/input.css:4:9]
4 | color: blue
: ^^^^
`----

View File

@ -29,10 +29,10 @@
: ^
`----
x Unexpected end of file, but expected '{'
x Expected '{'
,-[$DIR/tests/recovery/style-blocks-contents/basic/input.css:39:5]
39 | & test;
: ^^^^^^
: ^
`----
x Unexpected token

View File

@ -0,0 +1,7 @@
div {
color: red;
input {
margin: 1em;
}
}

View File

@ -0,0 +1,282 @@
{
"type": "Stylesheet",
"span": {
"start": 1,
"end": 65,
"ctxt": 0
},
"rules": [
{
"type": "QualifiedRule",
"span": {
"start": 1,
"end": 64,
"ctxt": 0
},
"prelude": {
"type": "SelectorList",
"span": {
"start": 1,
"end": 4,
"ctxt": 0
},
"children": [
{
"type": "ComplexSelector",
"span": {
"start": 1,
"end": 4,
"ctxt": 0
},
"children": [
{
"type": "CompoundSelector",
"span": {
"start": 1,
"end": 4,
"ctxt": 0
},
"nestingSelector": null,
"typeSelector": {
"type": "TagNameSelector",
"span": {
"start": 1,
"end": 4,
"ctxt": 0
},
"name": {
"type": "WqName",
"span": {
"start": 1,
"end": 4,
"ctxt": 0
},
"prefix": null,
"value": {
"type": "Ident",
"span": {
"start": 1,
"end": 4,
"ctxt": 0
},
"value": "div",
"raw": "div"
}
}
},
"subclassSelectors": []
}
]
}
]
},
"block": {
"type": "SimpleBlock",
"span": {
"start": 5,
"end": 64,
"ctxt": 0
},
"name": {
"type": "PreservedToken",
"span": {
"start": 5,
"end": 6,
"ctxt": 0
},
"token": "LBrace"
},
"value": [
{
"type": "Declaration",
"span": {
"start": 11,
"end": 21,
"ctxt": 0
},
"name": {
"type": "Ident",
"span": {
"start": 11,
"end": 16,
"ctxt": 0
},
"value": "color",
"raw": "color"
},
"value": [
{
"type": "Ident",
"span": {
"start": 18,
"end": 21,
"ctxt": 0
},
"value": "red",
"raw": "red"
}
],
"important": null
},
{
"type": "ListOfComponentValues",
"span": {
"start": 28,
"end": 63,
"ctxt": 0
},
"children": [
{
"type": "PreservedToken",
"span": {
"start": 28,
"end": 33,
"ctxt": 0
},
"token": {
"Ident": {
"value": "input",
"raw": "input"
}
}
},
{
"type": "PreservedToken",
"span": {
"start": 33,
"end": 34,
"ctxt": 0
},
"token": {
"WhiteSpace": {
"value": " "
}
}
},
{
"type": "SimpleBlock",
"span": {
"start": 34,
"end": 62,
"ctxt": 0
},
"name": {
"type": "PreservedToken",
"span": {
"start": 34,
"end": 35,
"ctxt": 0
},
"token": "LBrace"
},
"value": [
{
"type": "PreservedToken",
"span": {
"start": 35,
"end": 44,
"ctxt": 0
},
"token": {
"WhiteSpace": {
"value": "\n "
}
}
},
{
"type": "PreservedToken",
"span": {
"start": 44,
"end": 50,
"ctxt": 0
},
"token": {
"Ident": {
"value": "margin",
"raw": "margin"
}
}
},
{
"type": "PreservedToken",
"span": {
"start": 50,
"end": 51,
"ctxt": 0
},
"token": "Colon"
},
{
"type": "PreservedToken",
"span": {
"start": 51,
"end": 52,
"ctxt": 0
},
"token": {
"WhiteSpace": {
"value": " "
}
}
},
{
"type": "PreservedToken",
"span": {
"start": 52,
"end": 55,
"ctxt": 0
},
"token": {
"Dimension": {
"value": 1.0,
"raw_value": "1",
"unit": "em",
"raw_unit": "em",
"type": "integer"
}
}
},
{
"type": "PreservedToken",
"span": {
"start": 55,
"end": 56,
"ctxt": 0
},
"token": "Semi"
},
{
"type": "PreservedToken",
"span": {
"start": 56,
"end": 61,
"ctxt": 0
},
"token": {
"WhiteSpace": {
"value": "\n "
}
}
}
]
},
{
"type": "PreservedToken",
"span": {
"start": 62,
"end": 63,
"ctxt": 0
},
"token": {
"WhiteSpace": {
"value": "\n"
}
}
}
]
}
]
}
}
]
}

View File

@ -0,0 +1,6 @@
x Expected ":"
,-[$DIR/tests/recovery/style-blocks-contents/invalid-nested-1/input.css:4:5]
4 | input {
: ^
`----

View File

@ -0,0 +1,292 @@
x Stylesheet
,-[$DIR/tests/recovery/style-blocks-contents/invalid-nested-1/input.css:1:1]
1 | ,-> div {
2 | | color: red;
3 | |
4 | | input {
5 | | margin: 1em;
6 | | }
7 | `-> }
`----
x Rule
,-[$DIR/tests/recovery/style-blocks-contents/invalid-nested-1/input.css:1:1]
1 | ,-> div {
2 | | color: red;
3 | |
4 | | input {
5 | | margin: 1em;
6 | | }
7 | `-> }
`----
x QualifiedRule
,-[$DIR/tests/recovery/style-blocks-contents/invalid-nested-1/input.css:1:1]
1 | ,-> div {
2 | | color: red;
3 | |
4 | | input {
5 | | margin: 1em;
6 | | }
7 | `-> }
`----
x SelectorList
,-[$DIR/tests/recovery/style-blocks-contents/invalid-nested-1/input.css:1:1]
1 | div {
: ^^^
`----
x ComplexSelector
,-[$DIR/tests/recovery/style-blocks-contents/invalid-nested-1/input.css:1:1]
1 | div {
: ^^^
`----
x CompoundSelector
,-[$DIR/tests/recovery/style-blocks-contents/invalid-nested-1/input.css:1:1]
1 | div {
: ^^^
`----
x TypeSelector
,-[$DIR/tests/recovery/style-blocks-contents/invalid-nested-1/input.css:1:1]
1 | div {
: ^^^
`----
x TagNameSelector
,-[$DIR/tests/recovery/style-blocks-contents/invalid-nested-1/input.css:1:1]
1 | div {
: ^^^
`----
x WqName
,-[$DIR/tests/recovery/style-blocks-contents/invalid-nested-1/input.css:1:1]
1 | div {
: ^^^
`----
x Ident
,-[$DIR/tests/recovery/style-blocks-contents/invalid-nested-1/input.css:1:1]
1 | div {
: ^^^
`----
x SimpleBlock
,-[$DIR/tests/recovery/style-blocks-contents/invalid-nested-1/input.css:1:1]
1 | ,-> div {
2 | | color: red;
3 | |
4 | | input {
5 | | margin: 1em;
6 | | }
7 | `-> }
`----
x LBrace
,-[$DIR/tests/recovery/style-blocks-contents/invalid-nested-1/input.css:1:1]
1 | div {
: ^
`----
x ComponentValue
,-[$DIR/tests/recovery/style-blocks-contents/invalid-nested-1/input.css:2:5]
2 | color: red;
: ^^^^^^^^^^
`----
x StyleBlock
,-[$DIR/tests/recovery/style-blocks-contents/invalid-nested-1/input.css:2:5]
2 | color: red;
: ^^^^^^^^^^
`----
x Declaration
,-[$DIR/tests/recovery/style-blocks-contents/invalid-nested-1/input.css:2:5]
2 | color: red;
: ^^^^^^^^^^
`----
x DeclarationName
,-[$DIR/tests/recovery/style-blocks-contents/invalid-nested-1/input.css:2:5]
2 | color: red;
: ^^^^^
`----
x Ident
,-[$DIR/tests/recovery/style-blocks-contents/invalid-nested-1/input.css:2:5]
2 | color: red;
: ^^^^^
`----
x ComponentValue
,-[$DIR/tests/recovery/style-blocks-contents/invalid-nested-1/input.css:2:5]
2 | color: red;
: ^^^
`----
x Ident
,-[$DIR/tests/recovery/style-blocks-contents/invalid-nested-1/input.css:2:5]
2 | color: red;
: ^^^
`----
x ComponentValue
,-[$DIR/tests/recovery/style-blocks-contents/invalid-nested-1/input.css:4:5]
4 | ,-> input {
5 | | margin: 1em;
6 | `-> }
7 | }
`----
x StyleBlock
,-[$DIR/tests/recovery/style-blocks-contents/invalid-nested-1/input.css:4:5]
4 | ,-> input {
5 | | margin: 1em;
6 | `-> }
7 | }
`----
x ComponentValue
,-[$DIR/tests/recovery/style-blocks-contents/invalid-nested-1/input.css:4:5]
4 | input {
: ^^^^^
`----
x Ident { value: Atom('input' type=static), raw: "input" }
,-[$DIR/tests/recovery/style-blocks-contents/invalid-nested-1/input.css:4:5]
4 | input {
: ^^^^^
`----
x ComponentValue
,-[$DIR/tests/recovery/style-blocks-contents/invalid-nested-1/input.css:4:5]
4 | input {
: ^
`----
x WhiteSpace { value: " " }
,-[$DIR/tests/recovery/style-blocks-contents/invalid-nested-1/input.css:4:5]
4 | input {
: ^
`----
x ComponentValue
,-[$DIR/tests/recovery/style-blocks-contents/invalid-nested-1/input.css:4:5]
4 | ,-> input {
5 | | margin: 1em;
6 | `-> }
`----
x SimpleBlock
,-[$DIR/tests/recovery/style-blocks-contents/invalid-nested-1/input.css:4:5]
4 | ,-> input {
5 | | margin: 1em;
6 | `-> }
`----
x LBrace
,-[$DIR/tests/recovery/style-blocks-contents/invalid-nested-1/input.css:4:5]
4 | input {
: ^
`----
x ComponentValue
,-[$DIR/tests/recovery/style-blocks-contents/invalid-nested-1/input.css:4:5]
4 | ,-> input {
5 | `-> margin: 1em;
`----
x WhiteSpace { value: "\n " }
,-[$DIR/tests/recovery/style-blocks-contents/invalid-nested-1/input.css:4:5]
4 | ,-> input {
5 | `-> margin: 1em;
`----
x ComponentValue
,-[$DIR/tests/recovery/style-blocks-contents/invalid-nested-1/input.css:5:9]
5 | margin: 1em;
: ^^^^^^
`----
x Ident { value: Atom('margin' type=static), raw: "margin" }
,-[$DIR/tests/recovery/style-blocks-contents/invalid-nested-1/input.css:5:9]
5 | margin: 1em;
: ^^^^^^
`----
x ComponentValue
,-[$DIR/tests/recovery/style-blocks-contents/invalid-nested-1/input.css:5:9]
5 | margin: 1em;
: ^
`----
x Colon
,-[$DIR/tests/recovery/style-blocks-contents/invalid-nested-1/input.css:5:9]
5 | margin: 1em;
: ^
`----
x ComponentValue
,-[$DIR/tests/recovery/style-blocks-contents/invalid-nested-1/input.css:5:9]
5 | margin: 1em;
: ^
`----
x WhiteSpace { value: " " }
,-[$DIR/tests/recovery/style-blocks-contents/invalid-nested-1/input.css:5:9]
5 | margin: 1em;
: ^
`----
x ComponentValue
,-[$DIR/tests/recovery/style-blocks-contents/invalid-nested-1/input.css:5:9]
5 | margin: 1em;
: ^^^
`----
x Dimension { value: 1.0, raw_value: "1", unit: Atom('em' type=static), raw_unit: "em", type_flag: Integer }
,-[$DIR/tests/recovery/style-blocks-contents/invalid-nested-1/input.css:5:9]
5 | margin: 1em;
: ^^^
`----
x ComponentValue
,-[$DIR/tests/recovery/style-blocks-contents/invalid-nested-1/input.css:5:9]
5 | margin: 1em;
: ^
`----
x Semi
,-[$DIR/tests/recovery/style-blocks-contents/invalid-nested-1/input.css:5:9]
5 | margin: 1em;
: ^
`----
x ComponentValue
,-[$DIR/tests/recovery/style-blocks-contents/invalid-nested-1/input.css:5:9]
5 | ,-> margin: 1em;
6 | `-> }
`----
x WhiteSpace { value: "\n " }
,-[$DIR/tests/recovery/style-blocks-contents/invalid-nested-1/input.css:5:9]
5 | ,-> margin: 1em;
6 | `-> }
`----
x ComponentValue
,-[$DIR/tests/recovery/style-blocks-contents/invalid-nested-1/input.css:6:5]
6 | }
: ^
7 | }
`----
x WhiteSpace { value: "\n" }
,-[$DIR/tests/recovery/style-blocks-contents/invalid-nested-1/input.css:6:5]
6 | }
: ^
7 | }
`----

View File

@ -1,8 +1,8 @@
x Unexpected end of file, but expected '{'
x Expected '{'
,-[$DIR/tests/recovery/style-blocks-contents/invalid-nested-2/input.css:3:5]
3 | & test;
: ^^^^^^
: ^
`----
x Unexpected token

View File

@ -1,8 +1,8 @@
x Unexpected end of file, but expected '{'
x Expected '{'
,-[$DIR/tests/recovery/style-blocks-contents/invalid-nested/input.css:3:5]
3 | & test;
: ^^^^^^
: ^
`----
x Unexpected token

View File

@ -127,16 +127,16 @@ define!({
}
pub enum StyleBlock {
ListOfComponentValues(ListOfComponentValues),
AtRule(Box<AtRule>),
Declaration(Box<Declaration>),
QualifiedRule(Box<QualifiedRule>),
ListOfComponentValues(Box<ListOfComponentValues>),
}
pub enum DeclarationOrAtRule {
Declaration(Box<Declaration>),
AtRule(Box<AtRule>),
ListOfComponentValues(ListOfComponentValues),
ListOfComponentValues(Box<ListOfComponentValues>),
}
pub enum DelimiterValue {