refactor(command_parser): remove the Empty token, we don't need it

This commit is contained in:
dusk 2025-01-24 04:13:06 +09:00
parent 071db3d6d6
commit 92276a720e
No known key found for this signature in database
4 changed files with 7 additions and 21 deletions

View file

@ -1,6 +1,6 @@
#![feature(iter_intersperse)]
use command_parser::{token::Token, Tree};
use command_parser::Tree;
use commands::COMMAND_TREE;
fn main() {
@ -32,8 +32,8 @@ fn print_tree(tree: &Tree, depth: usize) {
print!("-");
}
print!("> {token:?}");
if matches!(token, Token::Empty) {
println!(": {}", branch.command().unwrap().cb)
if let Some(command) = branch.command() {
println!(": {}", command.cb)
} else {
print_tree(branch, depth + 1)
}