]> Repositorios git - scryer-prolog.git/commitdiff
check ambiguity of "'" against tail if atom token is about to be quoted
authorMark <[email protected]>
Thu, 29 Jun 2023 23:59:25 +0000 (17:59 -0600)
committerMark <[email protected]>
Sun, 2 Jul 2023 17:10:33 +0000 (11:10 -0600)
src/heap_print.rs

index 3f48aed7c2bc882ec0a6ff8a7c660429e01db90b..4025339cef51b154bd5d2b75300acc20cc83a301 100644 (file)
@@ -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) {