From f8b3e2a100fdb28cad24948703439d2964c31580 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 17 Jan 2021 12:13:52 +0300 Subject: refactor(tazjin/rlox): Move treewalk interpreter into subdirectory Change-Id: I9163f75db5a1ff75e1b1f81bad78fd9d8ddb104a Reviewed-on: https://cl.tvl.fyi/c/depot/+/2409 Reviewed-by: tazjin Tested-by: BuildkiteCI --- users/tazjin/rlox/src/main.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'users/tazjin/rlox/src/main.rs') diff --git a/users/tazjin/rlox/src/main.rs b/users/tazjin/rlox/src/main.rs index 76e4ae8ae78f..1c1dd6f42ff6 100644 --- a/users/tazjin/rlox/src/main.rs +++ b/users/tazjin/rlox/src/main.rs @@ -5,10 +5,9 @@ use std::io::Write; use std::process; mod errors; -mod interpreter; mod parser; -mod resolver; mod scanner; +mod treewalk; fn main() { let mut args = env::args(); @@ -26,14 +25,14 @@ fn main() { // Run Lox code from a file and print results to stdout fn run_file(file: &str) { let contents = fs::read_to_string(file).expect("failed to read the input file"); - let mut lox = interpreter::Interpreter::create(); + let mut lox = treewalk::interpreter::Interpreter::create(); run(&mut lox, &contents); } // Evaluate Lox code interactively in a shitty REPL. fn run_prompt() { let mut line = String::new(); - let mut lox = interpreter::Interpreter::create(); + let mut lox = treewalk::interpreter::Interpreter::create(); loop { print!("> "); @@ -46,7 +45,7 @@ fn run_prompt() { } } -fn run(lox: &mut interpreter::Interpreter, code: &str) { +fn run(lox: &mut treewalk::interpreter::Interpreter, code: &str) { let chars: Vec = code.chars().collect(); let result = scanner::scan(&chars) -- cgit 1.4.1