attr: rename State::{Attribute->Key}

more accurate name
This commit is contained in:
Noah Hellman 2023-02-17 23:28:07 +01:00
parent 86ee4ee520
commit e1b12ba642

View file

@ -216,7 +216,7 @@ enum State {
Class, Class,
IdentifierFirst, IdentifierFirst,
Identifier, Identifier,
Attribute, Key,
ValueFirst, ValueFirst,
Value, Value,
ValueQuoted, ValueQuoted,
@ -255,7 +255,7 @@ impl<I: Iterator<Item = char>> Parser<I> {
'.' => ClassFirst, '.' => ClassFirst,
'#' => IdentifierFirst, '#' => IdentifierFirst,
'%' => Comment, '%' => Comment,
c if c.is_ascii_alphanumeric() || matches!(c, '_' | ':' | '-') => Attribute, c if c.is_ascii_alphanumeric() || matches!(c, '_' | ':' | '-') => Key,
c if c.is_whitespace() => Whitespace, c if c.is_whitespace() => Whitespace,
_ => Invalid, _ => Invalid,
}, },
@ -288,9 +288,9 @@ impl<I: Iterator<Item = char>> Parser<I> {
Invalid Invalid
} }
} }
Attribute => { Key => {
if is_name(c) { if is_name(c) {
Attribute Key
} else if c == '=' { } else if c == '=' {
ValueFirst ValueFirst
} else { } else {
@ -375,7 +375,7 @@ impl<I: Iterator<Item = char>> Iterator for Parser<I> {
_ => return Some(Element::Invalid), _ => return Some(Element::Invalid),
}) })
} }
Attribute => { Key => {
let (st, _span1) = self.step(); let (st, _span1) = self.step();
match st { match st {
ValueFirst => { ValueFirst => {