able-script/src/main.rs

41 lines
980 B
Rust
Raw Normal View History

2021-04-11 11:47:35 -05:00
extern crate clap;
use clap::{App, Arg};
2021-04-11 15:11:23 -05:00
2021-04-11 13:22:59 -05:00
mod base_55;
2021-04-11 15:11:23 -05:00
mod parser;
pub mod tokens;
2021-04-13 10:40:20 -05:00
mod scanner;
2021-04-11 17:22:06 -05:00
use logos::Logos;
2021-04-13 10:40:20 -05:00
use scanner::Scanner;
fn main() {
2021-04-11 14:11:39 -05:00
let matches = App::new("AbleScript")
.version(env!("CARGO_PKG_VERSION"))
2021-04-11 11:47:35 -05:00
.author("Able <abl3theabove@gmail.com>")
.about("Does awesome things")
.arg(
Arg::with_name("file")
.short("f")
.long("file")
.value_name("FILE")
2021-04-11 15:11:23 -05:00
.help("Set the path to interpret from")
2021-04-11 11:47:35 -05:00
.takes_value(true),
)
.get_matches();
match matches.value_of("file") {
Some(file_path) => {
// Read file
let source = std::fs::read_to_string(file_path).unwrap();
// Print token type: `value`
2021-04-13 10:40:20 -05:00
let mut scanner = Scanner::new(&source);
scanner.scan();
2021-04-11 11:47:35 -05:00
}
None => {
println!("hi");
//start the prompt
}
}
}