[stringtemplate-interest] Problems migrating v3 template group inheritance to v4

Terence Parr parrt at cs.usfca.edu
Wed Nov 2 16:37:46 PDT 2011


Interesting.  Can you send me directly a simple example that fails with STGroupDir but not with STGroupFile? I will convert it to a unit test and try out.
Ter

On Nov 2, 2011, at 7:07 AM, Balazs Varnai wrote:

> Hi.
> 
> Well, I checked the unit tests. Those are only using the STGroupFile class for testing the import facility. I replaced STGroupDir with STGroupFile, now it works. But I still wonder, is this intentional?
> For me it was natural to start with STGroupDir when having a directory with .stg files and import within the directory. Maybe I was wrong...
> 
> Thanks!
> 
> B
> 
> 
> On Mon, Oct 31, 2011 at 5:52 PM, Terence Parr <parrt at cs.usfca.edu> wrote:
> Hi. Are you saying that you want to import template container and reference it from the subgroup template container? If so, I think something like super.container() is needed.
> Ter
> On Oct 26, 2011, at 3:55 AM, Balazs Varnai wrote:
> 
> > Hi All,
> >
> > I'm updating my project to v4. The goal is to minimize the changes in template structure, but I got stuck with inheritance. Any help would be appreciated. Thanks!
> >
> > So the setup with inheritance:
> >
> > CContainerDef.stg (in v3: group CContainerDef : CModuleDef)
> > CEnumerationParamDef.stg (in v3: group CEnumerationParamDef : CContainerDef)
> > CModuleDef.stg
> > ...
> >
> > It's running inside an Eclipse bundle, so I created a STGroup subclass. Same as STGroupDir, just using bundle URLs. I updated the templates with "import"
> >
> > CContainerDef.stg
> >
> > import "CModuleDef.stg"
> >
> > Templates from 'CContainerDef'  are loaded as '/CContainerDef/<template>, I guess it's parent<>template relationship. I have a template 'container' in 'CModuleDef', so after import it should be available in 'CContainerDef'. ST sees it's not available and tries to load it as '/CContainerDef/container'. Ends up loading itself again?? This is done without looking at the imported stg. Maybe I am completely misunderstanding the template group concept.
> >
> > B
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > _______________________________________________
> > stringtemplate-interest mailing list
> > stringtemplate-interest at antlr.org
> > http://www.antlr.org/mailman/listinfo/stringtemplate-interest
> 
> _______________________________________________
> stringtemplate-interest mailing list
> stringtemplate-interest at antlr.org
> http://www.antlr.org/mailman/listinfo/stringtemplate-interest
> 
> _______________________________________________
> stringtemplate-interest mailing list
> stringtemplate-interest at antlr.org
> http://www.antlr.org/mailman/listinfo/stringtemplate-interest



More information about the stringtemplate-interest mailing list