T2: Fix \g{1} semantics — numbered backreference, not named #39

Open
opened 2026-03-24 22:26:32 +03:00 by NiXTheDev · 0 comments
NiXTheDev commented 2026-03-24 22:26:32 +03:00 (Migrated from github.com)

Task 2: Fix \g{1} Semantics

Wave: 1 (Critical Bug Fixes)
Category: unspecified-high
Parent: Epic #37

Problem

\g{1} is treated as a named backreference with name "1", not a numbered backreference. This diverges from PCRE/Python behavior.

What to do

  • RED: Write failing tests asserting \g{1} behaves like \1 (numbered)
  • GREEN: Update parser to treat \g{N} where N is numeric as numbered backreference
  • REFACTOR: Ensure \g{name} still works for named backrefs

Acceptance Criteria

  • \g{1} matches same as \1 (first group)
  • \g{2} matches same as \2 (second group)
  • \g{name} still works as named backreference
  • \g{-1} still works as relative backreference

Commit

fix: \g{N} is numbered backreference, not named

## Task 2: Fix \g{1} Semantics **Wave**: 1 (Critical Bug Fixes) **Category**: unspecified-high **Parent**: Epic #37 ### Problem \g{1} is treated as a named backreference with name "1", not a numbered backreference. This diverges from PCRE/Python behavior. ### What to do - RED: Write failing tests asserting \g{1} behaves like \1 (numbered) - GREEN: Update parser to treat \g{N} where N is numeric as numbered backreference - REFACTOR: Ensure \g{name} still works for named backrefs ### Acceptance Criteria - [ ] \g{1} matches same as \1 (first group) - [ ] \g{2} matches same as \2 (second group) - [ ] \g{name} still works as named backreference - [ ] \g{-1} still works as relative backreference ### Commit `fix: \g{N} is numbered backreference, not named`
Sign in to join this conversation.
No description provided.