[dependencies]
cfg-if = "0.1.7"
downcast = "0.10.0"
+indexmap = "1.0.2"
num = "0.2"
ordered-float = "0.5.0"
prolog_parser = "0.8.26"
#[macro_use] extern crate cfg_if;
#[macro_use] extern crate downcast;
+extern crate indexmap;
#[macro_use] extern crate prolog_parser;
#[macro_use] extern crate ref_thread_local;
+use indexmap::IndexMap;
+
use prolog_parser::ast::*;
use prolog::allocator::*;
use std::rc::Rc;
pub struct DebrayAllocator {
- bindings: HashMap<Rc<Var>, VarData>,
+ bindings: IndexMap<Rc<Var>, VarData>,
arg_c: usize,
temp_lb: usize,
arity: usize, // 0 if not at head.
arity: 0,
arg_c: 1,
temp_lb: 1,
- bindings: HashMap::new(),
+ bindings: IndexMap::new(),
contents: HashMap::new(),
in_use: BTreeSet::new()
}
iter.next().is_none()
} else if cut_char!(c) {
iter.next().is_none()
- } else if solo_char!(c) {
- !iter.next().is_none()
} else if c == '[' {
(iter.next() == Some(']') && iter.next().is_none())
} else if c == '{' {
(iter.next() == Some('}') && iter.next().is_none())
+ } else if solo_char!(c) {
+ false // !iter.next().is_none()
} else {
false
}
must_be_var_names_list_([VarName | VarNames]) :-
( nonvar(VarName), VarName = (Atom = _) ->
( atom(Atom) -> must_be_var_names_list_(VarNames)
- ; var(Atom) -> throw(error(instantiation_error, write_term/2))
; throw(error(domain_error(write_options, variable_names(VarName)), write_term/2))
)
- ; throw(error(instantiation_error, write_term/2))
+ ; throw(error(domain_error(write_options, variable_names(VarName)), write_term/2))
).
write_term(_, Options) :-
+use indexmap::IndexMap;
+
use prolog_parser::ast::*;
use prolog_parser::tabled_rc::*;
}
}
-pub type HeapVarDict = HashMap<Rc<Var>, Addr>;
-pub type AllocVarDict = HashMap<Rc<Var>, VarData>;
+pub type HeapVarDict = IndexMap<Rc<Var>, Addr>;
+pub type AllocVarDict = IndexMap<Rc<Var>, VarData>;
#[derive(Clone)]
pub struct DynamicPredicateInfo {
let mut list_of_var_eqs = vec![];
- for (var, binding) in term_write_result.var_dict {
+ for (var, binding) in term_write_result.var_dict.into_iter().rev() {
let var_atom = clause_name!(var.to_string(), indices.atom_tbl);
let var_atom = Constant::Atom(var_atom, None);