From dc82d999e917b21ac4936de8c7d47887fb05550f Mon Sep 17 00:00:00 2001 From: ConnorSkees <39542938+ConnorSkees@users.noreply.github.com> Date: Wed, 22 Jan 2020 00:40:32 -0500 Subject: [PATCH] Lex % as symbol rather than unit --- src/lexer.rs | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/lexer.rs b/src/lexer.rs index f3790cd..d32b668 100644 --- a/src/lexer.rs +++ b/src/lexer.rs @@ -4,7 +4,6 @@ use std::str::Chars; use crate::common::{AtRuleKind, Keyword, Op, Pos, Symbol}; use crate::selector::{Attribute, AttributeKind}; -use crate::units::Unit; use crate::{Token, TokenKind, Whitespace}; #[derive(Debug, Clone)] @@ -67,11 +66,7 @@ impl<'a> Iterator for Lexer<'a> { '&' => symbol!(self, BitAnd), '|' => symbol!(self, BitOr), '/' => self.lex_forward_slash(), - '%' => { - self.buf.next(); - self.pos.next_char(); - TokenKind::Unit(Unit::Percent) - } + '%' => symbol!(self, Percent), '[' => { self.buf.next(); self.pos.next_char(); @@ -363,10 +358,6 @@ impl<'a> Lexer<'a> { return TokenKind::Keyword(kw); } - if let Ok(kw) = Unit::try_from(string.as_ref()) { - return TokenKind::Unit(kw); - } - TokenKind::Ident(string) } }