From a76d072d3f4c834e172c1c4ed8edead42ac66624 Mon Sep 17 00:00:00 2001 From: giles Date: Thu, 14 May 2026 20:21:18 +0000 Subject: [PATCH] lua: re-apply arch's GUEST-lex prefix-rename refactor on top of merged loops/lua MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Lua now joins tcl/ocaml/kernel/common-lisp in consuming lib/guest/lex.sx via prefix-rename. Removes 28 lines of duplicated character-class helpers (lua-make-token, lua-digit?, lua-hex-digit?, lua-letter?, lua-ident-start?, lua-ident-char?, lua-ws?) and replaces with the 8-line prefix-rename block. The byte-table additions from loops/lua (__ascii-tok, __lua-127-255-tok, lua-byte-to-char) are preserved at the top of tokenizer.sx — those provide Lua's 8-bit-clean string semantics on top of the shared lex layer. test.sh updated to preload lib/guest/lex.sx + lib/guest/prefix.sx before lua sources, matching the load order arch's pre-merge test.sh used. 393/395 maintained. The 2 pre-existing failures are unrelated: - math.random(n) primitive arity issue - os.clock returns rational instead of number (SX division semantics) Skipped from the planned follow-up: delay/force port. Arch's lua-force was defined but never referenced anywhere — dead code, not worth porting. Co-Authored-By: Claude Opus 4.7 (1M context) --- lib/lua/test.sh | 4 ++++ lib/lua/tokenizer.sx | Bin 13824 -> 13512 bytes 2 files changed, 4 insertions(+) diff --git a/lib/lua/test.sh b/lib/lua/test.sh index 771d8022..e7d2b11a 100755 --- a/lib/lua/test.sh +++ b/lib/lua/test.sh @@ -27,6 +27,10 @@ TMPFILE=$(mktemp) trap "rm -f $TMPFILE" EXIT cat > "$TMPFILE" << 'EPOCHS' +(epoch 0) +(load "lib/guest/lex.sx") +(epoch 0a) +(load "lib/guest/prefix.sx") (epoch 1) (load "lib/lua/tokenizer.sx") (epoch 2) diff --git a/lib/lua/tokenizer.sx b/lib/lua/tokenizer.sx index 82c72af569a6ad47303035c32503bf5a21904ffc..326e885bdd02d19d6ff8ecf4c031ca2994d55daa 100644 GIT binary patch delta 396 zcmb7;Jr2S!422~mmYl+3N{2}79XfLcCW{(sk^YdHpRGLvSAZFbOK=WOLIQ!ph!sW2 zd!L`(+Z$ibqfVtM+>gCKFe{td3FTnv0FC34g?H3~-ZA<=E%{&^RajCITV9QS-Aex? zbuh78G!q4&H``hWv@UT?M(QkbS{IZG#KS5?@LweVva_(+3kr BkI?`C delta 708 zcmZ{i&q~BF5XM0~^(ls)nnPi4Vo{5ieTYSn(57zKnk;G7zes%=@hJEbK9)0++GJfV zH2FH6eDmu}zw~SW@pd#8t?IN<(C=hth2cB2dw9p3(NtKd%dI|W-i2zah=BMDWA zhPC26T3&?6vedEFH`>?1tr1X2(?VgahvFO>FuETFMla|gU*ssySf1truh}XC##^h0 zG8ke20dd8>5n)Gb78ptkpbe#A)VfKbrmtnIv4+WjbC@sS$cWP+PCT3BT*jOwBOgNd z%6sK%JpL!~$ZY>3Pc1t@dctyh?-G>NZxrsHZk6%n;H66kGFlh9F>zuy!ff(ucA008 ycr=huJxyjVybe`;WKaj@>{$`X*COmqema@9?QJN?nbA7_``{En%_qs~}