When I started work on the handlers, I figured I could get maybe three-quarters of the code for Triggers and Verbatims shared through the generic Handler, and maybe half of what Tags would need, and perhaps one-quarter of Text chunks.
As it turns out, with not much effort, and very little in the way of redundancy or special-casing, 100% of the code for Triggers, Verbatims, and Tags is shared. Their modules are bare subclasses of the Handler superclass. The empty modules are still neccessary, though, because of the handful of places where the shared code does behave differently based on what class it's executing as (and it leaves a clean, clear maintenance path for when I start finding the things I've missed and the second, customized parsing stage becomes neccessary).
So all my careful work in designing that two-stage parsing pass was either wasted or wildly successful, depending on your point of view :)
The Text handler does actually get rewritten methods -- two of them -- and one unique to itself, but it's far simpler than the other handlers, so the loccount for these additions will still be under 50, I think.
All the handlers except Text are testing clean right now as well. Handler.pm's coverage is up to 91% overall. In a scarily short time, it will be time to lash the handlers to the Grammarian (which is really to say: to the DOM).
No comments:
Post a Comment