findConstructEnd
Where the construct starting at i ends, or i itself if nothing starts there.
The return is the index of the construct's last character, so a caller resuming at findConstructEnd(sql, i) + 1 lands on the first character after it and a return of i means "ordinary character, deal with it yourself".
Throws
UNCLOSED_TOKEN where a quote, dollar quote or block comment opens and never closes. A -- comment running to the end of the text is not that: it has no terminator to be missing.