basic project layout and the first version of main, which handles the commandline arguments but does not do anything real, before exiting
This commit is contained in:
commit
0e250dd676
4 changed files with 42 additions and 0 deletions
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
.idea/
|
||||
*.iml
|
||||
target/
|
||||
6
Cargo.lock
generated
Normal file
6
Cargo.lock
generated
Normal file
|
|
@ -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"
|
||||
|
||||
7
Cargo.toml
Normal file
7
Cargo.toml
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
[package]
|
||||
name = "rust_lox"
|
||||
version = "0.1.0"
|
||||
authors = ["Sander Hautvast <shautvast@gmail.com>"]
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
26
src/main.rs
Normal file
26
src/main.rs
Normal file
|
|
@ -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<String> = 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() {
|
||||
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue