Remove unneeded HashTable and SlsStr implementations
This commit is contained in:
parent
6f81cbdf15
commit
a15490b521
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,5 @@
|
|||
mod types;
|
||||
mod errors;
|
||||
mod hash_table;
|
||||
mod sls_string;
|
||||
mod file;
|
||||
mod lexer;
|
||||
mod interpreter;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
@ -1,14 +1,12 @@
|
|||
use std::collections::HashMap;
|
||||
|
||||
pub type SlsStr = String;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum Value {
|
||||
Nil,
|
||||
Bool(bool),
|
||||
Int(i64),
|
||||
Float(f64),
|
||||
Str(SlsStr),
|
||||
Str(String),
|
||||
Object(HashMap<String, Value>),
|
||||
Function(String),
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue