do a better job recognizing and bracketing operators

This commit is contained in:
Mark Thom
2019-03-31 11:35:19 -06:00
parent 252873694b
commit 701cbc7a19
3 changed files with 9 additions and 7 deletions

View File

@@ -14,7 +14,7 @@ cfg-if = "0.1.7"
downcast = "0.10.0"
num = "0.2"
ordered-float = "0.5.0"
prolog_parser = "0.8.8"
prolog_parser = { version = "0.8.9", path = "../prolog_parser" }
readline_rs_compat = { version = "0.1.7", optional = true }
ref_thread_local = "0.0.0"

View File

@@ -536,7 +536,7 @@ impl<'a, Outputter: HCValueOutputter> HCPrinter<'a, Outputter>
fn print_atom(&mut self, atom: &ClauseName) {
push_space_if_amb!(self, atom.as_str(), {
match atom.as_str() {
"" => self.append_str("''"),
"''" => self.append_str("''"),
s => self.print_op_addendum(s)
}
});

View File

@@ -1880,8 +1880,10 @@ impl MachineState {
}
}
fn try_functor_compound_case(&mut self, name: ClauseName, arity: usize) {
let name = Addr::Con(Constant::Atom(name, None));
fn try_functor_compound_case(&mut self, name: ClauseName, arity: usize,
spec: Option<(usize, Specifier)>)
{
let name = Addr::Con(Constant::Atom(name, spec));
let arity = Addr::Con(integer!(arity));
self.try_functor_unify_components(name, arity);
@@ -1898,12 +1900,12 @@ impl MachineState {
self.try_functor_unify_components(a1, Addr::Con(integer!(0))),
Addr::Str(o) =>
match self.heap[o].clone() {
HeapCellValue::NamedStr(arity, name, _) =>
self.try_functor_compound_case(name, arity),
HeapCellValue::NamedStr(arity, name, spec) =>
self.try_functor_compound_case(name, arity, spec),
_ => self.fail = true
},
Addr::Lis(_) =>
self.try_functor_compound_case(clause_name!("."), 2),
self.try_functor_compound_case(clause_name!("."), 2, None),
Addr::AttrVar(..) | Addr::HeapCell(_) | Addr::StackCell(..) => {
let name = self.store(self.deref(self[temp_v!(2)].clone()));
let arity = self.store(self.deref(self[temp_v!(3)].clone()));