Lex % as symbol rather than unit
This commit is contained in:
parent
21515214cb
commit
dc82d999e9
11
src/lexer.rs
11
src/lexer.rs
@ -4,7 +4,6 @@ use std::str::Chars;
|
|||||||
|
|
||||||
use crate::common::{AtRuleKind, Keyword, Op, Pos, Symbol};
|
use crate::common::{AtRuleKind, Keyword, Op, Pos, Symbol};
|
||||||
use crate::selector::{Attribute, AttributeKind};
|
use crate::selector::{Attribute, AttributeKind};
|
||||||
use crate::units::Unit;
|
|
||||||
use crate::{Token, TokenKind, Whitespace};
|
use crate::{Token, TokenKind, Whitespace};
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
@ -67,11 +66,7 @@ impl<'a> Iterator for Lexer<'a> {
|
|||||||
'&' => symbol!(self, BitAnd),
|
'&' => symbol!(self, BitAnd),
|
||||||
'|' => symbol!(self, BitOr),
|
'|' => symbol!(self, BitOr),
|
||||||
'/' => self.lex_forward_slash(),
|
'/' => self.lex_forward_slash(),
|
||||||
'%' => {
|
'%' => symbol!(self, Percent),
|
||||||
self.buf.next();
|
|
||||||
self.pos.next_char();
|
|
||||||
TokenKind::Unit(Unit::Percent)
|
|
||||||
}
|
|
||||||
'[' => {
|
'[' => {
|
||||||
self.buf.next();
|
self.buf.next();
|
||||||
self.pos.next_char();
|
self.pos.next_char();
|
||||||
@ -363,10 +358,6 @@ impl<'a> Lexer<'a> {
|
|||||||
return TokenKind::Keyword(kw);
|
return TokenKind::Keyword(kw);
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Ok(kw) = Unit::try_from(string.as_ref()) {
|
|
||||||
return TokenKind::Unit(kw);
|
|
||||||
}
|
|
||||||
|
|
||||||
TokenKind::Ident(string)
|
TokenKind::Ident(string)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user