ansi codes: add support for multiple sgr classes

Add some unit tests and factorize for potencial reuse

nine plan is to reuse the regex and overall idea, but probably
rewrite this client side.

Signed-off-by: Pierre Tardy <pierre.tardy@intel.com>