Bug 1022859 - Factorize parser into a class. r=stas