Merge pull request #6 from RudideC/master

Added arguments and modified .gitignore
This commit is contained in:
ARPCharlie
2024-05-06 17:03:04 +02:00
committed by GitHub
3 changed files with 22 additions and 6 deletions
+6 -1
View File
@@ -15,5 +15,10 @@ Cargo.lock
# Added by cargo # Added by cargo
/target /target
#MacOS
.DS_Store
#Wyst files for testing
*.wst
+2 -1
View File
@@ -7,4 +7,5 @@ edition = "2021"
[dependencies] [dependencies]
regex = "1.10.4" regex = "1.10.4"
once_cell = "1.19.0" once_cell = "1.19.0"
clap = { version = "4.0", features = ["derive"] }
+14 -4
View File
@@ -2,11 +2,21 @@ mod transpiler;
mod parser; mod parser;
mod lexer; mod lexer;
use std::fs; use std::fs;
use clap::Parser;
//Arguments for Wyst (short and long version)
#[derive(Parser)]
struct Args {
#[clap(short, long)]
file: String,
}
fn main() { fn main() {
let code_file = "code.wst"; let args = Args::parse();
let contents = fs::read_to_string(code_file).expect("cannot read for some reason"); let file_content = fs::read_to_string(&args.file)
let result = transpiler::transpile(contents, 0); .expect("Error reading file");
println!("{result}")
let transpiled_code = transpiler::transpile(file_content, 0);
println!("{}", transpiled_code);
} }