From 49a4adb18d51db76ff599561e4c602c55aea6402 Mon Sep 17 00:00:00 2001 From: Victor Date: Sun, 8 Sep 2024 10:55:20 +0200 Subject: [PATCH] Lil update --- maeel.rs | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/maeel.rs b/maeel.rs index 4cdba19..12d5118 100644 --- a/maeel.rs +++ b/maeel.rs @@ -39,7 +39,7 @@ macro_rules! take_with_predicate { let content: String = once($char).chain($chars.clone().take_while($p)).collect(); (1..content.len()).for_each(|_| { - $chars.next(); + $chars.next(); }); content @@ -125,7 +125,6 @@ fn lex_into_tokens( .collect::>(); let mut content = String::with_capacity(content_vector.len()); - let mut index = 0; while index < content_vector.len() { @@ -156,13 +155,13 @@ fn lex_into_tokens( } 'a'..='z' | 'A'..='Z' | '_' => { let content = - take_with_predicate!(chr, chars, |&c| c.is_alphanumeric() || c == '_'); + take_with_predicate!(chr, chars, |&c| c.is_alphanumeric() || c == '_'); tokens.push((Token::Name(content), file, line)) } '0'..='9' => { let content = /* integer/float as a string */ - take_with_predicate!(chr, chars, |&c| c.is_ascii_digit() || c == '.'); + take_with_predicate!(chr, chars, |&c| c.is_ascii_digit() || c == '.'); let tokenized = if content.contains('.') { Token::Float(content.parse().unwrap()) @@ -305,9 +304,11 @@ impl BocchiVM { self.push(fake_fun) } - Token::Symbol('!') => expect_stack!(Fun, self, file, line) - .iter() - .for_each(|t| tokens.push(t.clone())), + Token::Symbol('!') => { + expect_stack!(Fun, self, file, line) + .iter() + .for_each(|t| tokens.push(t.clone())); + } Token::Symbol(':') => { let name = expect_token!(Name, tokens, file, line); @@ -517,7 +518,7 @@ impl BocchiVM { (_, _) => unreachable!(), }; - self.push(output) + self.push(output) } fn mul(&mut self) { @@ -624,9 +625,9 @@ impl PartialEq for Cord { fn main() { let custom_panic_handler = /* Rust default is bloated */ - |panic_info: &PanicInfo| { - println!("{}", panic_info) - }; + |panic_info: &PanicInfo| { + println!("{}", panic_info) + }; panic::set_hook(Box::new(custom_panic_handler));