/** * Make this group import templates/dictionaries from {@code g}. *<p> * On unload imported templates are unloaded but stay in the {@link #imports} list.</p> */ public void importTemplates(STGroup g) { importTemplates(g, false); }
/** * Make this group import templates/dictionaries from {@code g}. *<p> * On unload imported templates are unloaded but stay in the {@link #imports} list.</p> */ public void importTemplates(STGroup g) { importTemplates(g, false); }
/** * Make this group import templates/dictionaries from {@code g}. *<p> * On unload imported templates are unloaded but stay in the {@link #imports} list.</p> */ public void importTemplates(STGroup g) { importTemplates(g, false); }
/** * Make this group import templates/dictionaries from {@code g}. *<p> * On unload imported templates are unloaded but stay in the {@link #imports} list.</p> */ public void importTemplates(STGroup g) { importTemplates(g, false); }
/** * Make this group import templates/dictionaries from {@code g}. *<p> * On unload imported templates are unloaded but stay in the {@link #imports} list.</p> */ public void importTemplates(STGroup g) { importTemplates(g, false); }
/** * Make this group import templates/dictionaries from {@code g}. *<p> * On unload imported templates are unloaded but stay in the {@link #imports} list.</p> */ public void importTemplates(STGroup g) { importTemplates(g, false); }
/** * Make this group import templates/dictionaries from {@code g}. *<p> * On unload imported templates are unloaded but stay in the {@link #imports} list.</p> */ public void importTemplates(STGroup g) { importTemplates(g, false); }
protected STGroup getTemplateGroup(Iterable<String> templateFileNames) throws IOException { if (stg == null) { // Convert set of relative paths to .st files into a set of input suppliers Iterable<CharSource> templateInputSuppliers = Iterables.transform(templateFileNames, FILE_TO_INPUT_SUPPLIER_TRANSFORM); // Combine the header and all .st files and load everything into a StringTemplateGroup stg = new STGroup(); stg.setListener(ERROR_LISTENER); for (String templateFileName : templateFileNames) { stg.importTemplates(getTemplateGroupFromFile(templateFileName)); } for (Map.Entry<Class<?>, ? extends AttributeRenderer> entry : attributeRenderers.entrySet()) { Class<?> cls = entry.getKey(); AttributeRenderer renderer = entry.getValue(); stg.registerRenderer(cls, renderer); } } return stg; }
if ( debug && grammar.type!=Grammar.LEXER ) { STGroup dbgTemplates = new ToolSTGroupFile(langDir+"/Dbg.stg"); dbgTemplates.importTemplates(coreTemplates); baseTemplates = dbgTemplates; STGroup astTemplates = new ToolSTGroupFile(langDir+"/AST.stg"); astTemplates.importTemplates(dbgTemplates); STGroup astParserTemplates; if ( grammar.type==Grammar.TREE_PARSER ) { astParserTemplates = new ToolSTGroupFile(langDir+"/ASTTreeParser.stg"); astParserTemplates.importTemplates(astTemplates); astParserTemplates.importTemplates(astTemplates); astDbgTemplates.importTemplates(astParserTemplates); templates = astDbgTemplates; dbgTemplates.iterateAcrossValues = true; // ST v3 compatibility with Maps astTemplates.importTemplates(coreTemplates); STGroup astParserTemplates; if ( grammar.type==Grammar.TREE_PARSER ) { astParserTemplates = new ToolSTGroupFile(langDir+"/ASTTreeParser.stg"); astParserTemplates.importTemplates(astTemplates); astParserTemplates.importTemplates(astTemplates); if ( debug && grammar.type!=Grammar.LEXER ) { STGroup dbgTemplates = new ToolSTGroupFile(langDir+"/Dbg.stg"); dbgTemplates.importTemplates(coreTemplates); baseTemplates = dbgTemplates;
if ( debug && grammar.type!=Grammar.LEXER ) { STGroup dbgTemplates = new ToolSTGroupFile(langDir+"/Dbg.stg"); dbgTemplates.importTemplates(coreTemplates); baseTemplates = dbgTemplates; STGroup astTemplates = new ToolSTGroupFile(langDir+"/AST.stg"); astTemplates.importTemplates(dbgTemplates); STGroup astParserTemplates; if ( grammar.type==Grammar.TREE_PARSER ) { astParserTemplates = new ToolSTGroupFile(langDir+"/ASTTreeParser.stg"); astParserTemplates.importTemplates(astTemplates); astParserTemplates.importTemplates(astTemplates); astDbgTemplates.importTemplates(astParserTemplates); templates = astDbgTemplates; dbgTemplates.iterateAcrossValues = true; // ST v3 compatibility with Maps astTemplates.importTemplates(coreTemplates); STGroup astParserTemplates; if ( grammar.type==Grammar.TREE_PARSER ) { astParserTemplates = new ToolSTGroupFile(langDir+"/ASTTreeParser.stg"); astParserTemplates.importTemplates(astTemplates); astParserTemplates.importTemplates(astTemplates); if ( debug && grammar.type!=Grammar.LEXER ) { STGroup dbgTemplates = new ToolSTGroupFile(langDir+"/Dbg.stg"); dbgTemplates.importTemplates(coreTemplates); baseTemplates = dbgTemplates;
private void importLanguageTemplates(STGroup testGroup, STGroup languageGroup) { // make sure the test group is loaded testGroup.load(); if (testGroup == languageGroup) { assert false : "Attempted to import the language group into itself."; return; } if (testGroup.getImportedGroups().isEmpty()) { testGroup.importTemplates(languageGroup); return; } if (testGroup.getImportedGroups().contains(languageGroup)) { return; } for (STGroup importedGroup : testGroup.getImportedGroups()) { importLanguageTemplates(importedGroup, languageGroup); } }
group.importTemplates(STRING1);
group.importTemplates(STRING1);
group.importTemplates(STRING1);
importTemplates(g, true);
importTemplates(g, true);