summaryrefslogtreecommitdiff
path: root/dhall/src/syntax/text
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--dhall/src/syntax/text/dhall.abnf2
-rw-r--r--dhall/src/syntax/text/printer.rs4
2 files changed, 4 insertions, 2 deletions
diff --git a/dhall/src/syntax/text/dhall.abnf b/dhall/src/syntax/text/dhall.abnf
index 861f7b3..05d76e6 100644
--- a/dhall/src/syntax/text/dhall.abnf
+++ b/dhall/src/syntax/text/dhall.abnf
@@ -206,7 +206,7 @@ quoted-label-char =
; %x60 = '`'
/ %x61-7E
-quoted-label = 1*quoted-label-char
+quoted-label = *quoted-label-char
; NOTE: Dhall does not support Unicode labels, mainly to minimize the potential
; for code obfuscation
diff --git a/dhall/src/syntax/text/printer.rs b/dhall/src/syntax/text/printer.rs
index ccba385..8815d69 100644
--- a/dhall/src/syntax/text/printer.rs
+++ b/dhall/src/syntax/text/printer.rs
@@ -154,7 +154,9 @@ fn fmt_label(label: &Label, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
| "True" | "False" | "Some" => true,
_ => Builtin::parse(&s).is_some(),
};
- if !is_reserved && s.chars().all(|c| c.is_ascii_alphanumeric()) {
+ if s.is_empty() {
+ write!(f, "``")
+ } else if !is_reserved && s.chars().all(|c| c.is_ascii_alphanumeric()) {
write!(f, "{}", s)
} else {
write!(f, "`{}`", s)