From aaa48403cdd3d8499584eeca4103865d6425ac1b Mon Sep 17 00:00:00 2001 From: Laurenz Date: Tue, 26 Jan 2021 21:11:44 +0100 Subject: =?UTF-8?q?Require=20hashtag=20for=20all=20keywords=20=F0=9F=92=82?= =?UTF-8?q?=E2=80=8D=E2=99=80=EF=B8=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/parse/mod.rs | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'src/parse/mod.rs') diff --git a/src/parse/mod.rs b/src/parse/mod.rs index 9fe8e62e..a3a38775 100644 --- a/src/parse/mod.rs +++ b/src/parse/mod.rs @@ -13,9 +13,6 @@ pub use resolve::*; pub use scanner::*; pub use tokens::*; -use std::str::FromStr; - -use crate::color::RgbaColor; use crate::diag::Pass; use crate::syntax::*; @@ -314,7 +311,7 @@ fn primary(p: &mut Parser) -> Option { Some(Token::Length(val, unit)) => Expr::Length(val, unit), Some(Token::Angle(val, unit)) => Expr::Angle(val, unit), Some(Token::Percent(p)) => Expr::Percent(p), - Some(Token::Hex(hex)) => Expr::Color(color(p, hex)), + Some(Token::Color(color)) => Expr::Color(color), Some(Token::Str(token)) => Expr::Str(string(p, token)), // No value. @@ -357,15 +354,6 @@ fn paren_call(p: &mut Parser, name: Spanned) -> Expr { }) } -/// Parse a color. -fn color(p: &mut Parser, hex: &str) -> RgbaColor { - RgbaColor::from_str(hex).unwrap_or_else(|_| { - // Replace color with black. - p.diag(error!(p.peek_span(), "invalid color")); - RgbaColor::new(0, 0, 0, 255) - }) -} - /// Parse a string. fn string(p: &mut Parser, token: TokenStr) -> String { if !token.terminated { -- cgit v1.2.3