spl 0.4.2

Stack Pogramming Language: A simple, concise scripting language.
Documentation
use crate::Word;

pub(crate) fn transform_compat(word: &str) -> String {
    match word {
        "try" => "catch".to_owned(),
        _ => word.to_owned(),
    }
}

pub(crate) fn match_compat(
    word: String,
    str_words: &[String],
    words: &mut Vec<Word>,
    i: &mut usize,
) -> bool {
    match word.as_str() {
        "inc" => {
            eprintln!("spl: [compat] transforming inc call");
            words.push(Word::Call("++".to_owned(), false, 0));
            words.push(Word::Call("=".to_owned() + &str_words[*i - 1], false, 0));
            *i += 1;
            true
        }
        "dec" => {
            eprintln!("spl: [compat] transforming dec call");
            eprintln!("spl: [compat] transforming dec call");
            words.push(Word::Call("--".to_owned(), false, 0));
            words.push(Word::Call("=".to_owned() + &str_words[*i - 1], false, 0));
            *i += 1;
            true
        }
        "include" => {
            words.push(Word::Call("isbplmod'import-transform".to_owned(), false, 0));
            words.push(Word::Call("import".to_owned(), false, 0));
            *i += 1;
            true
        }
        _ => false,
    }
}