Skip to content

Commit

Permalink
started to parse files
Browse files Browse the repository at this point in the history
  • Loading branch information
mauro-balades committed Apr 27, 2023
1 parent d424e27 commit 4101279
Show file tree
Hide file tree
Showing 6 changed files with 142 additions and 6 deletions.
116 changes: 116 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ edition = "2021"
lalrpop = "0.19.10"

[dependencies]
clap = { version = "4.2.4", features = ["derive"] }
lalrpop-util = {version = "0.19.10", features = ["lexer"]}
regex = "1"
1 change: 0 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
extern crate lalrpop;

pub fn main() {

lalrpop::process_root().unwrap();
}
23 changes: 22 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,28 @@
use clap::Parser as CLIParser;
use std::path::Path;

use std::fs;

#[macro_use] extern crate lalrpop_util;
lalrpop_mod!(pub parser); // synthesized by LALRPOP

pub fn main() {
/// Simple program to greet a person
#[derive(CLIParser, Debug)]
#[command(author, version, about, long_about = None)]
struct Args {
#[arg(index = 1)]
file: String,
}

pub fn main() -> std::io::Result<()> {
let args = Args::parse();
let file = args.file;

let breeze_file = Path::new(&file).join("project.breeze");
let program_text = fs::read_to_string(breeze_file).expect("Unable to read the program file");

let expr = parser::BreezeParser::new()
.parse(&program_text)
.unwrap();
Ok(())
}
4 changes: 0 additions & 4 deletions test/main.breeze

This file was deleted.

3 changes: 3 additions & 0 deletions test/project.breeze
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
task build {

}

0 comments on commit 4101279

Please sign in to comment.