Rewrite this function to go from left-to-right instead of right-to-left since this allows us to accumulate valid characters before encountering any invalid ones. This fixes parsing of strings emitted by GCC, like "1, %0|%0, %1}". :^)