Remove unneeded HashTable and SlsStr implementations

This commit is contained in:
Kyler Olsen 2025-12-01 09:12:04 -07:00
parent 6f81cbdf15
commit a15490b521
4 changed files with 1 additions and 41 deletions

View File

@ -1,25 +0,0 @@
use std::collections::HashMap;
use crate::types::Value;
#[derive(Debug, Default)]
pub struct HashTable {
pub map: HashMap<String, Value>,
}
impl HashTable {
pub fn new() -> Self {
HashTable { map: HashMap::new() }
}
pub fn get(&self, key: &str) -> Option<&Value> {
self.map.get(key)
}
pub fn set(&mut self, key: String, val: Value) {
self.map.insert(key, val);
}
pub fn remove(&mut self, key: &str) -> Option<Value> {
self.map.remove(key)
}
}

View File

@ -1,7 +1,5 @@
mod types; mod types;
mod errors; mod errors;
mod hash_table;
mod sls_string;
mod file; mod file;
mod lexer; mod lexer;
mod interpreter; mod interpreter;

View File

@ -1,11 +0,0 @@
use crate::types::SlsStr;
pub fn from_str(s: &str) -> SlsStr {
s.to_string()
}
pub fn concat(a: &SlsStr, b: &SlsStr) -> SlsStr {
let mut r = a.clone();
r.push_str(b);
r
}

View File

@ -1,14 +1,12 @@
use std::collections::HashMap; use std::collections::HashMap;
pub type SlsStr = String;
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub enum Value { pub enum Value {
Nil, Nil,
Bool(bool), Bool(bool),
Int(i64), Int(i64),
Float(f64), Float(f64),
Str(SlsStr), Str(String),
Object(HashMap<String, Value>), Object(HashMap<String, Value>),
Function(String), Function(String),
} }