refactor @ warn and @ debug parsing
This commit is contained in:
parent
44ff1c99b3
commit
f0c1d508e6
@ -62,21 +62,28 @@ impl AtRule {
|
|||||||
return Err(message.to_string().into());
|
return Err(message.to_string().into());
|
||||||
}
|
}
|
||||||
AtRuleKind::Warn => {
|
AtRuleKind::Warn => {
|
||||||
let message = toks
|
let message = Value::from_vec(
|
||||||
.take_while(|x| x.kind != ';')
|
read_until_semicolon_or_closing_curly_brace(toks),
|
||||||
.map(|x| x.kind.to_string())
|
scope,
|
||||||
.collect::<String>();
|
super_selector,
|
||||||
|
)?;
|
||||||
|
if toks.peek().unwrap().kind == ';' {
|
||||||
|
toks.next();
|
||||||
|
}
|
||||||
devour_whitespace(toks);
|
devour_whitespace(toks);
|
||||||
AtRule::Warn(pos, message)
|
AtRule::Warn(pos, message.to_string())
|
||||||
}
|
}
|
||||||
AtRuleKind::Debug => {
|
AtRuleKind::Debug => {
|
||||||
let message = toks
|
let message = Value::from_vec(
|
||||||
.by_ref()
|
read_until_semicolon_or_closing_curly_brace(toks),
|
||||||
.take_while(|x| x.kind != ';')
|
scope,
|
||||||
.map(|x| x.kind.to_string())
|
super_selector,
|
||||||
.collect::<String>();
|
)?;
|
||||||
|
if toks.peek().unwrap().kind == ';' {
|
||||||
|
toks.next();
|
||||||
|
}
|
||||||
devour_whitespace(toks);
|
devour_whitespace(toks);
|
||||||
AtRule::Debug(pos, message)
|
AtRule::Debug(pos, message.to_string())
|
||||||
}
|
}
|
||||||
AtRuleKind::Mixin => {
|
AtRuleKind::Mixin => {
|
||||||
let (name, mixin) = Mixin::decl_from_tokens(toks, scope, super_selector)?;
|
let (name, mixin) = Mixin::decl_from_tokens(toks, scope, super_selector)?;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user