I did learn that, while Kotlin's `sequence` utility is very cool, it is *not* just a sequential Iterator! They can actually be executed multiple times, which caused some really weird bugs in my parser.
Good news: there's an `iterator` function that is! https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.sequences/iterator.html
I'm using this to effectively parse the document *during* iteration - so the implementer can do an early return or discard extra nodes without parsing the entire file.
(I'm sure other parsers already do this with far more efficiency - I'm just reinventing wheels for fun!)
A group of individual developers and enthusiasts with a focus on independent services, software, and technology.