Commit 39f8cb86 by Jeff Smits

Remove owned Strings from AST, lifetimes everywhere :|

parent de4cd12a
......@@ -202,7 +202,7 @@ fn write_primitive_libs(
"\
pub fn eval_prim_ref<'d, 'f : 'd>(prim_ref: (Libs, usize),
context: &MutContext<'d, 'f>,
sargs: Vec<StrategyDef<'d>>,
sargs: Vec<StrategyDef<'d, 'f>>,
targs: Vec<ATermRef<'f>>,
current: ATermRef<'f>)
-> Result<ATermRef<'f>>
......@@ -269,7 +269,7 @@ fn write_primitives(
#[inline]
fn {}<'d, 'f : 'd>(offset: usize,
context: &MutContext<'d, 'f>,
sargs: Vec<StrategyDef<'d>>,
sargs: Vec<StrategyDef<'d, 'f>>,
targs: Vec<ATermRef<'f>>,
current: ATermRef<'f>)
-> Result<ATermRef<'f>>
......
......@@ -14,8 +14,8 @@ use std::cell::RefCell;
/// want to pass around the mutable fields separately. But the internal mutability is not a hidden
/// thing, there is observable effect, so the name of the context includes `Mut`.
pub struct MutContext<'d, 'f : 'd> {
pub stack_tracer: RefCell<StackTracer>,
pub scopes: RefCell<Vec<Scope<'d, ATermRef<'f>>>>,
pub stack_tracer: RefCell<StackTracer<'f>>,
pub scopes: RefCell<Vec<Scope<'d, 'f, ATermRef<'f>>>>,
pub factory: &'f ATermFactory,
pub primitives: Vec<&'static Primitives>,
pub ssl_state: RefCell<State<'f>>,
......@@ -24,7 +24,7 @@ pub struct MutContext<'d, 'f : 'd> {
impl<'d, 'f : 'd> MutContext<'d, 'f> {
pub fn new(
factory: &'f ATermFactory,
scopes: Vec<Scope<'d, ATermRef<'f>>>,
scopes: Vec<Scope<'d, 'f, ATermRef<'f>>>,
primitives: Vec<&'static Primitives>,
) -> MutContext<'d, 'f> {
MutContext {
......@@ -38,8 +38,8 @@ impl<'d, 'f : 'd> MutContext<'d, 'f> {
pub fn call_primitive(
&self,
prim_name: &str,
sargs: Vec<StrategyDef<'d>>,
prim_name: &'f str,
sargs: Vec<StrategyDef<'d, 'f>>,
targs: Vec<ATermRef<'f>>,
current: ATermRef<'f>,
) -> Result<ATermRef<'f>> {
......@@ -49,7 +49,7 @@ impl<'d, 'f : 'd> MutContext<'d, 'f> {
.cloned() // ATermRef should be very cheap to clone
.next()
.ok_or_else(|| Error::UndefinedPrimitive(prim_name.to_owned()))?;
self.stack_tracer.borrow_mut().push(prim_name.to_owned());
self.stack_tracer.borrow_mut().push(prim_name);
let result = eval_prim_ref(prim_ref, self, sargs, targs, current);
if result.is_ok() {
self.stack_tracer.borrow_mut().pop_on_success();
......@@ -60,7 +60,7 @@ impl<'d, 'f : 'd> MutContext<'d, 'f> {
}
// Should really return a &SDef, but I can't figure out lifetimes that borrowck will accept :(
pub fn get_strategy(&self, strat_name: &str) -> Result<StrategyDef<'d>> {
pub fn get_strategy(&self, strat_name: &str) -> Result<StrategyDef<'d, 'f>> {
self.scopes
.borrow()
.iter()
......@@ -77,11 +77,11 @@ impl<'d, 'f : 'd> MutContext<'d, 'f> {
})
}
pub fn match_term(&self, term_name: &'d str, current: &ATermRef<'f>) -> Result<()> {
pub fn match_term(&self, term_name: &'f str, current: &ATermRef<'f>) -> Result<()> {
Scopes::match_term(&mut self.scopes.borrow_mut(), term_name, current)
}
pub fn push_scope(&self, scope: Scope<'d, ATermRef<'f>>) {
pub fn push_scope(&self, scope: Scope<'d, 'f, ATermRef<'f>>) {
self.scopes.borrow_mut().push(scope);
}
......@@ -95,7 +95,7 @@ impl<'d, 'f : 'd> MutContext<'d, 'f> {
self.push_scope(overlay);
}
fn _apply_overlay(&self, scope: Scope<'d, ATermRef<'f>>) {
fn _apply_overlay(&self, scope: Scope<'d, 'f, ATermRef<'f>>) {
debug_assert!(
scope.strategy.is_empty(),
"_apply_overlay: Interpreter bug, overlay is leaking a strategy definition"
......@@ -162,13 +162,13 @@ impl<'d, 'f : 'd> MutContext<'d, 'f> {
}
#[derive(Debug, Default, Clone)]
pub struct StackTracer {
stack: Vec<String>,
pub struct StackTracer<'a> {
stack: Vec<&'a str>,
current_depth: usize,
}
impl StackTracer {
pub fn push(&mut self, str: String) {
impl<'a> StackTracer<'a> {
pub fn push(&mut self, str: &'a str) {
self.stack.truncate(self.current_depth);
self.stack.push(str);
self.current_depth += 1;
......@@ -183,12 +183,12 @@ impl StackTracer {
self.current_depth = self.stack.len();
}
pub fn stack(&self) -> ::std::slice::Iter<String> {
pub fn stack(&self) -> ::std::slice::Iter<&'a str> {
self.stack.iter()
}
}
impl fmt::Display for StackTracer {
impl<'a> fmt::Display for StackTracer<'a> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
for (n, name) in self.stack.iter().enumerate() {
if n + 1 == self.current_depth {
......@@ -202,17 +202,17 @@ impl fmt::Display for StackTracer {
}
#[derive(Debug, Default, Clone)]
pub struct Scope<'a, ATerm> {
pub term: FnvHashMap<&'a str, Option<ATerm>>,
pub strategy: FnvHashMap<&'a str, StrategyDef<'a>>,
pub struct Scope<'d, 'f: 'd, ATerm> {
pub term: FnvHashMap<&'f str, Option<ATerm>>,
pub strategy: FnvHashMap<&'f str, StrategyDef<'d, 'f>>,
is_overlay: bool,
}
impl<'a, ATerm> Scope<'a, ATerm> {
impl<'d, 'f: 'd, ATerm> Scope<'d, 'f, ATerm> {
pub fn new<IA, IS>(terms: IA, defs: IS) -> Self
where
IA: IntoIterator<Item = (&'a str, ATerm)>,
IS: IntoIterator<Item = (&'a str, StrategyDef<'a>)>,
IA: IntoIterator<Item = (&'f str, ATerm)>,
IS: IntoIterator<Item = (&'f str, StrategyDef<'d, 'f>)>,
{
Scope {
term: terms.into_iter().map(|(n, a)| (n, Some(a))).collect(),
......@@ -223,12 +223,12 @@ impl<'a, ATerm> Scope<'a, ATerm> {
pub fn from_defs<I>(defs: I) -> Self
where
I: IntoIterator<Item = &'a Def>,
I: IntoIterator<Item = &'d Def<'f>>,
{
Scope {
term: FnvHashMap::default(),
strategy: defs.into_iter()
.map(|def| (def.name.as_str(), StrategyDef::from_def(def)))
.map(|def| (def.name, StrategyDef::from_def(def)))
.collect(),
is_overlay: false,
}
......@@ -236,12 +236,12 @@ impl<'a, ATerm> Scope<'a, ATerm> {
pub fn from_let_defs<I>(no_of_scopes: usize, defs: I) -> Self
where
I: IntoIterator<Item=&'a Def>,
I: IntoIterator<Item=&'d Def<'f>>,
{
Scope {
term: FnvHashMap::default(),
strategy: defs.into_iter()
.map(|def| (def.name.as_str(), StrategyDef::from_let_def(def, no_of_scopes)))
.map(|def| (def.name, StrategyDef::from_let_def(def, no_of_scopes)))
.collect(),
is_overlay: false,
}
......@@ -249,7 +249,7 @@ impl<'a, ATerm> Scope<'a, ATerm> {
pub fn from_fresh_variables<I>(fresh_vars: I) -> Self
where
I: IntoIterator<Item = &'a str>,
I: IntoIterator<Item = &'f str>,
{
Scope {
term: fresh_vars.into_iter().map(|fresh_var| (fresh_var, None)).collect(),
......@@ -280,9 +280,9 @@ pub mod Scopes {
Err(Error::UndefinedVariable(term_name.to_owned()))
}
pub fn match_term<'a, 'f>(
scopes: &mut Vec<Scope<'a, ATermRef<'f>>>,
term_name: &'a str,
pub fn match_term<'d, 'f>(
scopes: &mut Vec<Scope<'d, 'f, ATermRef<'f>>>,
term_name: &'f str,
current: &ATermRef<'f>,
) -> Result<()> {
let term = get_term_option(scopes, term_name)?;
......
......@@ -482,6 +482,16 @@ impl<'s> ATermFactory {
pub fn stratego_placeholder(&'s self, term: ATermRef<'s>) -> ATermRef<'s> {
Rc::new(ATerm::no_annos(Term::Placeholder(aterm::TermPlaceholder::Term, term)))
}
pub fn intern_string<S>(&'s self, string: S) -> &'s str
where
S: Into<Cow<'s, str>>,
{
use aterm::utils::extend_lifetime_mut;
let mut string_cache = unsafe { extend_lifetime_mut(&mut self.string_cache.borrow_mut()) };
string_cache.insert(string.into().as_ref())
}
}
impl Default for ATermFactory {
......@@ -500,13 +510,8 @@ impl<'s> aterm::ATermFactory<'s> for ATermFactory {
S: Into<Cow<'s, str>>,
{
use self::Term::Application;
use aterm::utils::extend_lifetime_mut;
// I'm not sure why I even need to extend the lifetime here, so this could be totally wrong!
// But if we add something to the string cache, and then use a reference to it, that
// *should* be fine right?
let mut string_cache = unsafe { extend_lifetime_mut(&mut self.string_cache.borrow_mut()) };
let cons = string_cache.insert(constructor.into().as_ref());
let cons = self.intern_string(constructor);
Rc::new(ATerm::no_annos(Application(
cons,
children.into_iter().collect::<Vec<_>>().into_boxed_slice(),
......@@ -528,13 +533,7 @@ impl<'s> aterm::ATermFactory<'s> for ATermFactory {
where
S: Into<Cow<'s, str>>,
{
use aterm::utils::extend_lifetime_mut;
// I'm not sure why I even need to extend the lifetime here, so this could be totally wrong!
// But if we add something to the string cache, and then use a reference to it, that
// *should* be fine right?
let mut string_cache = unsafe { extend_lifetime_mut(&mut self.string_cache.borrow_mut()) };
let string = string_cache.insert(value.into().as_ref());
let string = self.intern_string(value);
Rc::new(ATerm::no_annos(Term::String(string)))
}
......
use context::{MutContext, StackTracer};
use context::MutContext;
use error::{Result, Error};
use factory::{ATermFactory, ATermRef};
use preprocess;
......@@ -21,7 +21,7 @@ macro_rules! eprintln {
}
#[derive(Debug)]
pub struct TracedError(pub Error, pub StackTracer);
pub struct TracedError(pub Error, pub String);
pub struct Libraries<A> {
libs: Vec<A>,
......@@ -30,19 +30,19 @@ pub struct Libraries<A> {
impl From<Error> for TracedError {
fn from(e: Error) -> Self {
TracedError(e, StackTracer::default())
TracedError(e, String::new())
}
}
impl From<::std::io::Error> for TracedError {
fn from(e: ::std::io::Error) -> Self {
TracedError(e.into(), StackTracer::default())
TracedError(e.into(), String::new())
}
}
impl From<::std::fmt::Error> for TracedError {
fn from(e: ::std::fmt::Error) -> Self {
TracedError(e.into(), StackTracer::default())
TracedError(e.into(), String::new())
}
}
......@@ -93,7 +93,7 @@ pub fn interpret<'f>(
let program = match match_(&program).and_then(preprocess) {
Ok(v) => v,
Err(e) => return Err(TracedError(e, StackTracer::default())),
Err(e) => return Err(TracedError(e, String::new())),
};
let libs = match libraries
.libs
......@@ -101,19 +101,19 @@ pub fn interpret<'f>(
.map(|l| match_(&l).and_then(preprocess))
.collect::<Result<Vec<_>>>() {
Ok(v) => v,
Err(e) => return Err(TracedError(e, StackTracer::default())),
Err(e) => return Err(TracedError(e, String::new())),
};
let base_scopes = libs.iter().map(Scope::from_defs).collect();
let context = MutContext::new(factory, base_scopes, libraries.prims);
context.push_scope(Scope::from_defs(&program));
let main = match context.get_strategy(strategy) {
Ok(v) => v,
Err(e) => return Err(TracedError(e, context.stack_tracer.into_inner())),
Err(e) => return Err(TracedError(e, context.stack_tracer.into_inner().to_string())),
};
let result = eval_sdef(&main, &context, Vec::new(), Vec::new(), input);
match result {
Ok(v) => Ok(v),
Err(e) => Err(TracedError(e, context.stack_tracer.into_inner())),
Err(e) => Err(TracedError(e, context.stack_tracer.into_inner().to_string())),
}
}
......@@ -121,7 +121,7 @@ pub trait Eval<'d, 'f> {
fn eval(&'d self, context: &MutContext<'d, 'f>, current: ATermRef<'f>) -> Result<ATermRef<'f>>;
}
impl<'d, 'f : 'd> Eval<'d, 'f> for preprocess::Strategy {
impl<'d, 'f : 'd> Eval<'d, 'f> for preprocess::Strategy<'f> {
fn eval(&'d self, context: &MutContext<'d, 'f>, current: ATermRef<'f>) -> Result<ATermRef<'f>> {
use preprocess::Strategy::*;
use context;
......@@ -134,7 +134,7 @@ impl<'d, 'f : 'd> Eval<'d, 'f> for preprocess::Strategy {
context.pop_scope();
result
}
CallT(ref name, ref sargs, ref targs) => {
CallT(name, ref sargs, ref targs) => {
let sdeft = context.get_strategy(name)?;
let sargs = sargs
.into_iter()
......@@ -147,7 +147,7 @@ impl<'d, 'f : 'd> Eval<'d, 'f> for preprocess::Strategy {
.collect::<Result<_>>()?;
eval_sdef(&sdeft, context, sargs, targs, current)
}
CallDynamic(ref term_name, ref sargs, ref targs) => {
CallDynamic(term_name, ref sargs, ref targs) => {
let strategy_name = context.get_term(term_name)?;
let strategy_name = strategy_name.get_string().ok_or_else(|| {
Error::UndefinedStrategy(format!(
......@@ -187,7 +187,7 @@ impl<'d, 'f : 'd> Eval<'d, 'f> for preprocess::Strategy {
}
Build(ref term) => term.build(context),
Scope(ref fresh_names, ref body) => {
context.push_scope(context::Scope::from_fresh_variables(fresh_names.iter().map(|s| s.as_str())));
context.push_scope(context::Scope::from_fresh_variables(fresh_names.iter().cloned()));
let result = body.eval(context, current);
context.pop_scope();
result
......@@ -262,12 +262,12 @@ impl<'d, 'f : 'd> Eval<'d, 'f> for preprocess::Strategy {
fn eval_match<'d, 'f : 'd>(
context: &MutContext<'d, 'f>,
match_term: &'d preprocess::MatchTerm,
match_term: &'d preprocess::MatchTerm<'f>,
current: &ATermRef<'f>,
) -> Result<()> {
use preprocess::MatchTerm::*;
match *match_term {
Var(ref s) => context.match_term(s, current),
Var(s) => context.match_term(s, current),
Wld => Ok(()),
Anno(ref cons, ref annos) => {
eval_match(context, &*cons, current)?;
......@@ -275,7 +275,7 @@ fn eval_match<'d, 'f : 'd>(
let current_annos = &context.factory.list(current_annos);
eval_match(context, &*annos, current_annos)
}
As(ref v, ref term) => {
As(v, ref term) => {
context.match_term(v, current)?;
eval_match(context, &*term, current)
}
......@@ -295,13 +295,13 @@ fn eval_match<'d, 'f : 'd>(
.and_then(|f2| if f == f2 { Some(()) } else { None })
.ok_or(Error::StrategyFailed)
}
Str(ref s) => {
Str(s) => {
current
.get_string()
.and_then(|s2| if *s == s2 { Some(()) } else { None })
.and_then(|s2| if s == s2 { Some(()) } else { None })
.ok_or(Error::StrategyFailed)
}
Op(ref cons, ref children) if cons == "Cons" && children.len() == 2 => {
Op("Cons", ref children) if children.len() == 2 => {
current.get_list().ok_or(Error::StrategyFailed).and_then(
|v| {
if v.is_empty() {
......@@ -318,13 +318,13 @@ fn eval_match<'d, 'f : 'd>(
},
)
}
Op(ref cons, ref children) if cons == "Nil" && children.is_empty() => {
Op("Nil", ref children) if children.is_empty() => {
current
.get_list()
.and_then(|v| if v.is_empty() { Some(()) } else { None })
.ok_or(Error::StrategyFailed)
}
Op(ref cons, ref children) => {
Op(cons, ref children) => {
current
.get_application()
.ok_or(Error::StrategyFailed)
......@@ -384,14 +384,14 @@ fn eval_match<'d, 'f : 'd>(
}
fn eval_<'d, 'f : 'd, F1, F2>(
strat: &'d preprocess::Strategy,
strat: &'d preprocess::Strategy<'f>,
context: &MutContext<'d, 'f>,
current: ATermRef<'f>,
children_fun: F1,
self_fun: F2,
) -> Result<ATermRef<'f>>
where
F1: Fn(&Box<[ATermRef<'f>]>, &'d preprocess::Strategy, &MutContext<'d, 'f>) -> Result<Box<[ATermRef<'f>]>>,
F1: Fn(&Box<[ATermRef<'f>]>, &'d preprocess::Strategy<'f>, &MutContext<'d, 'f>) -> Result<Box<[ATermRef<'f>]>>,
F2: Fn(ATermRef<'f>) -> Result<ATermRef<'f>>
{
use factory::Term::*;
......@@ -429,7 +429,7 @@ where
fn one_rec<'d, 'f : 'd>(
r: &Box<[ATermRef<'f>]>,
strat: &'d preprocess::Strategy,
strat: &'d preprocess::Strategy<'f>,
context: &MutContext<'d, 'f>,
) -> Result<Box<[ATermRef<'f>]>> {
let mut result = Vec::with_capacity(r.len());
......@@ -454,7 +454,7 @@ fn one_rec<'d, 'f : 'd>(
fn some_rec<'d, 'f : 'd>(
r: &Box<[ATermRef<'f>]>,
strat: &'d preprocess::Strategy,
strat: &'d preprocess::Strategy<'f>,
context: &MutContext<'d, 'f>,
) -> Result<Box<[ATermRef<'f>]>> {
let mut result = Vec::with_capacity(r.len());
......@@ -476,7 +476,7 @@ fn some_rec<'d, 'f : 'd>(
fn all_rec<'d, 'f : 'd>(
r: &Box<[ATermRef<'f>]>,
strat: &'d preprocess::Strategy,
strat: &'d preprocess::Strategy<'f>,
context: &MutContext<'d, 'f>,
) -> Result<Box<[ATermRef<'f>]>> {
r.into_iter()
......@@ -487,9 +487,9 @@ fn all_rec<'d, 'f : 'd>(
}
pub fn eval_sdef<'d, 'f : 'd>(
strategy_def: &StrategyDef<'d>,
strategy_def: &StrategyDef<'d, 'f>,
context: &MutContext<'d, 'f>,
actual_sargs: Vec<StrategyDef<'d>>,
actual_sargs: Vec<StrategyDef<'d, 'f>>,
actual_targs: Vec<ATermRef<'f>>,
current: ATermRef<'f>,
) -> Result<ATermRef<'f>> {
......@@ -499,7 +499,7 @@ pub fn eval_sdef<'d, 'f : 'd>(
actual_targs.len(),
)
{
Err(Error::UndefinedStrategy(name))
Err(Error::UndefinedStrategy(String::from(name)))
} else {
context.stack_tracer.borrow_mut().push(name);
let popped_scopes = strategy_def.no_of_scopes().map_or_else(Vec::new, |n| {
......@@ -528,8 +528,8 @@ pub fn strategy_def_from_strategy<'d, 'f : 'd>(
context: &MutContext<'d, 'f>,
name: &str,
number: usize,
body: &'d preprocess::Strategy,
) -> Result<StrategyDef<'d>> {
body: &'d preprocess::Strategy<'f>,
) -> Result<StrategyDef<'d, 'f>> {
use preprocess::Strategy;
let no_of_scopes = context.scopes.borrow().len();
// NOTE: this is not an optimisation but a necessary semantic distinction to allow
......@@ -539,9 +539,9 @@ pub fn strategy_def_from_strategy<'d, 'f : 'd>(
context.get_strategy(name)
}
_ => {
let artificial_name = context.factory.intern_string(format!("{}.{}", name, number));
Ok(StrategyDef::Anonymous {
argument_of: name.to_owned(),
argument_no: number,
artificial_name: artificial_name,
body: body,
no_of_scopes: no_of_scopes,
})
......
......@@ -28,7 +28,7 @@ impl<'f> HashTableState<'f> {
pub fn table_hashtable<'d, 'f: 'd>(
context: &MutContext<'d, 'f>,
sargs: Vec<StrategyDef<'d>>,
sargs: Vec<StrategyDef<'d, 'f>>,
targs: Vec<ATermRef<'f>>,
current: ATermRef<'f>,
) -> Result<ATermRef<'f>> {
......@@ -39,7 +39,7 @@ pub fn table_hashtable<'d, 'f: 'd>(
pub fn dynamic_rules_hashtable<'d, 'f: 'd>(
context: &MutContext<'d, 'f>,
sargs: Vec<StrategyDef<'d>>,
sargs: Vec<StrategyDef<'d, 'f>>,
targs: Vec<ATermRef<'f>>,
current: ATermRef<'f>,
) -> Result<ATermRef<'f>> {
......@@ -57,7 +57,7 @@ pub fn dynamic_rules_hashtable<'d, 'f: 'd>(
pub fn hashtable_create<'d, 'f: 'd>(
context: &MutContext<'d, 'f>,
sargs: Vec<StrategyDef<'d>>,
sargs: Vec<StrategyDef<'d, 'f>>,
targs: Vec<ATermRef<'f>>,
current: ATermRef<'f>,
) -> Result<ATermRef<'f>> {
......@@ -84,7 +84,7 @@ pub fn hashtable_create<'d, 'f: 'd>(
pub fn hashtable_reset<'d, 'f: 'd>(
context: &MutContext<'d, 'f>,
sargs: Vec<StrategyDef<'d>>,
sargs: Vec<StrategyDef<'d, 'f>>,
targs: Vec<ATermRef<'f>>,
current: ATermRef<'f>,
) -> Result<ATermRef<'f>> {
......@@ -110,7 +110,7 @@ pub fn hashtable_reset<'d, 'f: 'd>(
pub fn hashtable_destroy<'d, 'f: 'd>(
context: &MutContext<'d, 'f>,
sargs: Vec<StrategyDef<'d>>,
sargs: Vec<StrategyDef<'d, 'f>>,
targs: Vec<ATermRef<'f>>,
current: ATermRef<'f>,
) -> Result<ATermRef<'f>> {
......@@ -119,7 +119,7 @@ pub fn hashtable_destroy<'d, 'f: 'd>(
pub fn hashtable_put<'d, 'f: 'd>(
context: &MutContext<'d, 'f>,
sargs: Vec<StrategyDef<'d>>,
sargs: Vec<StrategyDef<'d, 'f>>,
targs: Vec<ATermRef<'f>>,
current: ATermRef<'f>,
) -> Result<ATermRef<'f>> {
......@@ -147,7 +147,7 @@ pub fn hashtable_put<'d, 'f: 'd>(
pub fn hashtable_remove<'d, 'f: 'd>(
context: &MutContext<'d, 'f>,
sargs: Vec<StrategyDef<'d>>,
sargs: Vec<StrategyDef<'d, 'f>>,
targs: Vec<ATermRef<'f>>,
current: ATermRef<'f>,
) -> Result<ATermRef<'f>> {
......@@ -173,7 +173,7 @@ pub fn hashtable_remove<'d, 'f: 'd>(
pub fn hashtable_get<'d, 'f: 'd>(
context: &MutContext<'d, 'f>,
sargs: Vec<StrategyDef<'d>>,
sargs: Vec<StrategyDef<'d, 'f>>,
targs: Vec<ATermRef<'f>>,
current: ATermRef<'f>,
) -> Result<ATermRef<'f>> {
......@@ -201,7 +201,7 @@ pub fn hashtable_get<'d, 'f: 'd>(
pub fn hashtable_keys<'d, 'f: 'd>(
context: &MutContext<'d, 'f>,
sargs: Vec<StrategyDef<'d>>,
sargs: Vec<StrategyDef<'d, 'f>>,
targs: Vec<ATermRef<'f>>,
current: ATermRef<'f>,
) -> Result<ATermRef<'f>> {
......@@ -227,7 +227,7 @@ pub fn hashtable_keys<'d, 'f: 'd>(
pub fn table_fold<'d, 'f: 'd>(
context: &MutContext<'d, 'f>,
sargs: Vec<StrategyDef<'d>>,
sargs: Vec<StrategyDef<'d, 'f>>,
targs: Vec<ATermRef<'f>>,
current: ATermRef<'f>,
) -> Result<ATermRef<'f>> {
......@@ -265,7 +265,7 @@ pub fn table_fold<'d, 'f: 'd>(
pub fn table_keys_fold<'d, 'f: 'd>(
context: &MutContext<'d, 'f>,
sargs: Vec<StrategyDef<'d>>,
sargs: Vec<StrategyDef<'d, 'f>>,
targs: Vec<ATermRef<'f>>,
current: ATermRef<'f>,
) -> Result<ATermRef<'f>> {
......@@ -297,7 +297,7 @@ pub fn table_keys_fold<'d, 'f: 'd>(
pub fn table_values_fold<'d, 'f: 'd>(
context: &MutContext<'d, 'f>,
sargs: Vec<StrategyDef<'d>>,
sargs: Vec<StrategyDef<'d, 'f>>,
targs: Vec<ATermRef<'f>>,
current: ATermRef<'f>,
) -> Result<ATermRef<'f>> {
......
......@@ -13,7 +13,7 @@ use std::borrow::Borrow;
pub fn indexedSet_create<'d, 'f: 'd>(
context: &MutContext<'d, 'f>,
sargs: Vec<StrategyDef<'d>>,
sargs: Vec<StrategyDef<'d, 'f>>,
targs: Vec<ATermRef<'f>>,
current: ATermRef<'f>,
) -> Result<ATermRef<'f>> {
......@@ -39,7 +39,7 @@ pub fn indexedSet_create<'d, 'f: 'd>(
pub fn indexedSet_reset<'d, 'f: 'd>(
context: &MutContext<'d, 'f>,
sargs: Vec<StrategyDef<'d>>,
sargs: Vec<StrategyDef<'d, 'f>>,
targs: Vec<ATermRef<'f>>,
current: ATermRef<'f>,
) -> Result<ATermRef<'f>> {
......@@ -64,7 +64,7 @@ pub fn indexedSet_reset<'d, 'f: 'd>(
pub fn indexedSet_destroy<'d, 'f: 'd>(
context: &MutContext<'d, 'f>,
sargs: Vec<StrategyDef<'d>>,
sargs: Vec<StrategyDef<'d, 'f>>,
targs: Vec<ATermRef<'f>>,
current: ATermRef<'f>,
) -> Result<ATermRef<'f>> {
......@@ -73,7 +73,7 @@ pub fn indexedSet_destroy<'d, 'f: 'd>(
pub fn indexedSet_put<'d, 'f: 'd>(
context: &MutContext<'d, 'f>,
sargs: Vec<StrategyDef<'d>>,
sargs: Vec<StrategyDef<'d, 'f>>,
targs: Vec<ATermRef<'f>>,
current: ATermRef<'f>,
) -> Result<ATermRef<'f>> {
......@@ -109,7 +109,7 @@ pub fn indexedSet_put<'d, 'f: 'd>(
pub fn indexedSet_remove<'d, 'f: 'd>(
context: &MutContext<'d, 'f>,
sargs: Vec<StrategyDef<'d>>,
sargs: Vec<StrategyDef<'d, 'f>>,
targs: Vec<ATermRef<'f>>,
current: ATermRef<'f>,
) -> Result<ATermRef<'f>> {
......@@ -133,7 +133,7 @@ pub fn indexedSet_remove<'d, 'f: 'd>(
pub fn indexedSet_getIndex<'d, 'f: 'd>(
context: &MutContext<'d, 'f>,
sargs: Vec<StrategyDef<'d>>,
sargs: Vec<StrategyDef<'d, 'f>>,
targs: Vec<ATermRef<'f>>,
current: ATermRef<'f>,
) -> Result<ATermRef<'f>> {
......@@ -159,7 +159,7 @@ pub fn indexedSet_getIndex<'d, 'f: 'd>(
pub fn indexedSet_getElem<'d, 'f: 'd>(
context: &MutContext<'d, 'f>,
sargs: Vec<StrategyDef<'d>>,
sargs: Vec<StrategyDef<'d, 'f>>,
targs: Vec<ATermRef<'f>>,
current: ATermRef<'f>,
) -> Result<ATermRef<'f>> {
......@@ -169,7 +169,7 @@ pub fn indexedSet_getElem<'d, 'f: 'd>(
pub fn indexedSet_elements<'d, 'f: 'd>(
context: &MutContext<'d, 'f>,
sargs: Vec<StrategyDef<'d>>,
sargs: Vec<StrategyDef<'d, 'f>>,
targs: Vec<ATermRef<'f>>,
current: ATermRef<'f>,
) -> Result<ATermRef<'f>> {
......
......@@ -7,7 +7,7 @@ use aterm::{ATermFactory as ATF, ATerm as A};
pub fn is_int<'d, 'f: 'd>(
_context: &MutContext<'d, 'f>,
_sargs: Vec<StrategyDef<'d>>,
_sargs: Vec<StrategyDef<'d, 'f>>,
targs: Vec<ATermRef<'f>>,
current: ATermRef<'f>,
) -> Result<ATermRef<'f>> {
......@@ -23,7 +23,7 @@ pub fn is_int<'d, 'f: 'd>(
pub fn int<'d, 'f: 'd>(
context: &MutContext<'d, 'f>,
_sargs: Vec<StrategyDef<'d>>,
_sargs: Vec<StrategyDef<'d, 'f>>,
targs: Vec<ATermRef<'f>>,
current: ATermRef<'f>,
) -> Result<ATermRef<'f>> {
......@@ -43,7 +43,7 @@ pub fn int<'d, 'f: 'd>(
pub fn iori<'d, 'f: 'd>(
context: &MutContext<'d, 'f>,
_sargs: Vec<StrategyDef<'d>>,
_sargs: Vec<StrategyDef<'d, 'f>>,
targs: Vec<ATermRef<'f>>,
current: ATermRef<'f>,
) -> Result<ATermRef<'f>> {
......@@ -59,7 +59,7 @@ pub fn iori<'d, 'f: 'd>(
pub fn xori<'d, 'f: 'd>(
context: &MutContext<'d, 'f>,
_sargs: Vec<StrategyDef<'d>>,
_sargs: Vec<StrategyDef<'d, 'f>>,
targs: Vec<ATermRef<'f>>,
current: ATermRef<'f>,
) -> Result<ATermRef<'f>> {
......@@ -75,7 +75,7 @@ pub fn xori<'d, 'f: 'd>(
pub fn andi<'d, 'f: 'd>(
context: &MutContext<'d, 'f>,
_sargs: Vec<StrategyDef<'d>>,
_sargs: Vec<StrategyDef<'d, 'f>>,