attr: fix name/key/value validation
match reference implementation
This commit is contained in:
parent
0719b2de65
commit
14065177ae
1 changed files with 2 additions and 6 deletions
|
@ -262,7 +262,7 @@ impl<I: Iterator<Item = char>> Parser<I> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
s @ (ClassFirst | IdentifierFirst) => {
|
s @ (ClassFirst | IdentifierFirst) => {
|
||||||
if is_name_start(c) {
|
if is_name(c) {
|
||||||
match s {
|
match s {
|
||||||
ClassFirst => Class,
|
ClassFirst => Class,
|
||||||
IdentifierFirst => Identifier,
|
IdentifierFirst => Identifier,
|
||||||
|
@ -344,12 +344,8 @@ impl<I: Iterator<Item = char>> Parser<I> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_name_start(c: char) -> bool {
|
|
||||||
c.is_ascii_alphanumeric() || matches!(c, '_' | ':')
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn is_name(c: char) -> bool {
|
pub fn is_name(c: char) -> bool {
|
||||||
is_name_start(c) || c.is_ascii_digit() || matches!(c, '-')
|
c.is_ascii_alphanumeric() || matches!(c, ':' | '_' | '-')
|
||||||
}
|
}
|
||||||
|
|
||||||
enum Element {
|
enum Element {
|
||||||
|
|
Loading…
Reference in a new issue