Skip to content

Commit 564d4ae

Browse files
authored
fix(fmt): identifiers equal to a keyword are not quoted #132 (#137)
1 parent 758bd63 commit 564d4ae

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/value.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,12 @@ pub(crate) fn is_plain_ident(ident: &str) -> bool {
186186
.map(|c| c == '.' || c == '-' || c == '+')
187187
== Some(true)
188188
&& ident_bytes.get(1).map(|c| c.is_ascii_digit()) == Some(true))
189+
&& ident != "inf"
190+
&& ident != "-inf"
191+
&& ident != "nan"
192+
&& ident != "true"
193+
&& ident != "false"
194+
&& ident != "null"
189195
}
190196

191197
#[cfg(test)]

0 commit comments

Comments
 (0)