From d4f50c8acc720978f175f148cc5361d4c2a8ac5b Mon Sep 17 00:00:00 2001 From: ConnorSkees <39542938+ConnorSkees@users.noreply.github.com> Date: Fri, 17 Jan 2020 10:43:03 -0500 Subject: [PATCH] Remove nesting check in ruleset parsing --- src/mixin.rs | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/src/mixin.rs b/src/mixin.rs index d1d312d..e10f769 100644 --- a/src/mixin.rs +++ b/src/mixin.rs @@ -1,25 +1,17 @@ -use crate::common::{Pos, Scope, Symbol}; +use crate::common::Scope; use crate::selector::Selector; -use crate::style::Style; -use crate::utils::{devour_whitespace, eat_variable_value_ref}; -use crate::{eat_expr, Expr, RuleSet, Stmt, Token, TokenKind}; -use std::vec::IntoIter; +use crate::{eat_expr, Expr, RuleSet, Stmt, Token}; use std::iter::Peekable; +use std::vec::IntoIter; #[derive(Debug, Clone)] pub struct Mixin { scope: Scope, args: FuncArgs, - // body: Vec, body: Peekable>, nesting: u32, } -// struct MixinEvaluator<'a> { -// body: Vec, -// nesting: u32, -// } - impl Mixin { pub fn new(scope: Scope, args: FuncArgs, body: Vec) -> Self { let body = body.clone().into_iter().peekable(); @@ -36,11 +28,10 @@ impl Mixin { while let Ok(expr) = eat_expr(&mut self.body, scope, super_selector) { match expr { Expr::Style(s) => stmts.push(Stmt::Style(s)), - Expr::Include(_) => todo!(), - Expr::MixinDecl(_, _) => todo!(), + Expr::Include(_) => todo!(), + Expr::MixinDecl(_, _) => todo!(), Expr::Selector(s) => { self.nesting += 1; - dbg!(&self.nesting); let rules = self.eval(&super_selector.clone().zip(s.clone()), scope); stmts.push(Stmt::RuleSet(RuleSet { super_selector: super_selector.clone(), @@ -48,9 +39,6 @@ impl Mixin { rules, })); self.nesting -= 1; - if self.nesting == 0 { - return stmts; - } } Expr::VariableDecl(name, val) => { if self.nesting == 0 {