Fix infinite loop in certain cases w/ unterminated tokens