recursion in string parsing