summaryrefslogtreecommitdiff
path: root/dhall/src/syntax
diff options
context:
space:
mode:
authorNadrieril2020-10-28 23:40:28 +0000
committerGitHub2020-10-28 23:40:28 +0000
commitf8234684b1129dac84d09adfb24bdc0f98448b9b (patch)
tree1440cfb514fa856718074f2b1ebce801459b5c0c /dhall/src/syntax
parent70727acbda68e104f60ae1dbbe95adbcec08a628 (diff)
parentaf16e9699799f8cfbd228e2832e1d5df3653116b (diff)
Merge pull request #189 from Nadrieril/serialize
Diffstat (limited to 'dhall/src/syntax')
-rw-r--r--dhall/src/syntax/text/printer.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/dhall/src/syntax/text/printer.rs b/dhall/src/syntax/text/printer.rs
index 0c2eb2e..4b7b8b8 100644
--- a/dhall/src/syntax/text/printer.rs
+++ b/dhall/src/syntax/text/printer.rs
@@ -156,7 +156,9 @@ fn fmt_label(label: &Label, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
};
if s.is_empty() {
write!(f, "``")
- } else if !is_reserved && s.chars().all(|c| c.is_ascii_alphanumeric()) {
+ } else if !is_reserved
+ && s.chars().all(|c| c.is_ascii_alphanumeric() || c == '_')
+ {
write!(f, "{}", s)
} else {
write!(f, "`{}`", s)