Update to latest textmate grammar + support patterns in captures in parser #4303
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
@bkonyi This updates to the latest grammar, which includes a few fixes and better highlighting for interpolated strings.
Before:
After:
However, the parser did not support having patterns nested in captures so I also had to make some changes there. I extracted a
PatternMatcherthat matches anything that has a set ofpatterns(and added this to_Matcher.parse()). and now specifically look for nested patterns in captures.With these changes, I get the same output when running some tests (see dart-lang/dart-syntax-highlight#28) as a NodeJS tool I was using to do the same. I have found some issues with the grammar (such has handling of nested type args), but I'd like to get and get some tests for the grammar (via dart-lang/dart-syntax-highlight#28) before I start trying to fix that, to ensure I don't regress anything while trying to fix (since I don't expect the fix to be trivial).
Please review carefully, I'm a parser noob :-)
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.