2012/7/7 Giovanni Giacobbi <
giova...@gmail.com>:
> Anyway, I ran into a sort of design limitation. My grammar describe a simple
> template parser, the problem is that I would like to isolate everything in
> the grammar file, and have a full template engine in that file.
>
> This translates to a very simple requirement: being able to export a
> function to the public interface of the parser, which now contains only
> parse().
Parsers should just parse, period :-) Extending their interface in any
way beyond this is a violation of the single responsibility principle.
I won't add such a feature.
The correct approach is to include your parser into the object
providing the additional functionality (i.e. use composition). If you
target Node.js you can do it easily using modules, if not, there are
other ways.
--
David Majda
Entropy fighter
http://majda.cz/