diff options
| author | Edvard Thörnros <edvard.thornros@gmail.com> | 2021-01-13 16:21:59 +0100 |
|---|---|---|
| committer | Edvard Thörnros <edvard.thornros@gmail.com> | 2021-01-14 19:49:06 +0100 |
| commit | 4a6643964278aa67f0dbaf1ce28eabf46e5785e5 (patch) | |
| tree | a303dcdfc2986dfd671c6a76ae3194f146dce03d /src/lib.rs | |
| parent | 92f18d8f4278a6e6322c4162f78494762ba7cbb6 (diff) | |
| download | sylt-4a6643964278aa67f0dbaf1ce28eabf46e5785e5.tar.gz | |
Add functions
Diffstat (limited to 'src/lib.rs')
| -rw-r--r-- | src/lib.rs | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -1,4 +1,5 @@ use std::path::Path; +use std::rc::Rc; pub mod compiler; pub mod tokenizer; @@ -19,7 +20,7 @@ pub fn run_string(s: &str) -> Result<(), Vec<Error>> { pub fn run(tokens: TokenStream, path: &Path) -> Result<(), Vec<Error>> { match compiler::compile("main", path, tokens) { - Ok(block) => vm::run_block(&block).or_else(|e| Err(vec![e])), + Ok(block) => vm::run_block(Rc::new(block)).or_else(|e| Err(vec![e])), Err(errors) => Err(errors), } } @@ -60,9 +61,11 @@ mod tests { } }; } + test_file!(order_of_operations, "tests/order-of-operations.tdy"); test_file!(variables, "tests/variables.tdy"); test_file!(scoping, "tests/scoping.tdy"); test_file!(if_, "tests/if.tdy"); test_file!(for_, "tests/for.tdy"); + test_file!(fun, "tests/fun.tdy"); } |
