Include line numbers in output

I'd like to add a new `lineNumberRange` field to the output which will be useful in another project I'm working on (https://github.com/joshwnj/inline-docs).
Thank you, I'll use that. Along the way I found (what I believe to be) some bugs in the `index` function, please review and let me know if you agree on the solution.  Bugs found and addressed:

- line 2 was being skipped (sequence was [0, 2, 3, ...]
- in the case of the final line not ending in a `\n` char, the final line would not be added to the index.