let's see if i can call my code from typescript...

This commit is contained in:
Joeri Exelmans 2025-11-03 13:46:24 +01:00
parent 859594f779
commit e803876d5f
8 changed files with 215 additions and 3 deletions

View file

@ -1,3 +1,33 @@
fn main() {
println!("Hello, world!");
extern crate wasm_bindgen;
extern crate argus;
use wasm_bindgen::prelude::*;
use argus::expr::Expr;
// use chumsky::prelude::Rich;
// macro_rules! wasmbind_fn {
// ($name:ident($($arg:ident: $t:ty),*) -> $ret:ty) => {
// #[wasm_bindgen]
// pub fn $name($($arg: $t),*) -> $ret {
// my_lib::$name($($arg),*)
// }
// };
// }
// wasmbind_fn!(parse_str(s: &str) -> Result<expr::Expr, Vec<Rich<'_,String>>>);
#[wasm_bindgen]
pub struct WrappedExpr {
expr: Expr,
}
#[wasm_bindgen]
pub fn parse_str(s: &str) -> WrappedExpr {
let expr = argus::parse_str(s);
return WrappedExpr{
expr: expr.expect("fuck!!!!"),
};
}