Closed jimhester closed 10 years ago
It sounds like it could be nice, but it could make handling other constructs a lot more messy, e.g.:
rex(maybe(two_words = list(letters, space, letters)))
It would imply more functions would need to understand named arguments -- this could still be feasible, but I am not sure.
I think I like this syntax -- it's more terse while still being clear -- but there may be edge cases in implementation that make it tricky.
That is a good point. It also would get messy with the rex functions that also take arguments. I think we keep the syntax as it is for now, while it would be a little nicer I don't think it is worth dealing with all of the edge cases and increased implementation complexity. Thanks for your comments!
Unnamed capturing would remain the same with
capture()
, however we could also allow you to specify named captures by naming an argument torex()
. e.g.I am not sure the second form is much easier than
@kevinushey any thoughts, do you think it is worth having?