Re: Finding unused hdf data

Nikolai Kondrashov <[email protected]> Mon, 13 Apr 2009 21:41:12 +0400
Newsgroups gmane.text.clearsilver.general
Message-ID <[email protected]>
David Jeske wrote:
> I understand now. We have run into this problem before. One of the
> disadvantages of clearsilver becoming a more full language, is that it's not
> possible to do this perfectly with static analysis. I think the impedement to
> static analysis is mostly the Strings[foo] syntax. That said, this doesn't get
> used very often for language variables.
I have opted for another approach. I simply read the file hdf_read_file and
traverse the whole HDF tree extracting values of the nodes marked with
"lang" attribute.  For runtime translatiion I do the same but replace these
values with their translation.

For templates I use similar approach: I parse them, then traverse the parse
tree, looking for "_" function calls, checking if their arguments are
(possibly concatenated) strings and extract them. This has its downside:
included sources get processed too.

Sincerely,
Nick