mirror of
https://github.com/rm-dr/daisy
synced 2025-06-30 22:23:40 -07:00
Compare commits
13 Commits
Author | SHA1 | Date | |
---|---|---|---|
a75f6197cd | |||
2f2c005c86
|
|||
ffebcf2e15
|
|||
4e1df2399b | |||
5a921cfc7b | |||
2531524ffd
|
|||
e5525adcca
|
|||
a61cbf29e5
|
|||
39ab47530e | |||
be28669416
|
|||
7658ff76ef
|
|||
e9d392b80b
|
|||
63d4a01095 |
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -28,7 +28,7 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||
|
||||
[[package]]
|
||||
name = "daisycalc"
|
||||
version = "1.1.3"
|
||||
version = "1.1.5"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"num",
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "daisycalc"
|
||||
version = "1.1.3"
|
||||
version = "1.1.5"
|
||||
edition = "2021"
|
||||
build = "buildscript/main.rs"
|
||||
license = "GPL-3.0-only"
|
||||
|
5
Makefile
5
Makefile
@ -14,5 +14,6 @@ publish:
|
||||
cargo test
|
||||
cargo publish
|
||||
|
||||
docker:
|
||||
docker build ./server -t git.betalupi.com/mark/daisy
|
||||
docker: wasm
|
||||
docker build ./server -t git.betalupi.com/mark/daisy --no-cache
|
||||
docker push git.betalupi.com/mark/daisy
|
||||
|
1
TODO.md
1
TODO.md
@ -12,7 +12,6 @@
|
||||
## Pre-release
|
||||
- Tuple operations
|
||||
- we don't need vectors as arguments to operators
|
||||
- Fix linelocation when evaluating functions
|
||||
|
||||
## Parser
|
||||
- Should functions be operators?
|
||||
|
@ -49,7 +49,7 @@ value = "1.602176634e-19 C"
|
||||
enum_name = "ElectronMass"
|
||||
pretty_name = "Electron mass"
|
||||
strings = ["electronmass"]
|
||||
value = "9.1093837015-31 kg"
|
||||
value = "9.1093837015e-31 kg"
|
||||
|
||||
[[constant]]
|
||||
enum_name = "ProtonMass"
|
||||
@ -205,4 +205,4 @@ value = "TW * hour"
|
||||
[[constant]]
|
||||
enum_name = "PWH"
|
||||
strings = "PWh"
|
||||
value = "PW * hour"
|
||||
value = "PW * hour"
|
||||
|
@ -19,6 +19,7 @@ pub fn eval_operator(context: &mut Context, g: &Expression) -> Result<Option<Exp
|
||||
|
||||
if args.len() != 1 {panic!()};
|
||||
let a = &args[0];
|
||||
let mut args_ll = op_loc.clone();
|
||||
|
||||
if sh_vars.len() == 1 {
|
||||
if let Expression::Tuple(l, v) = a {
|
||||
@ -28,6 +29,7 @@ pub fn eval_operator(context: &mut Context, g: &Expression) -> Result<Option<Exp
|
||||
))
|
||||
};
|
||||
|
||||
args_ll += a.get_linelocation();
|
||||
context.add_shadow(sh_vars[0].clone(), Some(a.clone()));
|
||||
} else {
|
||||
let Expression::Tuple(l, v) = a else {
|
||||
@ -46,16 +48,26 @@ pub fn eval_operator(context: &mut Context, g: &Expression) -> Result<Option<Exp
|
||||
|
||||
let mut i = 0;
|
||||
while i < sh_vars.len() {
|
||||
args_ll += v[i].get_linelocation();
|
||||
context.add_shadow(sh_vars[i].clone(), Some(v[i].clone()));
|
||||
i += 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
let r = evaluate(context, &exp)?;
|
||||
let r = evaluate(context, &exp);
|
||||
context.clear_shadow();
|
||||
|
||||
return Ok(Some(r));
|
||||
match r {
|
||||
Ok(mut r) => {
|
||||
r.set_linelocation(&args_ll);
|
||||
return Ok(Some(r));
|
||||
},
|
||||
|
||||
Err( (_, err) ) => {
|
||||
return Err((args_ll, err));
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Operator::Negative => {
|
||||
|
Reference in New Issue
Block a user