• 
      

    Translate Lua's non-greedy "-" quantifier to Python's "*?".

    Review Request #15272 — Created Sept. 4, 2026 and submitted

    Information

    Review Board
    release-9.x

    Reviewers

    Lua patterns write non-greedy repetition as an item followed by -
    (.-, %s-). The converter only checked for - after *, +, or
    ? (a sequence Lua treats as a quantified item followed by a literal
    dash), so real non-greedy patterns silently translated the - to a
    literal dash, changing the pattern's meaning.

    The converter now follows Lua's parsing rules: - directly after a
    quantifiable item (a character, escape, or class) becomes *?, and a
    - anywhere else (pattern start, after a quantifier, after a capture
    group) stays literal. The old error return for *- is gone, since
    that sequence is valid in Lua.

    • Added translation tests for non-greedy and literal dash positions.
    • Ran all reviewboard/treesitter tests.
    Summary ID
    Translate Lua's non-greedy "-" quantifier to Python's "*?".
    Lua patterns write non-greedy repetition as an item followed by `-` (`.-`, `%s-`). The converter only checked for `-` after `*`, `+`, or `?` (a sequence Lua treats as a quantified item followed by a literal dash), so real non-greedy patterns silently translated the `-` to a literal dash, changing the pattern's meaning. The converter now follows Lua's parsing rules: `-` directly after a quantifiable item (a character, escape, or class) becomes `*?`, and a `-` anywhere else (pattern start, after a quantifier, after a capture group) stays literal. The old error return for `*-` is gone, since that sequence is valid in Lua. Testing: - Added translation tests for non-greedy and literal dash positions. - Ran all reviewboard/treesitter tests.
    oqzwyxnkptvopskmupvrpnltzmnyskrv
    chipx86
    1. Ship It!
    2. 
        
    david
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to release-9.x (dc9b6db)