style(tazjin/rlox): Set max_width=80
Change-Id: Ib64831c0b97c94fdfbdbae64f4dfccc86879ef73 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2554 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in>
This commit is contained in:
parent
ebc987f4aa
commit
75750ba683
7 changed files with 153 additions and 50 deletions
|
|
@ -15,7 +15,10 @@ pub trait Lox {
|
|||
type Error: std::fmt::Display;
|
||||
|
||||
fn create() -> Self;
|
||||
fn interpret(&mut self, source: String) -> Result<Self::Value, Vec<Self::Error>>;
|
||||
fn interpret(
|
||||
&mut self,
|
||||
source: String,
|
||||
) -> Result<Self::Value, Vec<Self::Error>>;
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
@ -26,7 +29,9 @@ fn main() {
|
|||
}
|
||||
|
||||
match env::var("LOX_INTERPRETER").as_ref().map(String::as_str) {
|
||||
Ok("treewalk") => pick::<treewalk::interpreter::Interpreter>(args.nth(1)),
|
||||
Ok("treewalk") => {
|
||||
pick::<treewalk::interpreter::Interpreter>(args.nth(1))
|
||||
}
|
||||
_ => pick::<bytecode::Interpreter>(args.nth(1)),
|
||||
}
|
||||
}
|
||||
|
|
@ -41,7 +46,8 @@ fn pick<I: Lox>(file_arg: Option<String>) {
|
|||
|
||||
// Run Lox code from a file and print results to stdout
|
||||
fn run_file<I: Lox>(file: &str) {
|
||||
let contents = fs::read_to_string(file).expect("failed to read the input file");
|
||||
let contents =
|
||||
fs::read_to_string(file).expect("failed to read the input file");
|
||||
let mut lox = I::create();
|
||||
run(&mut lox, contents);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue