summary refs log tree commit diff
diff options
context:
space:
mode:
authorIrene Knapp <ireneista@irenes.space>2024-04-07 01:15:54 -0700
committerIrene Knapp <ireneista@irenes.space>2024-04-07 01:15:54 -0700
commit22de7bd7754f3a942e9177f86e37a0791967f507 (patch)
tree05a7d869365e7bd8721778c0a5871f74e9d54721
parent407eed923fa95c544a05e6b7b44a72c44c320d3b (diff)
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
-rw-r--r--src/main.rs15
1 files 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| {