fix: identifiers equal to a keyword are not quoted #132

This commit is contained in:
Koi to Coco 2025-08-30 18:45:39 +08:00
parent 439aa63bfc
commit 2f734a9566
No known key found for this signature in database
GPG Key ID: 8F1CED8487016AB4
1 changed files with 6 additions and 0 deletions

View File

@ -186,6 +186,12 @@ pub(crate) fn is_plain_ident(ident: &str) -> bool {
.map(|c| c == '.' || c == '-' || c == '+') .map(|c| c == '.' || c == '-' || c == '+')
== Some(true) == Some(true)
&& ident_bytes.get(1).map(|c| c.is_ascii_digit()) == Some(true)) && ident_bytes.get(1).map(|c| c.is_ascii_digit()) == Some(true))
&& ident != "inf"
&& ident != "-inf"
&& ident != "nan"
&& ident != "true"
&& ident != "false"
&& ident != "null"
} }
#[cfg(test)] #[cfg(test)]