Skip to content
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

Ability to reset peek in MultiPeek #180

Closed
zbraniecki opened this issue Dec 23, 2016 · 1 comment
Closed

Ability to reset peek in MultiPeek #180

zbraniecki opened this issue Dec 23, 2016 · 1 comment

Comments

@zbraniecki
Copy link

While working on a parser, I encountered a case where I'm inside a function trying to determine if I should bail out or not depending on the next two characters.

MultiPeek allows me to do just that, but when I get back into the main function, I can't reason about the state of the iterator.

The next peek may be the iterator position +1, or +3 depending on how I got to that place.

What I think I'd like to see is the ability to "reset" my peek back to 0 so that the next peek will look up just one item ahead of the position.

Is that doable?

@bluss
Copy link
Member

bluss commented Dec 23, 2016

Yes, that looks simple to do, just reset its internal index.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants