lua: re-apply arch's GUEST-lex prefix-rename refactor on top of merged loops/lua
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 32s

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) <noreply@anthropic.com>
This commit is contained in:
2026-05-14 20:21:18 +00:00
parent 97c800a36b
commit a76d072d3f
2 changed files with 4 additions and 0 deletions

View File

@@ -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)

Binary file not shown.