-
Notifications
You must be signed in to change notification settings - Fork 38
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
Add one_of
parser
#13
Comments
sorted(strings, key=len, reverse=True) And the name should indicate it works only for strings and that it is different from Off-topic, but I see that now @jneen's repo is marked as a fork of this one; any better way to do that than contacting GitHub support? |
@bugaevc - it would be difficult to add it into The motivations is that things like:
are common enough to want a shortcut like:
and secondly, the backtracking issue of:
which doesn't work as intended, can also benefit from something that gets the backtracking right. For the first case, I think we'd want a more efficient implementation that doesn't use I'm not convinced we need to make it more verbose by adding something into the name to indicate the type, especially if we have two different types that it can accept. Parsimmon has something very similar, only for strings: https://github.com/jneen/parsimmon/blob/master/API.md#parsimmononeofstring We could have two different functions, but then that would require two names, and I can't think of better ones. I think they are similar enough in purpose to benefit from being a single function. Regarding changing the root repo - it seems the only way is to contact GitHub support, they just need confirmation from the relevant people. |
Okay, so I've come the full circle from trying to write down the changes to But I'd still like a more descriptive name, how about |
How about |
@jneen that works well for multiple strings, not so good for
Maybe we could have |
I'd rather have the function accept
|
This is implemented now in PR #15 I implemented
|
Should accept either a string (which will be split into characters), or a list of strings.
The text was updated successfully, but these errors were encountered: