Skip to content

fix: align Lua 5.2 pattern captures and replacements - #382

Merged
akeit0 merged 4 commits into
mainfrom
codex/pr-lua52-pattern-semantics
Oct 27, 2026
Merged

akeit0 merged 4 commits into
mainfrom
codex/pr-lua52-pattern-semantics

Conversation

@akeit0

@akeit0 akeit0 commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

Treat a leading caret literally in gmatch and return zero results when its iterator is exhausted. Accept integer-coerced search positions, validate gsub replacement types before matching, and support invariant numeric replacements. Centralize capture extraction so unfinished captures raise Lua errors consistently.

Remove repeated capture-array clears: live slots are initialized before use. Tests cover failed matches, backreferences, maximum/unfinished captures, empty matches, replacement arguments, cultures, suspension and stack cleanup. The full test suite passes on .NET 8/10; CSharpier passes.

@akeit0
akeit0 force-pushed the codex/pr-lua52-string-table-arguments branch from d549634 to 05051bb Compare October 27, 2026 02:56
@akeit0
akeit0 force-pushed the codex/pr-lua52-pattern-semantics branch from af9d933 to de564a8 Compare October 27, 2026 02:56
@akeit0
akeit0 force-pushed the codex/pr-lua52-string-table-arguments branch from 05051bb to 385f661 Compare October 27, 2026 03:11
@akeit0
akeit0 force-pushed the codex/pr-lua52-pattern-semantics branch from de564a8 to 25d22c2 Compare October 27, 2026 03:11
@akeit0
akeit0 changed the base branch from codex/pr-lua52-string-table-arguments to main October 27, 2026 03:28
@akeit0
akeit0 marked this pull request as ready for review October 27, 2026 03:28
@akeit0
akeit0 force-pushed the codex/pr-lua52-pattern-semantics branch from 25d22c2 to 12d0ee2 Compare October 27, 2026 03:28
@akeit0
akeit0 merged commit 92bbfd5 into main Oct 27, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant