cha-parser 0.2.0

Tree-sitter based AST parser for Cha (TypeScript, Rust)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
fn decide(x: i32, y: i32) -> i32 {
    if x > 0 {
        if y > 0 {
            x + y
        } else {
            x - y
        }
    } else if x == 0 {
        match y {
            0 => 0,
            1 => 1,
            _ => y * 2,
        }
    } else {
        x * y
    }
}