Skip to content

Wrong backreference escaping #239

@RedCMD

Description

@RedCMD

When using backreferences across begin-end/while rules
a bunch of regex characters get escaped in the process

The escape characters differ between VSCode TextMate and the official TextMate 2.0

TextMate 2.0 escapes: https://github.com/textmate/textmate/blob/master/Frameworks/parse/src/parse.cc#L120
\|([{}]).?*+^$
VSCode TextMate escapes: https://github.com/microsoft/vscode-textmate/blob/main/src/utils.ts#L160
\|([{}]).?*+^$-,# \t\n

"begin": "^(.+)$",
"end": "[\\1]+",
"name": "string"

That grammar will match differently between VSCode and TextMate2.0 on the file:

a-z
bcd
a-z
hij

VSCode:
image

TextMate2.0:
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions