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) body.push(tok)
} else { } 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); devour_whitespace(toks);
return Ok(Some(Expr::VariableDecl( return Ok(Some(Expr::VariableDecl(
name, name,
eat_variable_value(toks, scope)? eat_variable_value(toks, scope)?,
))); )));
} else { } else {
values.push(Token { values.push(Token {
@ -542,9 +542,11 @@ pub(crate) fn eat_expr<I: Iterator<Item = Token>>(
} }
} }
TokenKind::AtRule(AtRule::Include) => { TokenKind::AtRule(AtRule::Include) => {
return Ok(Some(Expr::Include( return Ok(Some(Expr::Include(eat_include(
eat_include(toks, scope, super_selector)?, toks,
))); scope,
super_selector,
)?)));
} }
TokenKind::AtRule(AtRule::Mixin) => { TokenKind::AtRule(AtRule::Mixin) => {
toks.next(); toks.next();

View File

@ -39,7 +39,11 @@ impl Mixin {
self 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(); let mut stmts = Vec::new();
while let Some(expr) = eat_expr(&mut self.body, scope, super_selector)? { while let Some(expr) = eat_expr(&mut self.body, scope, super_selector)? {
match expr { match expr {