From 476c9200b7158fc946a470c1400cd9ce024ce6e8 Mon Sep 17 00:00:00 2001 From: David Lynch Date: Fri, 7 Jun 2024 01:11:51 +0100 Subject: [PATCH] tidy up pre merge --- src/compiler.rs | 9 ++++++++- src/main.rs | 3 +-- src/shape.rs | 8 ++++---- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/compiler.rs b/src/compiler.rs index 1c017f6..dcae291 100644 --- a/src/compiler.rs +++ b/src/compiler.rs @@ -61,7 +61,14 @@ pub fn compile(data: &str) -> String { 0, tokens[1].parse::().expect("non numeric value given"), )), - "sphere" => result.push_str(&sphere(Point::new(0.0, 0.0, 0.0), 1.0, 10).unwrap()), + "sphere" => result.push_str( + &sphere( + Point::new(0.0, 0.0, 0.0), + tokens[1].parse::().expect("non numeric value given"), + 10, + ) + .unwrap(), + ), "#" => todo!(), &_ => eprintln!("{} not supported", tokens[0]), } diff --git a/src/main.rs b/src/main.rs index 58f056b..f3c454c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -13,12 +13,11 @@ use std::path::Path; struct Args { #[arg(help = "source file")] source: String, - #[arg(help = "output file", default_value="")] + #[arg(help = "output file", default_value = "")] output: String, } fn main() { - println!("{}", compile("sphere 1")); let args = Args::parse(); diff --git a/src/shape.rs b/src/shape.rs index 6706a7b..df230c8 100644 --- a/src/shape.rs +++ b/src/shape.rs @@ -75,13 +75,13 @@ pub fn sphere(origin: Point, radius: f32, _detail: u32) -> Result