From fd7b1340ca65bec9ca5e592ed8072a0cfad57a2c Mon Sep 17 00:00:00 2001 From: Rowan Torbitzky-Lane Date: Mon, 28 Apr 2025 19:39:08 -0500 Subject: [PATCH] _state and regex change to catch edge case --- scripts/instruction_list.py | 2 +- src/instructions/code.rs | 2 +- src/instructions/list.rs | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/instruction_list.py b/scripts/instruction_list.py index d152901..43453b2 100644 --- a/scripts/instruction_list.py +++ b/scripts/instruction_list.py @@ -25,7 +25,7 @@ def run_cargo_expand(binary_name, path_to_module): def extract_functions_with_push_state(code): """Extract function names that have &mut PushState as their only parameter.""" # Look for function definitions with pattern: pub fn name(state: &mut PushState) - pattern = r'pub fn ([a-zA-Z0-9_]+)\s*\(\s*state\s*:\s*&mut\s+PushState\s*\)' + pattern = r'pub fn ([a-zA-Z0-9_]+)\s*\(\s*_?state\s*:\s*&mut\s+PushState\s*\)' matches = re.findall(pattern, code) return matches diff --git a/src/instructions/code.rs b/src/instructions/code.rs index 187dc19..ab63fc7 100644 --- a/src/instructions/code.rs +++ b/src/instructions/code.rs @@ -464,7 +464,7 @@ fn _reverse(a: Gene) -> Option { macro_rules! noop { ($stack:ident, $name:ident) => { paste::item! { - pub fn [< $stack $name >] (_: &mut PushState) { + pub fn [< $stack $name >] (_state: &mut PushState) { () } } diff --git a/src/instructions/list.rs b/src/instructions/list.rs index 3007d43..cc778ad 100644 --- a/src/instructions/list.rs +++ b/src/instructions/list.rs @@ -380,6 +380,8 @@ pub fn code_instructions() -> Vec { code_insert, code_first_position, code_reverse, + code_noop, + code_noop_block, code_from_int, code_from_float, code_from_string, @@ -435,6 +437,8 @@ pub fn exec_instructions() -> Vec { exec_insert, exec_first_position, exec_reverse, + exec_noop, + exec_noop_block, exec_pop, exec_dup, exec_dup_times,