Combined the two escape sequence parsing functions into one with a flag.