in reply to Parsing bracket formatted file
You do not explain, where your trouble is.
Anyways - recursion is fine.
Would be eventually good to break the recursion into opening code (recognizing the key)
and the value. Which can obviously be again key and value.
This way you are able to handle line for line.
And pass only references, passing the whole scalar could be resource consuming.