From af14832b6cfbec9b378b8b8f447676861d95dab4 Mon Sep 17 00:00:00 2001 From: Mark Thom Date: Wed, 15 Apr 2020 00:54:32 -0600 Subject: [PATCH] quote dot when quoted(true) (#349) --- Cargo.lock | 4 +++- src/prolog/heap_print.rs | 4 ++-- src/prolog/toplevel.pl | 1 + 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cd183d59..34a10e99 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -478,6 +478,7 @@ dependencies = [ [[package]] name = "prolog_parser" version = "0.8.52" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "lexical 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "num-rug-adapter 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -621,7 +622,7 @@ dependencies = [ "nix 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", "num-rug-adapter 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "ordered-float 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "prolog_parser 0.8.52", + "prolog_parser 0.8.52 (registry+https://github.com/rust-lang/crates.io-index)", "ref_thread_local 0.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "rug 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "rustyline 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -851,6 +852,7 @@ dependencies = [ "checksum proc-macro-hack 0.5.14 (registry+https://github.com/rust-lang/crates.io-index)" = "fcfdefadc3d57ca21cf17990a28ef4c0f7c61383a28cb7604cf4a18e6ede1420" "checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" "checksum proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)" = "6c09721c6781493a2a492a96b5a5bf19b65917fe6728884e7c44dd0c60ca3435" +"checksum prolog_parser 0.8.52 (registry+https://github.com/rust-lang/crates.io-index)" = "6d9baffc92f102756f07ef5a367409d4d78ddb5c32bc3bd6ee4584a27f79408d" "checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" "checksum quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2bdc6c187c65bca4260c9011c9e3132efe4909da44726bad24cf7572ae338d7f" "checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" diff --git a/src/prolog/heap_print.rs b/src/prolog/heap_print.rs index ed9b9859..c9cd42a5 100644 --- a/src/prolog/heap_print.rs +++ b/src/prolog/heap_print.rs @@ -442,7 +442,7 @@ fn non_quoted_token>(mut iter: Iter) -> bool { if let Some(c) = iter.next() { if small_letter_char!(c) { iter.all(|c| alpha_numeric_char!(c)) - } else if graphic_token_char!(c) { + } else if c != '.' && graphic_token_char!(c) { non_quoted_graphic_token(iter, c) } else if semicolon_char!(c) { iter.next().is_none() @@ -1116,7 +1116,7 @@ impl<'a, Outputter: HCValueOutputter> HCPrinter<'a, Outputter> { let mut char_count = 0; for c in buf_iter { - self.push_char('.'); + self.append_str("'.'"); self.push_char('('); char_printer(self, c); diff --git a/src/prolog/toplevel.pl b/src/prolog/toplevel.pl index 37afaf6f..4da303ce 100644 --- a/src/prolog/toplevel.pl +++ b/src/prolog/toplevel.pl @@ -123,6 +123,7 @@ atom(Value), atom_chars(Value, ValueChars), '$list_last_item'(ValueChars, Char), + Char \== '.', '$graphic_token_char'(Char). '$write_eqs_and_read_input'(B, VarList) :- -- 2.54.0