openbibleinfo/Bible-Passage-Reference-Parser — pull request #3 by simoncozens (2013-08-22 06:02:10+00:00)
Title: A couple of useful iterators.

This gives ways to traverse the result set - `verse_iterator` is designed for situations when you're just normally iterating over the verse set; `contiguous_verse_range_iterator` may look a bit strange, but it turns out to be very useful for retrieval of chunks of Bible passage at a time. e.g.:

```sql
SELECT * FROM bible WHERE (book = "John" AND chapter = 1 AND verse >= 13 AND verse <= 16)
OR (book = ...)
```

Philosophically one might argue that this isn't within the remit of a *parser* per se, but the parser already knows critical information about e.g. the lengths of chapters within the translations being used by the reference, and therefore is in a better position to do this than any other piece of code. If we were going for extreme modularity, we'd uncouple the book information from the parsing system, but it doesn't look like we are, so here it is.