mirror of https://github.com/kdl-org/kdl-rs.git
fix: identifiers equal to a keyword are not quoted #132
This commit is contained in:
parent
439aa63bfc
commit
2f734a9566
|
|
@ -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)]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue