format_code/
format_code.rs

1use stackr_rs::*;
2
3fn main() {
4    // This is just some ugly code to showcase the formatting.
5    // Typically '.' is used as a noop op and helps with formatting.
6    let code = r#"
7    var 
8    stuff 
9    .
10
11    1 stuff 
12    set .
13
14    stuff
15    get 
16    .
17
18
19    : debug "" "" "" print-stack drop ;
20    0 begin 1 + dup 2 == if 
21            "hello" .  stuff get drop .  break
22        end
23
24        dup
25        2 == if 
26            "hello"
27        else
28            "world"
29            drop
30        end
31    loop
32
33    "world"
34    
35    "#;
36    let code = Interpreter::<()>::format_code(code, None).unwrap();
37
38    println!("{}", code);
39}