Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
nikeedev committed Apr 15, 2024
1 parent ce9c196 commit 26a0e89
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 8 deletions.
9 changes: 7 additions & 2 deletions storm.toml → rain.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,10 @@
name = "rain-lang"
author = ["Nikita Goncarenko"]
version = "0.1.3a"
desciption = "Rain programming language compiler source code"
raindrop = "1"#st
description = "Rain programming language compiler source code"
raindrop = 1#st
out = "exe"

[droplets]
test = "0.1.0"
another_test = "0.1.0"
29 changes: 23 additions & 6 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
mod rain;
use std::{
env,
process,
fs
collections::HashMap, env, fs, hash::Hash, process
};
use colored::*;
use toml;
Expand All @@ -12,19 +10,31 @@ use rain::lexer::*;

#[derive(Debug, Deserialize)]
struct Config {
about: About,
project: Project,
droplets: HashMap<String, String>,
}

#[derive(Debug, Deserialize)]
struct About {
struct Project {
name: String,
version: String,
author: Vec<String>,
description: String,
raindrop: i32,
out: String,
}

#[derive(Debug, Deserialize)]
struct Droplet {
name: String,
version: String,
}


fn main() {
let args: Vec<String> = env::args().collect();

// ###### For storm, but right now just for reading the version file
let file: String =
match fs::read_to_string("rain.toml") {
Ok(x) => x,
Expand All @@ -36,13 +46,20 @@ fn main() {
Err(x) => panic!("Error parsing rain.toml file: {}", x)
};

let droplets: Vec<Droplet> = config.droplets.iter().map(
|droplet| Droplet { name: droplet.0.clone(), version: droplet.1.clone() }
).collect();

println!("{:#?}", droplets);
// ###### END - For storm, but right now just for reading the version file

let file: String = if args.len() >= 2 {
match fs::read_to_string(args[1].clone()) {
Ok(x) => x,
Err(x) => panic!("Error reading file: {}", x)
}
} else {
println!("{}", format!("Rain Lang Compiler - {}", config.about.version.as_str()).blue());
println!("{}", format!("Rain Lang Compiler - {}", config.project.version.as_str()).blue());
println!("{}", "\nUsage: rain <source file>.rain".cyan());
process::exit(0);
};
Expand Down

0 comments on commit 26a0e89

Please sign in to comment.