hpacucly: Making parsing code more generic

Some code was duplicated between two functions, let's make it common