frg 2.1.0

Compiled programming language with frogs!
use super::{TreeCursor, Expression, expressions};

pub fn parse(cursor: &mut TreeCursor, code: &str) -> Vec<Expression> {
    cursor.goto_first_child();
    let mut elems = vec![];

    while cursor.goto_next_sibling() {
        let node_kind = cursor.node().kind();
        elems.push(match node_kind {
            "[" | "," => continue,
            "]" => break,
            _ => expressions::parse(cursor, code),
        });
    }

    cursor.goto_parent();
    elems
}

pub fn transpile(vec_lit: &[Expression]) -> String {
    let contents =
        expressions::transpile_list(&vec_lit.iter().map(expressions::transpile).collect());
    format!("vec![{contents}]")
}