Group parser events by whether they represent starts or ends
Remove key/string state "cleverness"
Keep the parser state in a loop variable