rustfmt
This commit is contained in:
parent
f266f2cf0e
commit
3f063709c5
@ -138,32 +138,21 @@ impl<'a> SelectorParser<'a> {
|
|||||||
fn consume_selector(&mut self) -> Option<Selector> {
|
fn consume_selector(&mut self) -> Option<Selector> {
|
||||||
if let Some(tok) = self.tokens.next() {
|
if let Some(tok) = self.tokens.next() {
|
||||||
let selector = match &tok.kind {
|
let selector = match &tok.kind {
|
||||||
TokenKind::Symbol(Symbol::Period) => match self
|
TokenKind::Symbol(Symbol::Period) => {
|
||||||
.tokens
|
match self.tokens.next().expect("expected ident after `.`").kind {
|
||||||
.next()
|
TokenKind::Ident(ref tok) => Selector::Class(tok.clone()),
|
||||||
.expect("expected ident after `.`")
|
_ => todo!("there should normally be an ident after `.`"),
|
||||||
.kind
|
}
|
||||||
{
|
}
|
||||||
TokenKind::Ident(ref tok) => Selector::Class(tok.clone()),
|
|
||||||
_ => todo!("there should normally be an ident after `.`"),
|
|
||||||
},
|
|
||||||
TokenKind::Symbol(Symbol::Mul) => Selector::Universal,
|
TokenKind::Symbol(Symbol::Mul) => Selector::Universal,
|
||||||
TokenKind::Symbol(Symbol::Hash) => match &self
|
TokenKind::Symbol(Symbol::Hash) => {
|
||||||
.tokens
|
match &self.tokens.next().expect("expected ident after `#`").kind {
|
||||||
.next()
|
TokenKind::Ident(ref tok) => Selector::Id(tok.clone()),
|
||||||
.expect("expected ident after `#`")
|
_ => todo!("there should normally be an ident after `#`"),
|
||||||
.kind
|
}
|
||||||
{
|
}
|
||||||
TokenKind::Ident(ref tok) => Selector::Id(tok.clone()),
|
|
||||||
_ => todo!("there should normally be an ident after `#`"),
|
|
||||||
},
|
|
||||||
TokenKind::Symbol(Symbol::Colon) => {
|
TokenKind::Symbol(Symbol::Colon) => {
|
||||||
match self
|
match self.tokens.next().expect("expected ident after `:`").kind {
|
||||||
.tokens
|
|
||||||
.next()
|
|
||||||
.expect("expected ident after `:`")
|
|
||||||
.kind
|
|
||||||
{
|
|
||||||
TokenKind::Ident(ref tok) => Selector::Pseudo(tok.clone()),
|
TokenKind::Ident(ref tok) => Selector::Pseudo(tok.clone()),
|
||||||
_ => todo!("there should normally be an ident after `:`"),
|
_ => todo!("there should normally be an ident after `:`"),
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user