This commit is contained in:
ConnorSkees 2020-02-28 18:32:11 -05:00
parent bc2c927aa7
commit e2fcfeec47
4 changed files with 13 additions and 11 deletions

View File

@ -89,14 +89,15 @@ impl AtRule {
t.push(toks.next().unwrap()); t.push(toks.next().unwrap());
} }
AtRule::Return(t) AtRule::Return(t)
}, }
AtRuleKind::Use => todo!("@use not yet implemented"), AtRuleKind::Use => todo!("@use not yet implemented"),
AtRuleKind::Annotation => todo!("@annotation not yet implemented"), AtRuleKind::Annotation => todo!("@annotation not yet implemented"),
AtRuleKind::AtRoot => todo!("@at-root not yet implemented"), AtRuleKind::AtRoot => todo!("@at-root not yet implemented"),
AtRuleKind::Charset => { AtRuleKind::Charset => {
toks.take_while(|t| t.kind != TokenKind::Symbol(Symbol::SemiColon)).for_each(drop); toks.take_while(|t| t.kind != TokenKind::Symbol(Symbol::SemiColon))
.for_each(drop);
AtRule::Charset AtRule::Charset
}, }
AtRuleKind::Each => todo!("@each not yet implemented"), AtRuleKind::Each => todo!("@each not yet implemented"),
AtRuleKind::Extend => todo!("@extend not yet implemented"), AtRuleKind::Extend => todo!("@extend not yet implemented"),
AtRuleKind::If => todo!("@if not yet implemented"), AtRuleKind::If => todo!("@if not yet implemented"),

View File

@ -1,11 +1,11 @@
//! # Convert from SCSS AST to CSS //! # Convert from SCSS AST to CSS
use crate::atrule::AtRule; use crate::atrule::AtRule;
use crate::error::SassResult; use crate::error::SassResult;
use crate::{RuleSet, Selector, Stmt, Style, StyleSheet};
use crate::lexer::IS_UTF8; use crate::lexer::IS_UTF8;
use std::sync::atomic::Ordering; use crate::{RuleSet, Selector, Stmt, Style, StyleSheet};
use std::fmt; use std::fmt;
use std::io::Write; use std::io::Write;
use std::sync::atomic::Ordering;
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
enum Toplevel { enum Toplevel {

View File

@ -98,11 +98,13 @@ impl Mixin {
Expr::Style(s) => stmts.push(Stmt::Style(*s)), Expr::Style(s) => stmts.push(Stmt::Style(*s)),
Expr::Styles(s) => stmts.extend(s.into_iter().map(Stmt::Style)), Expr::Styles(s) => stmts.extend(s.into_iter().map(Stmt::Style)),
Expr::Include(s) => stmts.extend(s), Expr::Include(s) => stmts.extend(s),
Expr::FunctionDecl(..) => return Err("Mixins may not contain function declarations.".into()), Expr::FunctionDecl(..) => {
Expr::MixinDecl(..) => return Err("Mixins may not contain mixin declarations.".into()), return Err("Mixins may not contain function declarations.".into())
Expr::Debug(..) | Expr::Warn(..) => {
todo!()
} }
Expr::MixinDecl(..) => {
return Err("Mixins may not contain mixin declarations.".into())
}
Expr::Debug(..) | Expr::Warn(..) => todo!(),
Expr::Selector(selector) => { Expr::Selector(selector) => {
let rules = self.eval(&super_selector.zip(&selector))?; let rules = self.eval(&super_selector.zip(&selector))?;
stmts.push(Stmt::RuleSet(RuleSet { stmts.push(Stmt::RuleSet(RuleSet {

View File

@ -52,8 +52,7 @@ impl Display for Value {
write!(f, "\"{}\"", val) write!(f, "\"{}\"", val)
} else if !has_single_quotes && has_double_quotes { } else if !has_single_quotes && has_double_quotes {
write!(f, "'{}'", val) write!(f, "'{}'", val)
} } else if !has_single_quotes && !has_double_quotes {
else if !has_single_quotes && !has_double_quotes {
write!(f, "\"{}\"", val) write!(f, "\"{}\"", val)
} else { } else {
let quote_char = match kind { let quote_char = match kind {