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

\\G matches unicode character 0xFFFF #232

Open
RedCMD opened this issue May 28, 2024 · 1 comment
Open

\\G matches unicode character 0xFFFF #232

RedCMD opened this issue May 28, 2024 · 1 comment

Comments

@RedCMD
Copy link

RedCMD commented May 28, 2024

create a grammar with a rule containing \\G

"match": "\\G",
"name": "invalid"

run the grammar on a file containing the unicode character 0xFFFF

expected:
it doesn't match anything, as there are no \\G anchors available

actual:
it matches the unicode char 0xFFFF

image
abc�def

the char does actually pop up in multiple files inside VSCode
so this is not a non-issue issue
image

@senyai
Copy link

senyai commented May 28, 2024

As far as I understand, it is because of this logic:

vscode-textmate/src/rule.ts

Lines 692 to 696 in 09effd8

} else if (nextCh === 'G') {
A0_G0_result[pos + 1] = '\uFFFF';
A0_G1_result[pos + 1] = 'G';
A1_G0_result[pos + 1] = '\uFFFF';
A1_G1_result[pos + 1] = 'G';
. Can it be done smarter? Not sure.

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

2 participants