From 22de7bd7754f3a942e9177f86e37a0791967f507 Mon Sep 17 00:00:00 2001 From: Irene Knapp Date: Sun, 7 Apr 2024 01:15:54 -0700 Subject: it is not necessary to check that a register command is valid in the middle of reading it. let the mode deal with the structural properties of collecting the parameter and calling the appropriate backend, then let errors happen at dispatch time. Change-Id: Ic5a84f4883b4ee4c3b630614abff02bb9d67ebb4 --- src/main.rs | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/src/main.rs b/src/main.rs index f392572..1ee9e88 100644 --- a/src/main.rs +++ b/src/main.rs @@ -511,20 +511,9 @@ fn make_string_readtable() -> ReadTable { fn make_register_string_readtable() -> ReadTable { let mut result = ReadTable::new(move |c, state| { - match state.reg_command.as_str() { - "l" | "s" => { - state.wip_str.push(c); - - Ok(()) - } - - _ => { - state.mode = Mode::CommandChar; + state.wip_str.push(c); - Err(err_msg(format!( - "Unsupported register command {}", state.reg_command))) - } - } + Ok(()) }); result.set_action(']', move |_, state| { -- cgit 1.4.1