variable things added

This commit is contained in:
able 2021-04-13 18:01:19 -05:00
parent 83c8595a8f
commit bc1eb42af4
2 changed files with 36 additions and 0 deletions

View file

@ -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 <abl3theabove@gmail.com>")
@ -20,6 +23,7 @@ fn main() {
.takes_value(true),
)
.get_matches();
match matches.value_of("file") {
Some(file_path) => {
// Read file

32
src/variables.rs Normal file
View file

@ -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);
}
}