-
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
Weird bind implementation? #33
Comments
Related: I seem to have to define wrap something like the following to get backtracking to work?
What's the correct way to do this? |
@jneen do you have any input on this? I've never actually used |
Ok, this makes more sense when used like in #36 (comment) , I need to revisit this later. |
I'm not sure what you're trying to do, could you explain in a little more detail? The "pseudocode" example you gave passes a |
Oh, I think I see what's happening. You are mixing strings and tokens, and want to "re-parse" the parse result when it's not a token. I... would suggest just tokenizing your entire input before passing it to parsy if that's the direction you want to go. |
If you are really dedicated to this approach you might want to define something like: def reparse(parser):
return test_item(lambda x: isinstance(x, unicode), 'not a string').map(parser.parse) |
@spookylukey for reference, parser = first.bind(second)
@generate
def parser():
res = yield first
return (yield second(res)) |
Hi, thanks for making parsy, I like it!
I'm currently succeeding at shooting myself in the foot with heterogeneous inputs, because I want to be able to process a list of "symbols" and strings:
I'm probably not understanding something, why do I need to use
.bind
like this?:instead of: (the following is pseudocode)
Which is to say, why do I have to add an extra layer of wrapping and calling
.parse
?The text was updated successfully, but these errors were encountered: