diff --git a/src/main.rs b/src/main.rs index 5d8f61a..73bcfea 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,11 +2,14 @@ mod base_55; mod parser; mod scanner; mod tokens; +mod variables; use clap::{App, Arg}; use scanner::Scanner; fn main() { + variables::test(); + let matches = App::new("AbleScript") .version(env!("CARGO_PKG_VERSION")) .author("Able ") @@ -20,6 +23,7 @@ fn main() { .takes_value(true), ) .get_matches(); + match matches.value_of("file") { Some(file_path) => { // Read file diff --git a/src/variables.rs b/src/variables.rs new file mode 100644 index 0000000..df9cd06 --- /dev/null +++ b/src/variables.rs @@ -0,0 +1,32 @@ +use std::collections::HashMap; + +#[derive(Debug)] +enum Value { + Str(String), + Int(i32), + Bool(bool), + //TODO(Able): Add abool and other variable types +} + +#[derive(Debug)] +pub struct Variable { + melo: bool, + value: Value, +} +pub fn test() { + let mut map = HashMap::new(); + let a = Variable { + melo: false, + value: Value::Str("1".to_string()), + }; + let b = Variable { + melo: false, + value: Value::Int(2), + }; + map.insert("a", a); + map.insert("b", b); + + for (key, value) in &map { + println!("{}: {:?}", key, value); + } +}