I don't get it. 

why would endOfToken not be i ? 

Also, this uses knowledge of the placeholder scheme (== "?") outside of the dialect, which seems suspicious.