Commit fb6de8a6 authored by Jeff Smits's avatar Jeff Smits

Moved types to new file to write custom aterm factory

parent cf662871
use types::{Result, Error, ATermFactory, ATerm, ATermRef};
use types::{Result, Error};
use factory::{ATermFactory, ATerm, ATermRef};
use std::collections::HashMap;
use std::fmt;
use std::borrow::Borrow;
......
use aterm;
use std::rc::Rc;
pub type Blob = ();
pub type ATermFactory = aterm::rc::ATermFactory<Blob>;
pub type ATerm = aterm::rc::ATerm<Blob>;
pub type ATermRef = Rc<aterm::rc::ATerm<Blob>>;
......@@ -3,7 +3,8 @@ use context::MutContext;
use preprocess;
use preprocess::{SDefT, preprocess};
use primitives::Primitives;
use types::{Result, Error, ATermFactory, ATermRef, b};
use types::{Result, Error};
use factory::{ATermFactory, ATerm, ATermRef};
use aterm::{ATerm as A, Term, ATermFactory as ATF};
use aterm::BrokenF32;
......@@ -14,6 +15,12 @@ use ref_eq::ref_eq;
use std::iter;
use std::borrow::Borrow;
pub fn b<'a>(ar: &'a ATermRef) -> &'a ATerm {
Borrow::<ATerm>::borrow(ar)
}
macro_rules! eprintln {
($($tt:tt)*) => {{
use std::io::{Write, stderr};
......
......@@ -18,11 +18,13 @@ use std::process;
use aterm::parse::ATermRead;
use aterm::print::ATermWrite;
use types::{Result, ATermFactory, ATermRef, Error};
use types::{Result, Error};
use factory::{ATermFactory, ATermRef};
use interpreter::interpret_main;
use primitives::Primitives;
mod types;
mod factory;
mod interpreter;
mod ctree;
mod context;
......
use types::{Result, Error, ATermRef};
use types::{Result, Error};
use factory::ATermRef;
use ctree;
use try_from::{TryInto, TryFrom};
use std::result;
......
......@@ -3,7 +3,8 @@
use phf;
use context::MutContext;
use preprocess::SDefT;
use types::{Result, ATermRef};
use types::Result;
use factory::ATermRef;
pub mod ssl;
......
......@@ -2,7 +2,8 @@ use context::MutContext;
use aterm::{Term, ATermFactory as ATF, ATerm as A};
use aterm::print::ATermWrite;
use aterm::parse::ATermRead;
use types::{Error, Result, ATermRef};
use types::{Error, Result};
use factory::ATermRef;
use preprocess::SDefT;
use interpreter::{from_cons_nil_list, to_cons_nil_list};
......
......@@ -4,17 +4,6 @@ use std::io;
use std::result;
use std::error;
use std::fmt;
use std::rc::Rc;
use std::borrow::Borrow;
pub type Blob = ();
pub type ATermFactory = aterm::rc::ATermFactory<Blob>;
pub type ATerm = aterm::rc::ATerm<Blob>;
pub type ATermRef = Rc<aterm::rc::ATerm<Blob>>;
pub fn b<'a>(ar: &'a ATermRef) -> &'a ATerm {
Borrow::<ATerm>::borrow(ar)
}
pub type Result<T> = result::Result<T, Error>;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment