From bbd70e85779e646e112c6ce72de970818e6ff821 Mon Sep 17 00:00:00 2001 From: Jared Miller Date: Mon, 9 Feb 2026 23:04:56 -0500 Subject: [PATCH] Truncate words to dictionary resolution before lookup --- src/mudlib/zmachine/zlexer.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/mudlib/zmachine/zlexer.py b/src/mudlib/zmachine/zlexer.py index ad31417..378ea23 100644 --- a/src/mudlib/zmachine/zlexer.py +++ b/src/mudlib/zmachine/zlexer.py @@ -124,9 +124,13 @@ class ZLexer: token_list = self._tokenise_string(string, separators) + # Truncate to dictionary resolution (6 chars V1-3, 9 chars V4+) + max_word_len = 6 if self._memory.version <= 3 else 9 + final_list = [] for word in token_list: - byte_addr = dict.get(word, 0) + lookup_key = word[:max_word_len] + byte_addr = dict.get(lookup_key, 0) final_list.append([word, byte_addr]) return final_list