diff options
Diffstat (limited to 'users/tazjin/rlox')
-rw-r--r-- | users/tazjin/rlox/src/main.rs | 9 | ||||
-rw-r--r-- | users/tazjin/rlox/src/treewalk/errors.rs (renamed from users/tazjin/rlox/src/errors.rs) | 0 | ||||
-rw-r--r-- | users/tazjin/rlox/src/treewalk/interpreter.rs | 8 | ||||
-rw-r--r-- | users/tazjin/rlox/src/treewalk/interpreter/builtins.rs | 4 | ||||
-rw-r--r-- | users/tazjin/rlox/src/treewalk/mod.rs | 11 | ||||
-rw-r--r-- | users/tazjin/rlox/src/treewalk/parser.rs (renamed from users/tazjin/rlox/src/parser.rs) | 4 | ||||
-rw-r--r-- | users/tazjin/rlox/src/treewalk/resolver.rs | 6 | ||||
-rw-r--r-- | users/tazjin/rlox/src/treewalk/scanner.rs (renamed from users/tazjin/rlox/src/scanner.rs) | 2 |
8 files changed, 22 insertions, 22 deletions
diff --git a/users/tazjin/rlox/src/main.rs b/users/tazjin/rlox/src/main.rs index 13a5748187ad..e3bc2783150c 100644 --- a/users/tazjin/rlox/src/main.rs +++ b/users/tazjin/rlox/src/main.rs @@ -5,9 +5,6 @@ use std::io::Write; use std::process; mod bytecode; -mod errors; -mod parser; -mod scanner; mod treewalk; fn main() { @@ -16,9 +13,3 @@ fn main() { _ => bytecode::main(), } } - -fn report_errors(errors: Vec<errors::Error>) { - for error in errors { - errors::report(&error); - } -} diff --git a/users/tazjin/rlox/src/errors.rs b/users/tazjin/rlox/src/treewalk/errors.rs index 3d5c28f9f3bb..3d5c28f9f3bb 100644 --- a/users/tazjin/rlox/src/errors.rs +++ b/users/tazjin/rlox/src/treewalk/errors.rs diff --git a/users/tazjin/rlox/src/treewalk/interpreter.rs b/users/tazjin/rlox/src/treewalk/interpreter.rs index 5b47dc0248f9..a096716d9155 100644 --- a/users/tazjin/rlox/src/treewalk/interpreter.rs +++ b/users/tazjin/rlox/src/treewalk/interpreter.rs @@ -1,7 +1,7 @@ -use crate::errors::{Error, ErrorKind}; -use crate::parser::{self, Block, Expr, Literal, Statement}; -use crate::scanner::{self, TokenKind}; -use crate::treewalk::resolver; +use crate::treewalk::errors::{Error, ErrorKind}; +use crate::treewalk::parser::{self, Block, Expr, Literal, Statement}; +use crate::treewalk::scanner::{self, TokenKind}; +use crate::treewalk::treewalk::resolver; use std::collections::HashMap; use std::rc::Rc; use std::sync::RwLock; diff --git a/users/tazjin/rlox/src/treewalk/interpreter/builtins.rs b/users/tazjin/rlox/src/treewalk/interpreter/builtins.rs index 0ec6ae08c354..709e53c7c0eb 100644 --- a/users/tazjin/rlox/src/treewalk/interpreter/builtins.rs +++ b/users/tazjin/rlox/src/treewalk/interpreter/builtins.rs @@ -1,8 +1,8 @@ use std::fmt; use std::time::{SystemTime, UNIX_EPOCH}; -use crate::errors::Error; -use crate::parser::Literal; +use crate::treewalk::errors::Error; +use crate::treewalk::parser::Literal; use crate::treewalk::interpreter::Value; pub trait Builtin: fmt::Debug { diff --git a/users/tazjin/rlox/src/treewalk/mod.rs b/users/tazjin/rlox/src/treewalk/mod.rs index 95136b2fa141..ae1049a12eff 100644 --- a/users/tazjin/rlox/src/treewalk/mod.rs +++ b/users/tazjin/rlox/src/treewalk/mod.rs @@ -1,7 +1,10 @@ use crate::*; -pub mod interpreter; +mod errors; +mod parser; mod resolver; +mod scanner; +pub mod interpreter; pub fn main() { let mut args = env::args(); @@ -50,3 +53,9 @@ fn run(lox: &mut treewalk::interpreter::Interpreter, code: &str) { report_errors(errors); } } + +fn report_errors(errors: Vec<errors::Error>) { + for error in errors { + errors::report(&error); + } +} diff --git a/users/tazjin/rlox/src/parser.rs b/users/tazjin/rlox/src/treewalk/parser.rs index e28404aa9fce..8117c29726c9 100644 --- a/users/tazjin/rlox/src/parser.rs +++ b/users/tazjin/rlox/src/treewalk/parser.rs @@ -5,8 +5,8 @@ // // My Rust implementation skips this step because it's unnecessary, we // have real types. -use crate::errors::{Error, ErrorKind}; -use crate::scanner::{Token, TokenKind}; +use crate::treewalk::errors::{Error, ErrorKind}; +use crate::treewalk::scanner::{Token, TokenKind}; use std::rc::Rc; // AST diff --git a/users/tazjin/rlox/src/treewalk/resolver.rs b/users/tazjin/rlox/src/treewalk/resolver.rs index 5e15d386c73f..3d12973aa089 100644 --- a/users/tazjin/rlox/src/treewalk/resolver.rs +++ b/users/tazjin/rlox/src/treewalk/resolver.rs @@ -6,9 +6,9 @@ use std::collections::HashMap; use std::rc::Rc; -use crate::errors::{Error, ErrorKind}; -use crate::parser::{self, Expr, Statement}; -use crate::scanner::Token; +use crate::treewalk::errors::{Error, ErrorKind}; +use crate::treewalk::parser::{self, Expr, Statement}; +use crate::treewalk::scanner::Token; #[derive(Default)] struct Resolver<'a> { diff --git a/users/tazjin/rlox/src/scanner.rs b/users/tazjin/rlox/src/treewalk/scanner.rs index 36c2d6a966ae..af9075484145 100644 --- a/users/tazjin/rlox/src/scanner.rs +++ b/users/tazjin/rlox/src/treewalk/scanner.rs @@ -1,4 +1,4 @@ -use crate::errors::{Error, ErrorKind}; +use crate::treewalk::errors::{Error, ErrorKind}; #[derive(Clone, Debug, PartialEq)] pub enum TokenKind { |