From a09306c58524fb9f378d6df6cbe60a1b9922e08e Mon Sep 17 00:00:00 2001 From: Mark Date: Thu, 29 Jun 2023 17:59:25 -0600 Subject: [PATCH] check ambiguity of "'" against tail if atom token is about to be quoted --- src/heap_print.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/heap_print.rs b/src/heap_print.rs index 3f48aed7..4025339c 100644 --- a/src/heap_print.rs +++ b/src/heap_print.rs @@ -568,7 +568,12 @@ impl<'a, Outputter: HCValueOutputter> HCPrinter<'a, Outputter> { #[inline] fn ambiguity_check(&self, atom: &str) -> bool { let tail = self.outputter.range_from(self.last_item_idx..); - requires_space(tail, atom) + + if !self.quoted || non_quoted_token(atom.chars()) { + requires_space(tail, atom) + } else { + requires_space(tail, "'") + } } fn enqueue_op(&mut self, mut max_depth: usize, name: Atom, spec: OpDesc) { -- 2.54.0