commit 0e250dd676c03590bc126df0b19c3d0c90550f7f Author: Sander Hautvast Date: Fri Jan 24 11:27:46 2020 +0100 basic project layout and the first version of main, which handles the commandline arguments but does not do anything real, before exiting diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..632a353 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.idea/ +*.iml +target/ \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..c2fa458 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,6 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +[[package]] +name = "rust_lox" +version = "0.1.0" + diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..b71e144 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,7 @@ +[package] +name = "rust_lox" +version = "0.1.0" +authors = ["Sander Hautvast "] +edition = "2018" + +[dependencies] diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..32e96c7 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,26 @@ +use std::process; +use std::env; + +/// main +/// no arguments: run interactively +/// 1 argument: run the script file specified +fn main() { + let args: Vec = env::args().collect(); + + match args.len() { + 1 => run_prompt(), + 2 => run_file(args.get(0).unwrap()), + _ => { + println!("Usage: lox: [script]"); + process::exit(64); + } + } +} + +fn run_file(_path: &String) { + +} + +fn run_prompt() { + +} \ No newline at end of file