Re: partial evaluation / removing directives

Alex Fedotov <[email protected]>
Newsgroups gmane.comp.jakarta.velocity.user
Message-ID <CAHKxnLEJoWfLXkGOg7YZ6FJG4vi3L_OAnKJoiJnnoMTOCuGtfQ@mail.gmail.com>
Well, I did not get into the details, but the idea would be to replace the
ASTIfStatement with a sequence of AST nodes that would output the "#IF"
text followed by the result of rewriting the children, etc. followed by the
"#END" text.
I think the SimpleNode does not have a particularly friendly public
interface to facilitate this kind of thing. I remember I had to resort to
using reflection and accessing protected/private members directly.

Alex


As for the AST rewrite idea, if it was possible to "Burn down" nodes to
> their corresponding text something like that would work, However, wouldnt'
> that then possibly miss additional child elements in that AST tree? For
> instance a clause in an if statement which had a resourceBundle reference?
>  I'm not too familiar with ASTs (been years since I dealt with those at
> school), maybe I can look at it a bit more today.
>
> thanks,
> Pete
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.