Parsing state from a string