variable things added
This commit is contained in:
parent
35586aa700
commit
08af75fbda
|
@ -2,11 +2,14 @@ mod base_55;
|
||||||
mod parser;
|
mod parser;
|
||||||
mod scanner;
|
mod scanner;
|
||||||
mod tokens;
|
mod tokens;
|
||||||
|
mod variables;
|
||||||
|
|
||||||
use clap::{App, Arg};
|
use clap::{App, Arg};
|
||||||
use scanner::Scanner;
|
use scanner::Scanner;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
variables::test();
|
||||||
|
|
||||||
let matches = App::new("AbleScript")
|
let matches = App::new("AbleScript")
|
||||||
.version(env!("CARGO_PKG_VERSION"))
|
.version(env!("CARGO_PKG_VERSION"))
|
||||||
.author("Able <abl3theabove@gmail.com>")
|
.author("Able <abl3theabove@gmail.com>")
|
||||||
|
@ -20,6 +23,7 @@ fn main() {
|
||||||
.takes_value(true),
|
.takes_value(true),
|
||||||
)
|
)
|
||||||
.get_matches();
|
.get_matches();
|
||||||
|
|
||||||
match matches.value_of("file") {
|
match matches.value_of("file") {
|
||||||
Some(file_path) => {
|
Some(file_path) => {
|
||||||
// Read file
|
// Read file
|
||||||
|
|
32
src/variables.rs
Normal file
32
src/variables.rs
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue