LPeter1997 / CppCmb

A generic C++17 parser-combinator library with a natural grammar notation.
MIT License
122 stars 8 forks source link

InputIterator? #3

Closed ColinH closed 5 years ago

ColinH commented 5 years ago

The documentation says that CppCmb works on an InputIterator for tokens, but I'm wondering, don't you actually require a ForwardIterator (that allows you to perform backtracking)?

For example consider something with a structure like alt< seq< one, one, one >, one > with an input of two tokens, where you are effectively backtracking to let the second branch of the alt start at the same position as the first...

LPeter1997 commented 5 years ago

Yes, you are right. I forgot that InputIterator does not guarantee multiple passes. Thank you for the contribution!