]> Repositorios git - scryer-prolog.git/commitdiff
resolve conformity test #138 (issue #52)
authorMark Thom <[email protected]>
Sun, 7 Apr 2019 16:07:17 +0000 (10:07 -0600)
committerMark Thom <[email protected]>
Sun, 7 Apr 2019 16:07:17 +0000 (10:07 -0600)
Cargo.toml
README.md
src/prolog/heap_print.rs

index dcc362f21d3e4fc3c32839a763c6129012ecefe2..73566b4f8a607cfee454cf25a30c48c2d58c5d9b 100644 (file)
@@ -1,6 +1,6 @@
 [package]
 name = "scryer-prolog"
-version = "0.8.46"
+version = "0.8.47"
 authors = ["Mark Thom <[email protected]>"]
 repository = "https://github.com/mthom/scryer-prolog"
 description = "A modern Prolog implementation written mostly in Rust."
index 1b22195cb18ee460937f3086097627a11c0e6420..acfe955471016a8348638db92e7cbec367b5cef5 100644 (file)
--- a/README.md
+++ b/README.md
@@ -39,9 +39,9 @@ Extend Scryer Prolog to include the following, among other features:
 - [x] Attributed variables using the SICStus Prolog interface and
       semantics. Adding coroutines like `dif/2`, `freeze/2`, etc.
       is straightforward with attributed variables.
-         * [x] Support for `verify_attributes/3`
-         * [x] Support for `attribute_goals/2` and `project_attributes/2`
-         * [x] `call_residue_vars/2`
+      ... * [x] Support for `verify_attributes/3`
+      ... * [x] Support for `attribute_goals/2` and `project_attributes/2`
+      ... * [x] `call_residue_vars/2`
 - [x] `if_` and related predicates, following the developments of the
       paper "Indexing `dif/2`".
 - [x] All-solutions predicates (`findall/{3,4}`, `bagof/3`, `setof/3`, `forall/2`).
index 632a8fdb6432e78a397b564646c4e0c4fbeac03b..496ffa9d571910a6a54eaee5857b7c318d91ef7a 100644 (file)
@@ -403,7 +403,6 @@ impl<'a, Outputter: HCValueOutputter> HCPrinter<'a, Outputter>
         requires_space(tail, atom)
     }
 
-    // TODO: create a DirectedOp factory method. Use it here, and above.
     fn enqueue_op(&mut self, ct: ClauseType, spec: SharedOpDesc) {
         if is_postfix!(spec.assoc()) {
             let right_directed_op = DirectedOp::Right(ct.name(), spec.clone());
@@ -411,10 +410,13 @@ impl<'a, Outputter: HCValueOutputter> HCPrinter<'a, Outputter>
             self.state_stack.push(TokenOrRedirect::Op(ct.name(), spec));
             self.state_stack.push(TokenOrRedirect::CompositeRedirect(right_directed_op));
         } else if is_prefix!(spec.assoc()) {
-            if ct.name().as_str() == "-" {
-                self.format_negated_operand(spec);
-                return;
-            }
+            match ct.name().as_str() {
+                "-" | "\\" => {
+                    self.format_prefix_op_with_space(ct.name(), spec);
+                    return;
+                },
+                _ => {}
+            };
 
             let left_directed_op = DirectedOp::Left(ct.name(), spec.clone());
 
@@ -445,13 +447,13 @@ impl<'a, Outputter: HCValueOutputter> HCPrinter<'a, Outputter>
         self.state_stack.push(TokenOrRedirect::Atom(name));
     }
 
-    fn format_negated_operand(&mut self, spec: SharedOpDesc)
+    fn format_prefix_op_with_space(&mut self, name: ClauseName, spec: SharedOpDesc)
     {
-        let op = DirectedOp::Left(clause_name!("-"), spec);
+        let op = DirectedOp::Left(name.clone(), spec);
 
         self.state_stack.push(TokenOrRedirect::CompositeRedirect(op));
         self.state_stack.push(TokenOrRedirect::Space);
-        self.state_stack.push(TokenOrRedirect::Atom(clause_name!("-")));
+        self.state_stack.push(TokenOrRedirect::Atom(name));
     }
 
     fn format_curly_braces(&mut self)