From e24bbe91ca93cebaab0887d97a3db1abac9197fd Mon Sep 17 00:00:00 2001 From: Ivory Date: Sat, 3 Jun 2023 23:08:46 -0400 Subject: [PATCH] mild cleanup --- src/main.rs | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/src/main.rs b/src/main.rs index cb2c94d..cf6e600 100644 --- a/src/main.rs +++ b/src/main.rs @@ -63,16 +63,16 @@ impl Program<'_> { return program } - fn should_skip(term: &str) -> bool { - if term == "program" { - return true; - } else { - return false; - } - } - fn digest(&self, tree: &ParseTree) { + if tree.lhs.to_string() == "" { + self.digest_1(tree); + return; + } else if tree.lhs.to_string() == "" { + self.digest_unit(tree); + return; + } + println!("Program::digest {}", tree.lhs.to_string()); // mut because that recursion could get nasty. @@ -86,7 +86,7 @@ impl Program<'_> { continue; } if tree.lhs.to_string() == "" { - self.digest_1(tree); + self.digest(tree); } } } @@ -105,12 +105,7 @@ impl Program<'_> { if tree.lhs.to_string().starts_with("<_") { continue; } - if tree.lhs.to_string() == "" { - self.digest_1(tree); - } - if tree.lhs.to_string() == "" { - self.digest_unit(tree); - } + self.digest(tree); } } }