boostorg / spirit

Boost.org spirit module
http://boost.org/libs/spirit
394 stars 162 forks source link

line_pos_iterator on-top of bidirectional-iterators #756

Closed tobias-loew closed 1 year ago

tobias-loew commented 1 year ago

I came over line_pos_iterator and really liked the example from https://stackoverflow.com/questions/19612657/boostspirit-access-position-iterator-from-semantic-actions. The only problem, finding the line-start is linear in the input, which is a burden for large inputs. But when the iterator is bidirectional, finding the line-start can be implemented linear to the average line-length.

djowel commented 1 year ago

Nice!

djowel commented 1 year ago

Wouldn't it be nice to have this incorporated into the original line_pos_iterator and just switch to the code depending on iterator type? That's kinda what I was expecting.

tobias-loew commented 1 year ago

I'm on it.

tobias-loew commented 1 year ago

Almost three years no change on this file and then two within a day. Wow! I closed this PR and opened a new one https://github.com/boostorg/spirit/pull/757