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

JSON key "id" breaks the tokenizer #229

Open
RedCMD opened this issue Mar 5, 2024 · 0 comments
Open

JSON key "id" breaks the tokenizer #229

RedCMD opened this issue Mar 5, 2024 · 0 comments

Comments

@RedCMD
Copy link

RedCMD commented Mar 5, 2024

The internal tokenizer uses the key "id" as a way to keep track of rules within a grammar
However, the parser does not strip "id" keys from the grammar before parsing
if a invalid "id" key is hit during tokenizing, it will lead to unpredictable tokenizing and the grammar partially failing

Luckily it seems no one has placed one in the wrong spot (having one at root is fine)
tho I assume that's because they would have noticed their grammar no longer working when it is present
https://github.com/search?q=path%3A*.tmLanguage.json+%22%5C%22id%5C%22%3A%22&type=code

{
	"scopeName": "source.lang",
	"patterns": [
		{
			"begin": "\"",
			"end": "\"",
			"name": "string",
			"patterns": [ { "include": "#backslash" } ]
		}
	],
	"repository": {
		"backslash": {
			"match": "\\\\.",
			"name": "constant.character.escape",
			"id": "JSON key \"id\" breaks this rule and its parent"
		}
	}
}
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