Antlr4.StringTemplate.TemplateGroup.ImportTemplates C# (CSharp) Method

ImportTemplates() public method

public ImportTemplates ( TemplateGroup g ) : void
g TemplateGroup
return void
        public virtual void ImportTemplates(TemplateGroup g)
        {
            ImportTemplates(g, false);
        }

Same methods

TemplateGroup::ImportTemplates ( IToken fileNameToken ) : void
TemplateGroup::ImportTemplates ( TemplateGroup group, bool clearOnUnload ) : void

Usage Example

        protected TemplateGroup GetTemplateGroup(List<string> templateNames)
        {
            if (tg == null)
            {
                // combile the header and all .st files and load everything into a TemplateGroup
                tg = new TemplateGroup();
                foreach (var templateName in templateNames)
                {
                    tg.ImportTemplates(GetTemplateGroupFromResource(templateName));
                }
                foreach (var type in attributeRenderers.Keys)
                {
                    var renderer = attributeRenderers[type];
                    tg.RegisterRenderer(type, renderer);
                }
            }

            return tg;
        }