[stringtemplate-interest] Listing of used Attributes (@Caleb)
Terence Parr
parrt at cs.usfca.edu
Wed Jul 11 18:49:06 PDT 2007
On Jul 10, 2007, at 10:12 PM, Dreyer Ulf (CR/APA3) wrote:
> template applications would probably be difficult with added
> listeners:
I just meant for debugging.
>
> Examble:
> SomeTemplate() ::= << <it.foo> and <it.bar> >>
>
> [...]
> <someList:someTemplate()>
>
> In this case if we someList is empty (because we just want to find
> out about
> used attributes) someTemplate will not be executed and someList
> [].foo/.bar will
> not be "found", am I right?
correct. They were not accessed. Do you want the static list? I
think i have some stuff in there now for that.
> I slappted together a parser (handwritten but one could probably
> use a treeparser)
> which analyses the AST of all actions.
> There are some problems with recursion and anonymous templates are
> not implemented
> but it produces a tree wich looks like this for the above example:
> [...]
> |
> +someList
> |someList.foo
> +someList.bar
>
> Now I can analyse any stringTemplate and get a suggestion of what
> a datastructure
> fed to the top-template should look like.
Cool. I think I have some recursive method that walks ST expression
trees and answers this, but it can't do dynamically computed
attribute names.
Ter
More information about the stringtemplate-interest
mailing list