diff --git a/src/lib.rs b/src/lib.rs index ae0a71c..5c0442c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,11 +1,9 @@ +pub mod parse; +pub mod render; + +use parse::tokens::TokenType; use std::collections::HashMap; -use tokens::TokenType; - -pub mod parser; -mod scanner; -mod tokens; - #[derive(Debug)] pub struct Vis { pub structure: Vec, diff --git a/src/main.rs b/src/main.rs index 43a225a..560b1d6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -8,7 +8,7 @@ fn main() -> anyhow::Result<()> { return Err(anyhow!("Usage: vis vis-file")); } else { let vis_file = read_file(&args[1])?; - let vis = vis::parser::parse_vis(vis_file.as_str())?; + let vis = vis::parse::parse_vis(vis_file.as_str())?; println!("{:?}", vis); } diff --git a/src/parse/mod.rs b/src/parse/mod.rs new file mode 100644 index 0000000..9edb0f5 --- /dev/null +++ b/src/parse/mod.rs @@ -0,0 +1,5 @@ +mod scanner; +pub mod tokens; +pub mod parser; + +pub use parser::parse_vis; \ No newline at end of file diff --git a/src/parser.rs b/src/parse/parser.rs similarity index 98% rename from src/parser.rs rename to src/parse/parser.rs index 4574b9d..fd451ff 100644 --- a/src/parser.rs +++ b/src/parse/parser.rs @@ -1,5 +1,5 @@ use crate::{ - tokens::{ + parse::tokens::{ Token, TokenType::{self, *}, }, @@ -8,7 +8,7 @@ use crate::{ use anyhow::anyhow; pub fn parse_vis(contents: &str) -> anyhow::Result { - let tokens = crate::scanner::scan(contents)?; + let tokens = crate::parse::scanner::scan(contents)?; // println!("{:?}", tokens); let mut parser = Parser::new(tokens); diff --git a/src/scanner.rs b/src/parse/scanner.rs similarity index 99% rename from src/scanner.rs rename to src/parse/scanner.rs index f3ac5a6..844146a 100644 --- a/src/scanner.rs +++ b/src/parse/scanner.rs @@ -1,6 +1,6 @@ use unicode_segmentation::UnicodeSegmentation; -use crate::tokens::{ +use crate::parse::tokens::{ Token, TokenType::{self, *}, KEYWORDS, diff --git a/src/tokens.rs b/src/parse/tokens.rs similarity index 100% rename from src/tokens.rs rename to src/parse/tokens.rs diff --git a/src/render/mod.rs b/src/render/mod.rs new file mode 100644 index 0000000..e69de29