[Space Lua] Implement native Lua pattern matching engine (#1838)

* Add Lua *pattern matching engine* (`pattern.ts`) that directly ports
  `lstrlib.c` semantics.

* Integrate the new engine into the `string` API for `find`, `match`,
  `gmatch`, and `gsub` functions.

* Add a pattern test suite (`pattern_test.lua`) covering character
  classes, repetition quantifiers, edge cases as well as error
  conditions.

* Refactor `string_test.lua` to remove duplicated pattern tests that
  are now covered by the pattern test suite.

* Fix `string.rep` separator support.

* Fix `string.sub` index handling.

* Remove the obsolete `string_test2.lua` file.

Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>
This commit is contained in:
Matouš Jan Fialka
2026-02-13 14:18:55 +01:00
committed by GitHub
parent 8592b3add6
commit e0182b3bb4
6 changed files with 1417 additions and 953 deletions
+4 -1
View File
@@ -45,9 +45,12 @@ Deno.test("[Lua] String to number tests", async () => {
await runLuaTest("./tonumber_test.lua");
});
Deno.test("[Lua] Pattern tests", async () => {
await runLuaTest("./stdlib/pattern_test.lua");
});
Deno.test("[Lua] String tests", async () => {
await runLuaTest("./stdlib/string_test.lua");
// await runLuaTest("./stdlib/string_test2.lua");
});
Deno.test("[Lua] Space Lua tests", async () => {