Skip to content

Commit

Permalink
renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
Innokenty committed Nov 28, 2024
1 parent 760e3f9 commit b52aa10
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/src/metta/interpreter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::atom::matcher::*;
use crate::space::*;
use crate::metta::*;
use crate::metta::types::*;
use crate::metta::runner::stdlib::core_mod::IfEqualOp;
use crate::metta::runner::stdlib::core::IfEqualOp;
use crate::common::collections::CowArray;

use std::fmt::{Debug, Display, Formatter};
Expand Down
8 changes: 5 additions & 3 deletions lib/src/metta/runner/modules/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ use regex::Regex;
use super::interpreter::interpret;
use super::stdlib::*;

use std::mem;

mod mod_names;
pub(crate) use mod_names::{ModNameNode, mod_name_from_path, normalize_relative_module_name, mod_name_remove_prefix, ModNameNodeDisplayWrapper};
#[cfg(feature = "pkg_mgmt")]
Expand Down Expand Up @@ -237,7 +239,7 @@ impl MettaMod {
pub(crate) fn remap_imported_deps(&self, mapping: &HashMap<ModId, ModId>) {
let mut deps = self.imported_deps.lock().unwrap();
let mut temp = HashMap::with_capacity(deps.len());
core::mem::swap(&mut temp, &mut *deps);
mem::swap(&mut temp, &mut *deps);
for (dep_mod_id, space) in temp.into_iter() {
let new_mod_id = match mapping.get(&dep_mod_id) {
Some(mapped_id) => *mapped_id,
Expand Down Expand Up @@ -394,8 +396,8 @@ impl ModuleInitState {
match self {
Self::Root(cell) => {
let mut insides_ref = cell.borrow_mut();
let frames = core::mem::take(&mut insides_ref.frames);
let descriptors = core::mem::take(&mut insides_ref.module_descriptors);
let frames = mem::take(&mut insides_ref.frames);
let descriptors = mem::take(&mut insides_ref.module_descriptors);
(frames, descriptors)
},
_ => unreachable!()
Expand Down
File renamed without changes.
12 changes: 6 additions & 6 deletions lib/src/metta/runner/stdlib/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ pub mod random;
pub mod atom;
pub mod module;
pub mod package;
pub mod string_mod;
pub mod string;
pub mod debug;
pub mod space;
pub mod core_mod;
pub mod core;

use crate::*;
use crate::space::*;
Expand Down Expand Up @@ -78,7 +78,7 @@ pub fn interpret(space: DynSpace, expr: &Atom) -> Result<Vec<Atom>, String> {
//TODO: The additional arguments are a temporary hack on account of the way the operation atoms store references
// to the runner & module state. https://github.com/trueagi-io/hyperon-experimental/issues/410
pub fn register_common_tokens(tref: &mut Tokenizer, _tokenizer: Shared<Tokenizer>, space: &DynSpace, metta: &Metta) {
core_mod::register_common_tokens(tref);
core::register_common_tokens(tref);
math::register_common_tokens(tref);
random::register_common_tokens(tref);
atom::register_common_tokens(tref, space);
Expand All @@ -93,9 +93,9 @@ pub fn register_common_tokens(tref: &mut Tokenizer, _tokenizer: Shared<Tokenizer
// to the runner & module state. https://github.com/trueagi-io/hyperon-experimental/issues/410
pub fn register_runner_tokens(tref: &mut Tokenizer, tokenizer: Shared<Tokenizer>, space: &DynSpace, metta: &Metta) {

core_mod::register_runner_tokens(tref, space, metta);
core::register_runner_tokens(tref, space, metta);
module::register_runner_tokens(tref, tokenizer.clone(), metta);
string_mod::register_runner_tokens(tref);
string::register_runner_tokens(tref);
debug::register_runner_tokens(tref, space);
// &self should be updated
// TODO: adding &self might be done not by stdlib, but by MeTTa itself.
Expand Down Expand Up @@ -151,7 +151,7 @@ pub fn register_rust_stdlib_tokens(target: &mut Tokenizer) {
tref.register_token(regex(r"xor"), move |_| { xor_op.clone() });

random::register_rust_stdlib_tokens(tref);
core_mod::register_rust_stdlib_tokens(tref);
core::register_rust_stdlib_tokens(tref);

target.move_front(&mut rust_tokens);
}
Expand Down
File renamed without changes.

0 comments on commit b52aa10

Please sign in to comment.