improve "while" loop parsing