update dcgs to handle ; and ->

This commit is contained in:
Mark Thom
2018-10-27 20:56:23 -06:00
parent a4e882756e
commit 81f4128bc6
2 changed files with 34 additions and 9 deletions

View File

@@ -4,6 +4,7 @@ use prolog_parser::tabled_rc::*;
use std::cell::{Cell, RefCell};
use std::collections::{BTreeSet, HashMap, VecDeque};
use std::cmp::Ordering;
use std::fmt;
use std::ops::{Add, AddAssign, Index, IndexMut, Sub};
use std::rc::Rc;
@@ -660,6 +661,18 @@ pub enum Addr {
Str(usize)
}
impl fmt::Display for Addr {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
&Addr::Con(ref c) => write!(f, "Addr::Con({})", c),
&Addr::Lis(l) => write!(f, "Addr::Lis({})", l),
&Addr::HeapCell(h) => write!(f, "Addr::HeapCell({})", h),
&Addr::StackCell(fr, sc)=> write!(f, "Addr::StackCell({}, {})", fr, sc),
&Addr::Str(s) => write!(f, "Addr::Str({})", s)
}
}
}
impl PartialEq<Ref> for Addr {
fn eq(&self, r: &Ref) -> bool {
self.as_var() == Some(*r)