Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong backreference escaping #239

Open
RedCMD opened this issue Sep 22, 2024 · 0 comments
Open

Wrong backreference escaping #239

RedCMD opened this issue Sep 22, 2024 · 0 comments

Comments

@RedCMD
Copy link

RedCMD commented Sep 22, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant