add eq, neq predicates.

This commit is contained in:
Mark Thom
2018-02-10 23:34:30 -07:00
parent 211bdd3a13
commit e7560150b0
11 changed files with 172 additions and 48 deletions

View File

@@ -399,12 +399,14 @@ pub enum QueryTerm {
Catch(Vec<Box<Term>>),
Cut,
Display(Vec<Box<Term>>),
DuplicateTerm(Vec<Box<Term>>),
DuplicateTerm(Vec<Box<Term>>),
Eq(Vec<Box<Term>>),
Functor(Vec<Box<Term>>),
Ground(Vec<Box<Term>>),
Inlined(InlinedQueryTerm),
Is(Vec<Box<Term>>),
Jump(JumpStub),
NotEq(Vec<Box<Term>>),
SetupCallCleanup(Vec<Box<Term>>),
Term(Term),
Throw(Vec<Box<Term>>)
@@ -417,12 +419,14 @@ impl QueryTerm {
&QueryTerm::Catch(_) => 3,
&QueryTerm::Display(_) => 1,
&QueryTerm::Throw(_) => 1,
&QueryTerm::DuplicateTerm(_) => 2,
&QueryTerm::DuplicateTerm(_) => 2,
&QueryTerm::Eq(_) => 2,
&QueryTerm::Functor(_) => 3,
&QueryTerm::Ground(_) => 1,
&QueryTerm::Inlined(ref term) => term.arity(),
&QueryTerm::Is(_) => 2,
&QueryTerm::Jump(ref vars) => vars.len(),
&QueryTerm::NotEq(_) => 2,
&QueryTerm::CallN(ref terms) => terms.len(),
&QueryTerm::Cut => 0,
&QueryTerm::SetupCallCleanup(_) => 3,
@@ -445,9 +449,11 @@ pub enum ClauseType<'a> {
Deep(Level, &'a Cell<RegType>, &'a TabledRc<Atom>, Option<Fixity>),
Display,
DuplicateTerm,
Eq,
Functor,
Ground,
Is,
NotEq,
Root(&'a TabledRc<Atom>),
SetupCallCleanup,
Throw,
@@ -463,9 +469,11 @@ impl<'a> ClauseType<'a> {
&ClauseType::Display => "display",
&ClauseType::Deep(_, _, name, _) => name.as_str(),
&ClauseType::DuplicateTerm => "duplicate_term",
&ClauseType::Eq => "==",
&ClauseType::Functor => "functor",
&ClauseType::Ground => "ground",
&ClauseType::Is => "is",
&ClauseType::NotEq => "\\==",
&ClauseType::Root(name) => name.as_str(),
&ClauseType::SetupCallCleanup => "setup_call_cleanup",
&ClauseType::Throw => "throw"
@@ -857,7 +865,9 @@ pub enum ControlInstruction {
DisplayExecute,
Deallocate,
DuplicateTermCall,
DuplicateTermExecute,
DuplicateTermExecute,
EqCall,
EqExecute,
Execute(TabledRc<Atom>, usize),
ExecuteN(usize),
FunctorCall,
@@ -871,6 +881,8 @@ pub enum ControlInstruction {
JmpByExecute(usize, usize),
IsCall(RegType, ArithmeticTerm),
IsExecute(RegType, ArithmeticTerm),
NotEqCall,
NotEqExecute,
Proceed,
ThrowCall,
ThrowExecute,
@@ -888,11 +900,15 @@ impl ControlInstruction {
&ControlInstruction::DisplayExecute => true,
&ControlInstruction::DuplicateTermCall => true,
&ControlInstruction::DuplicateTermExecute => true,
&ControlInstruction::EqCall => true,
&ControlInstruction::EqExecute => true,
&ControlInstruction::Execute(_, _) => true,
&ControlInstruction::CallN(_) => true,
&ControlInstruction::ExecuteN(_) => true,
&ControlInstruction::FunctorCall => true,
&ControlInstruction::FunctorExecute => true,
&ControlInstruction::NotEqCall => true,
&ControlInstruction::NotEqExecute => true,
&ControlInstruction::ThrowCall => true,
&ControlInstruction::ThrowExecute => true,
&ControlInstruction::GetCleanerCall => true,
@@ -903,7 +919,7 @@ impl ControlInstruction {
&ControlInstruction::IsCall(..) => true,
&ControlInstruction::IsExecute(..) => true,
&ControlInstruction::JmpByCall(..) => true,
&ControlInstruction::JmpByExecute(..) => true,
&ControlInstruction::JmpByExecute(..) => true,
_ => false
}
}