address issues #121 - #123

This commit is contained in:
Mark Thom
2019-04-27 21:51:48 -06:00
parent 531d8b3352
commit 9b21e04539
3 changed files with 460 additions and 462 deletions

View File

@@ -1,6 +1,6 @@
[package] [package]
name = "scryer-prolog" name = "scryer-prolog"
version = "0.8.68" version = "0.8.69"
authors = ["Mark Thom <markjordanthom@gmail.com>"] authors = ["Mark Thom <markjordanthom@gmail.com>"]
repository = "https://github.com/mthom/scryer-prolog" repository = "https://github.com/mthom/scryer-prolog"
description = "A modern Prolog implementation written mostly in Rust." description = "A modern Prolog implementation written mostly in Rust."
@@ -14,7 +14,7 @@ cfg-if = "0.1.7"
downcast = "0.10.0" downcast = "0.10.0"
num = "0.2" num = "0.2"
ordered-float = "0.5.0" ordered-float = "0.5.0"
prolog_parser = "0.8.21" prolog_parser = "0.8.22"
readline_rs_compat = { version = "0.1.9", optional = true } readline_rs_compat = { version = "0.1.9", optional = true }
ref_thread_local = "0.0.0" ref_thread_local = "0.0.0"

View File

@@ -465,7 +465,7 @@ impl<'a, Outputter: HCValueOutputter> HCPrinter<'a, Outputter>
} else { // if is_infix!(spec.assoc()) } else { // if is_infix!(spec.assoc())
match ct.name().as_str() { match ct.name().as_str() {
"|" => { "|" => {
self.format_bar_separator_op_with_space(ct.name(), spec); self.format_bar_separator_op(ct.name(), spec);
return; return;
}, },
_ => {} _ => {}
@@ -504,7 +504,7 @@ impl<'a, Outputter: HCValueOutputter> HCPrinter<'a, Outputter>
self.state_stack.push(TokenOrRedirect::Atom(name)); self.state_stack.push(TokenOrRedirect::Atom(name));
} }
fn format_bar_separator_op_with_space(&mut self, name: ClauseName, spec: SharedOpDesc) fn format_bar_separator_op(&mut self, name: ClauseName, spec: SharedOpDesc)
{ {
let left_directed_op = DirectedOp::Left(name.clone(), spec.clone()); let left_directed_op = DirectedOp::Left(name.clone(), spec.clone());
let right_directed_op = DirectedOp::Right(name.clone(), spec.clone()); let right_directed_op = DirectedOp::Right(name.clone(), spec.clone());

View File

@@ -1971,7 +1971,6 @@ foo(X) :- call(X) -> call(X).");
assert_prolog_success!(&mut wam, "catch((atom_length(Atom,4),false),error(instantiation_error,_),true)."); assert_prolog_success!(&mut wam, "catch((atom_length(Atom,4),false),error(instantiation_error,_),true).");
assert_prolog_success!(&mut wam, "catch((atom_length(1.23,4),false),error(type_error(atom,1.23),_),true)."); assert_prolog_success!(&mut wam, "catch((atom_length(1.23,4),false),error(type_error(atom,1.23),_),true).");
assert_prolog_success!(&mut wam, "catch((atom_length(atom,'4'),false),error(type_error(integer,'4'),_),true)."); assert_prolog_success!(&mut wam, "catch((atom_length(atom,'4'),false),error(type_error(integer,'4'),_),true).");
} }
#[test] #[test]
@@ -2293,8 +2292,7 @@ fn test_queries_on_string_lists()
[["X = [a,b,c,d,e,f|_]","Y = [d,e,f|_]","G = _"]]); [["X = [a,b,c,d,e,f|_]","Y = [d,e,f|_]","G = _"]]);
assert_prolog_success!(&mut wam, "partial_string(\"abc\",X),matcher(X,Y),[d,e,f | G] = Y.", assert_prolog_success!(&mut wam, "partial_string(\"abc\",X),matcher(X,Y),[d,e,f | G] = Y.",
[["X = [a,b,c,d,e,f|_]","Y = [d,e,f|_]","G = _"]]); [["X = [a,b,c,d,e,f|_]","Y = [d,e,f|_]","G = _"]]);
assert_prolog_success!(&mut wam, "partial_string(\"abc\", X), matcher(X, Y), Y = [d, e, f | G], assert_prolog_success!(&mut wam, "partial_string(\"abc\",X),matcher(X,Y),Y = [d,e,f | G], G = \"ghi\".",
G = \"ghi\".",
[["X = [a,b,c,d,e,f,g,h,i]","Y = [d,e,f,g,h,i]","G = [g,h,i]"]]); [["X = [a,b,c,d,e,f,g,h,i]","Y = [d,e,f,g,h,i]","G = [g,h,i]"]]);
assert_prolog_success!(&mut wam, "partial_string(\"abc\",X),matcher(X,Y),Y = [d,e,f | G], assert_prolog_success!(&mut wam, "partial_string(\"abc\",X),matcher(X,Y),Y = [d,e,f | G],
is_partial_string(Y),G = \"ghi\".", is_partial_string(Y),G = \"ghi\".",