ruby-tools 0.0.0

Ruby language tools for Rusty Ruby
Documentation
//! Ruby 命令行工具
//! 运行 Ruby 脚本

use ruby_tools::RustyRubyFrontend;
use std::env;
use std::fs;

fn main() {
    let args: Vec<String> = env::args().collect();
    
    if args.len() > 1 {
        let script_path = &args[1];
        run_script(script_path);
    } else {
        println!("Usage: ruby <script.rb>");
    }
}

fn run_script(script_path: &str) {
    println!("Running Ruby script: {}", script_path);
    
    match fs::read_to_string(script_path) {
        Ok(content) => {
            let frontend = RustyRubyFrontend::new();
            match frontend.parse(&content) {
                Ok(ast) => {
                    println!("Script parsed successfully");
                    println!("AST: {:?}", ast);
                }
                Err(e) => {
                    println!("Error parsing script: {:?}", e);
                }
            }
        }
        Err(e) => {
            println!("Error reading script: {:?}", e);
        }
    }
}