Remove nesting check in ruleset parsing
This commit is contained in:
parent
5b631fb588
commit
d4f50c8acc
18
src/mixin.rs
18
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<Token>,
|
||||
body: Peekable<IntoIter<Token>>,
|
||||
nesting: u32,
|
||||
}
|
||||
|
||||
// struct MixinEvaluator<'a> {
|
||||
// body: Vec<Token>,
|
||||
// nesting: u32,
|
||||
// }
|
||||
|
||||
impl Mixin {
|
||||
pub fn new(scope: Scope, args: FuncArgs, body: Vec<Token>) -> Self {
|
||||
let body = body.clone().into_iter().peekable();
|
||||
@ -40,7 +32,6 @@ impl Mixin {
|
||||
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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user