diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-01-26 21:11:44 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-01-26 21:11:44 +0100 |
| commit | aaa48403cdd3d8499584eeca4103865d6425ac1b (patch) | |
| tree | 5738aaee104e4529da1934d1dc089145c1aa7266 /src/parse/mod.rs | |
| parent | 7ced99bcd761eb06f6000d4cde9556fb701c6805 (diff) | |
Require hashtag for all keywords 💂♀️
Diffstat (limited to 'src/parse/mod.rs')
| -rw-r--r-- | src/parse/mod.rs | 14 |
1 files changed, 1 insertions, 13 deletions
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<Expr> { 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<Ident>) -> 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 { |
