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