Improve parser function registration

Move code into hook handler so that dependencies can
be injected and the code more fully tested.

Change-Id: I6c754e5c2a5d92da113fea81496f6aeef0debeac
Merge "Improve parser function registration"