It's simpler because you combine the related mutually exclusive conditions in if-else structure. Also, there is no point in checking token[0] again if it enters the first if. 

There is a typo in my suggestion. It should have been else if($token[0] == '}')