clean up arithmetic.rs

This commit is contained in:
Mark Thom
2018-01-18 19:54:15 -07:00
parent 8f012ecfd3
commit 1b402b2673
3 changed files with 69 additions and 57 deletions

View File

@@ -366,15 +366,34 @@ pub struct Rule {
#[derive(Clone, Copy)]
pub enum ClauseType<'a> {
Arg,
CallN,
Catch,
Deep(Level, &'a Cell<RegType>, &'a TabledRc<Atom>, Option<Fixity>),
Display,
DuplicateTerm,
Functor,
Is,
Root,
Root(&'a TabledRc<Atom>),
Throw,
}
impl<'a> ClauseType<'a> {
pub fn name(&self) -> &'a str {
match self {
&ClauseType::Arg => "arg",
&ClauseType::CallN => "call",
&ClauseType::Catch => "catch",
&ClauseType::Deep(_, _, name, _) => name.as_str(),
&ClauseType::Display => "display",
&ClauseType::DuplicateTerm => "duplicate_term",
&ClauseType::Functor => "functor",
&ClauseType::Is => "is",
&ClauseType::Root(name) => name.as_str(),
&ClauseType::Throw => "throw"
}
}
pub fn level_of_subterms(self) -> Level {
match self {
ClauseType::Deep(..) => Level::Deep,