allow calling SPL from rust

This commit is contained in:
TudbuT 2023-08-04 23:40:02 +02:00
parent 62fb4d0f91
commit d7b3c0d430
3 changed files with 10 additions and 2 deletions

View file

@ -1,6 +1,6 @@
[package]
name = "spl"
version = "0.1.6"
version = "0.1.7"
edition = "2021"
description = "Stack Pogramming Language: A simple, concise scripting language."
license = "MIT"

View file

@ -2,9 +2,14 @@ func main { |
1 rusty-test _str println
0
}
func sply-test { mega |
1
}
func rusty-test @rust !{
println!("hii");
let v = #pop:Mega#;
#push(v + 1)#;
#call(sply-test)#
let v2 = #pop:Mega#;
#push(v + v2)#
}

View file

@ -22,6 +22,9 @@ fn parse_hash_expr(s: String, name: &str) -> String {
if let Some(s) = readf1("push({})", &s) {
return format!("stack.push(({s}).spl());");
}
if let Some(s) = readf1("call({})", &s) {
return format!("stack.call(&stack.get_func({s:?}.to_owned())?)?;");
}
panic!("invalid #-expr - this error will be handled in the future")
}