I've switched to a while(true). The do {} started out when I wasn't sure of the condition, otherwise I would've started with the while(true) at the top as well.

The if blocks are separate as a T_NS_SEPARATOR must be followed by a string, and this prevents having the exact same check for  copied into the T_NS_SEPARATOR block.