improve span information for at-rules
This commit is contained in:
parent
1e91008459
commit
86c1bb704d
@ -107,10 +107,12 @@ impl<'a> Parser<'a> {
|
||||
if self.in_function && !stmts.is_empty() {
|
||||
return Ok(stmts);
|
||||
}
|
||||
self.span_before = *pos;
|
||||
match kind {
|
||||
'@' => {
|
||||
self.toks.next();
|
||||
let kind_string = self.parse_identifier()?;
|
||||
self.span_before = kind_string.span;
|
||||
match AtRuleKind::try_from(&kind_string)? {
|
||||
AtRuleKind::Import => stmts.append(&mut self.import()?),
|
||||
AtRuleKind::Mixin => self.parse_mixin()?,
|
||||
@ -228,7 +230,7 @@ impl<'a> Parser<'a> {
|
||||
}
|
||||
}
|
||||
'\u{0}'..='\u{8}' | '\u{b}'..='\u{1f}' => {
|
||||
return Err(("expected selector.", self.toks.next().unwrap().pos).into())
|
||||
return Err(("expected selector.", *pos).into())
|
||||
}
|
||||
'}' => {
|
||||
self.toks.next();
|
||||
@ -287,6 +289,8 @@ impl<'a> Parser<'a> {
|
||||
return Err(("expected \"{\".", self.span_before).into());
|
||||
};
|
||||
|
||||
self.span_before = span;
|
||||
|
||||
let mut found_curly = false;
|
||||
|
||||
while let Some(tok) = self.toks.next() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user