This commit is contained in:
ConnorSkees 2020-01-17 22:40:13 -05:00
parent 8076125576
commit e15c88a3c7
2 changed files with 12 additions and 6 deletions

View File

@ -432,7 +432,7 @@ fn parse_mixin<I: Iterator<Item = Token>>(
}
body.push(tok)
} else {
todo!("unexpected EOF")
return Err(Printer::Error(pos, String::from("unexpected EOF")));
}
}
@ -518,7 +518,7 @@ pub(crate) fn eat_expr<I: Iterator<Item = Token>>(
devour_whitespace(toks);
return Ok(Some(Expr::VariableDecl(
name,
eat_variable_value(toks, scope)?
eat_variable_value(toks, scope)?,
)));
} else {
values.push(Token {
@ -542,9 +542,11 @@ pub(crate) fn eat_expr<I: Iterator<Item = Token>>(
}
}
TokenKind::AtRule(AtRule::Include) => {
return Ok(Some(Expr::Include(
eat_include(toks, scope, super_selector)?,
)));
return Ok(Some(Expr::Include(eat_include(
toks,
scope,
super_selector,
)?)));
}
TokenKind::AtRule(AtRule::Mixin) => {
toks.next();

View File

@ -39,7 +39,11 @@ impl Mixin {
self
}
pub fn eval(&mut self, super_selector: &Selector, scope: &mut Scope) -> Result<Vec<Stmt>, (Pos, &'static str)> {
pub fn eval(
&mut self,
super_selector: &Selector,
scope: &mut Scope,
) -> Result<Vec<Stmt>, (Pos, &'static str)> {
let mut stmts = Vec::new();
while let Some(expr) = eat_expr(&mut self.body, scope, super_selector)? {
match expr {