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
Matching any child with NodePattern #6841
Comments
This was referenced Mar 17, 2019
Description edited to match #6965 |
marcandre
added a commit
to marcandre/rubocop
that referenced
this issue
Apr 25, 2019
…rder. These can be used multiple times in the same sequence as well as nested. Limitations: A sequence can only contain a single ellipsis (contained or not within a <> sequence). Other implementation changes: - Captures are now an array (e.g. `capture0` is now `captures[0]`) - Temporary variables like `temp1` were renamed to `node1`. - Reading tokens until a delimiter was factorized into `tokens_until`
bbatsov
pushed a commit
that referenced
this issue
Apr 25, 2019
These can be used multiple times in the same sequence as well as nested. Limitations: A sequence can only contain a single ellipsis (contained or not within a <> sequence). Other implementation changes: - Captures are now an array (e.g. `capture0` is now `captures[0]`) - Temporary variables like `temp1` were renamed to `node1`. - Reading tokens until a delimiter was factorized into `tokens_until`
3 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
From @Drenmi :
Suggested syntax extension would be
<...>
as it seems the easiest remaining "brackety" symbol left.Simple:
This would match
{bar: 2, foo: 1}
and{foo: 1, bar: 2}
but nothing else. To match hashes containing these two value-key pairs, use...
:Ellipsis:
This would match any literal hash with a
foo: 1
key-value pair. Ellipsis must be at end of<>
sequence.Note: Patterns are attempted to be matched in the order given.
<(pair _ (int 1)) (pair (sym :foo) _)>
would match{bar: 1, foo: 1}
but not{foo: 1, bar: 1}
. Captures are always returned in the order of the pattern.Comments?
The text was updated successfully, but these errors were encountered: