Skip to content

Pattern engine gaps blocking pm.lua #257

Closed

Description

@davydog187

Problem

pm.lua is fully deferred (:all). Plan A9 in .agents/plans/ carved this work into sub-plans (A9a executor, A9b pattern); both unmerged. The pattern engine in lib/lua/vm/stdlib/pattern.ex is missing several features that pm.lua exercises directly.

Known gaps

Off the top of the existing plan notes and the file's contents:

  • %f[set] — frontier pattern (matches an empty string at the transition between chars not in set and chars in set).
  • %b{} — balanced match (e.g. %b() matches a balanced parenthesis pair).
  • Position capture () — empty parenthesised group captures the current position (1-based index), not a substring.
  • Backreferences %1..%9 in pattern bodies (referencing earlier captures).
  • Anchor edge cases around ^ and $ inside character classes and with multi-byte UTF-8 input.
  • string.gsub with a function/table replacement that returns false/nil (keep original match).

Suggested approach

This is large enough to keep split across sub-PRs:

  1. Triage: run pm.lua line-by-line, list which assertions fail and why. Reuse .agents/skills/triage-suite-failure/.
  2. Tackle position capture first (smallest, mechanical, used widely in other patterns).
  3. Then balanced match, frontier, and backreferences in that order.
  4. Each feature lands with its own regression tests under test/lua/vm/stdlib/pattern_test.exs.

Acceptance per sub-PR

  • A new specific feature passes its unit tests.
  • pm.lua advances to the next failure point. Track progress by replacing :all with narrowing ranges in test/lua53_skips.exs.

Risk

  • Pattern semantics interact (frontier inside a captured group, etc.). Each addition needs to be tested in combination with existing features, not just in isolation.

Activity

  1. added this to the 1.0.0 milestone on May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    direction:ADirection A: suite triage to 0.5.0kind:suiteLua 5.3 official test suite work

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions