Conversation
ff1d2f4 to
31abc7f
Compare
85a588d to
176f3a9
Compare
176f3a9 to
2ca1233
Compare
@dcreager Possibly, but I don't know how to check that. I suspect that things might "just work" already because the pattern syntax is quite similar to expressions and re-uses the same keywords. |
|
The easiest way would be to run |
| (encoding) @constant.builtin | ||
|
|
||
| (hash_pattern_norest | ||
| "**" @operator |
There was a problem hiding this comment.
@dcreager Ideally the highlight of ** would be none, however, I don't know how to express that.
There was a problem hiding this comment.
Hmm, I actually don't know if that can be done! That's an interesting thing that we should support. 👍 with this workaround for now.
| (encoding) @constant.builtin | ||
|
|
||
| (hash_pattern_norest | ||
| "**" @operator |
There was a problem hiding this comment.
Hmm, I actually don't know if that can be done! That's an interesting thing that we should support. 👍 with this workaround for now.
This pull request adds pattern matching syntax to the Ruby grammar. This syntax looks as follows:
See also: https://docs.ruby-lang.org/en/3.0.0/doc/syntax/pattern_matching_rdoc.html
This pull request does not yet add the one-line pattern matching syntax (
expr in patternandexpr => pattern). While the addition to the grammar just a few lines, it causes a serious increase in the generated C code. Therefore, I think this is best left as a follow-up pull request where we can discuss what causes the blow-up and how to address it. See also: aibaars#1This pull request makes some minor changes to the existing grammar:
_expressionis added to the supertypes list to avoid a lot of duplication in the node-types file_literalis extracted for the various types of literals allowing it to be used for expressions as well as patterns.Checklist: