From: Mark Thom Date: Sun, 7 Apr 2019 16:07:17 +0000 (-0600) Subject: resolve conformity test #138 (issue #52) X-Git-Tag: v0.8.110~110 X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=4bd9908b894f839fed07d3fc18c7a57852a6de4c;p=scryer-prolog.git resolve conformity test #138 (issue #52) --- diff --git a/Cargo.toml b/Cargo.toml index dcc362f2..73566b4f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "scryer-prolog" -version = "0.8.46" +version = "0.8.47" authors = ["Mark Thom "] repository = "https://github.com/mthom/scryer-prolog" description = "A modern Prolog implementation written mostly in Rust." diff --git a/README.md b/README.md index 1b22195c..acfe9554 100644 --- 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`). diff --git a/src/prolog/heap_print.rs b/src/prolog/heap_print.rs index 632a8fdb..496ffa9d 100644 --- a/src/prolog/heap_print.rs +++ b/src/prolog/heap_print.rs @@ -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)