-
-
Notifications
You must be signed in to change notification settings - Fork 55
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
?
repetition causes matched nodes to be returned as an array
#322
Comments
It does.
Well, there's a major version in the works... :-) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://nodepattern.herokuapp.com/?p=(%0A%20%20def%20%24_method_name%0A%20%20(args)%0A%20%20(or-asgn%20%24(ivasgn%20_%20...)%20...)%3F%0A)&ruby=def%20foo%0A%20%20%40bar%20%7C%7C%3D%20baz%0Aend
The pattern is reduced from what I'm trying to write. I'd like to use OR
{}
but because each branch will contain different amount of captures, I write multiple?
matchers after each other.*
and+
can return 0-n and 1-n matches so it totally makes sense to return an array for these.+
on the other hand is ony 0-1 so I'd expect this to be either be the node ornil
.Can't change this now without a major version bump of course and the solution for me is to just call
flatten
somewhere in the code but I wanted to see what others think. Does my "complaint" make sense?The text was updated successfully, but these errors were encountered: