resolve conformity test #138 (issue #52)

This commit is contained in:
Mark Thom
2019-04-07 10:07:17 -06:00
parent 68f89b32b8
commit 4bd9908b89
3 changed files with 14 additions and 12 deletions

View File

@@ -1,6 +1,6 @@
[package]
name = "scryer-prolog"
version = "0.8.46"
version = "0.8.47"
authors = ["Mark Thom <markjordanthom@gmail.com>"]
repository = "https://github.com/mthom/scryer-prolog"
description = "A modern Prolog implementation written mostly in Rust."

View File

@@ -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`).

View 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)