Hi,

I was looking into the issue of including macros via the #parse
method.  Following is the my understanding of the problem. The main
reason that causes this to be a hard problem to solve without touching
the parser implementation is described below.

At the moment when the parser encounter a call to a macro i.e.
#foo(123) it looks weather a macro definition exists via the runtime
system. If a definition exists everything is going well. This happens
in the AST building face of the parser (not in the rendering face). So
this means with the current implementation, the macros must be
registered with the runtime system before a call occurs and this is
the cause of all the troubles.

Now this is the problem with #parse directive. #parse directive builds
the AST of the files and render them at the same time. This happens
when the main template that include the #parse directive get rendered.
But when this happens, AST of the template that include the #parse
directive is been built already. But the macro calls that are in the
main template get invalidated because at the moment AST is built
macros are not registered with the runtime system.

As I can see the solution for this problem is, parser should not look
into the runtime system to determine weather a directive like #foo()
is a macro call or not. Instead parser should look ahead for the '('
token  when it encounters something like #foo to deside weather it is
a macro call or not.

I would like to know weather this is solvable without breaking the
current system in the way that I have decribed above?

Regards,
Supun.

P.S. If we can do this my first implementation of 'including macros
programmatically' can be done using this method.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to