Skip to content

Commit

Permalink
tidying up
Browse files Browse the repository at this point in the history
  • Loading branch information
vincenthz committed Dec 18, 2023
1 parent 7cc2b13 commit e4467cd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
5 changes: 3 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ mod value;
use hashbrown::HashMap;
use value::Value;
use werbolg_compile::{code_dump, compile, symbols::IdVec, CompilationError, Environment};
use werbolg_core::{ConstrId, Ident, Literal, NifId, ValueFun};
use werbolg_core::{Ident, Literal, NifId};
use werbolg_exec::{
ExecutionEnviron, ExecutionError, ExecutionMachine, ExecutionParams, NIFCall, Valuable, NIF,
};
Expand Down Expand Up @@ -86,19 +86,20 @@ fn literal_to_value(lit: &MyLiteral) -> Value {
}
}

// only support bool and number from the werbolg core literal
fn literal_mapper(lit: Literal) -> Result<MyLiteral, CompilationError> {
match lit {
Literal::Bool(b) => {
let b = b.as_ref() == "true";
Ok(MyLiteral::Bool(b))
}
Literal::String(_) => Err(CompilationError::LiteralNotSupported(lit)),
Literal::Number(s) => {
let Ok(v) = u64::from_str_radix(s.as_ref(), 10) else {
todo!()
};
Ok(MyLiteral::Int(v))
}
Literal::String(_) => Err(CompilationError::LiteralNotSupported(lit)),
Literal::Decimal(_) => Err(CompilationError::LiteralNotSupported(lit)),
Literal::Bytes(_) => Err(CompilationError::LiteralNotSupported(lit)),
}
Expand Down
6 changes: 3 additions & 3 deletions src/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ impl Valuable for Value {
}

fn structure(&self) -> Option<(ConstrId, &[Self])> {
todo!()
None
}

fn index(&self, index: usize) -> Option<&Self> {
todo!()
fn index(&self, _index: usize) -> Option<&Self> {
None
}

fn make_fun(fun: ValueFun) -> Self {
Expand Down
1 change: 0 additions & 1 deletion werbolg-exec/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
hashbrown = "0.14"
werbolg-core = { path = "../werbolg-core" }
werbolg-compile = { path = "../werbolg-compile" }

0 comments on commit e4467cd

Please sign in to comment.