add parsing hooks

add some hooks in order to have fine-grained control over the parsing process.