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); } } }