• lobsters__andyc@crustaceanson.theshelf.topM
    link
    fedilink
    arrow-up
    1
    ·
    edit-2
    24 days ago

    OK now I see what expandEnd is trying to do – based on the capture of the begin pattern, it’s dynamically compiling a regex for an end pattern. (This is trying to match TextMate semantics, and TextMate also apparently does this dynamic compilation …)

    Except that rewrite is unsound:

    • \1 versus \\1 – the latter is a backslash and then the digit 1, and gets messed up
    • [\1] – is in a character class, not a backreference
    • \10 is not a backreference – there are only 9 in JS, with a single digit

    This is gross … I wanted to call it slop, but it’s actually inherited from TextMate. So there is pre-AI slop too, or Unix sludge …


    score 1 · canonical