xbasic 0.3.2

A library that allows adding a scripting language onto your project with ease. This lets your users write their own arbitrary logic.
Documentation
use std::io::{stdin, Write};
use std::{env, fs, io};
use xbasic::basic_io::BasicIO;
use xbasic::xbasic::XBasic;

struct ShellIO {}
impl BasicIO for ShellIO {
	fn read_line(&mut self) -> String {
		let mut buf = String::new();
		stdin().read_line(&mut buf).unwrap();
		// Remove newline
		buf.pop().unwrap();

		buf
	}

	fn write_line(&mut self, line: String) {
		println!("{}", line);
	}
}

fn main() {
	let args: Vec<String> = env::args().collect();
	match args.len() {
		d if d > 2 => println!("Usage: {} [script]", args[0]),
		2 => run_file(&args[1]),
		_ => run_prompt(),
	}
}

fn run_file(path: &str) {
	let io = ShellIO {};
	let mut xb = XBasic::new(io);
	match xb.run(&fs::read_to_string(path).unwrap()) {
		Ok(_) => {}
		Err(_) => {
			for err in xb.error_handler.errors {
				println!("{}", err);
			}
		}
	}
}

fn run_prompt() {
	let io = ShellIO {};
	let mut xb = XBasic::new(io);
	loop {
		let mut input = String::new();
		print!("> ");
		io::stdout().flush().unwrap();
		match io::stdin().read_line(&mut input) {
			Ok(_) => {
				xb.clear_errors();
				match xb.run(&input) {
					Ok(_) => {}
					Err(_) => {
						for e in &xb.error_handler.errors {
							println!("{}", e);
						}
					}
				}
			}
			Err(_) => return,
		}
	}
}