MCPcopy Create free account
hub / github.com/antlr/codebuff / loadTemplateFile

Method loadTemplateFile

output/java/1.4.14/STGroup.java:669–687  ·  view source on GitHub ↗

Load template stream into this group. unqualifiedFileName is "a.st". The prefix is path from group root to unqualifiedFileName like "/subdir" if file is in /subdir/a.st.

(String prefix, String unqualifiedFileName, CharStream templateStream)

Source from the content-addressed store, hash-verified

667 */
668
669 public CompiledST loadTemplateFile(String prefix, String unqualifiedFileName, CharStream templateStream) {
670 GroupLexer lexer = new GroupLexer(templateStream);
671 CommonTokenStream tokens = new CommonTokenStream(lexer);
672 GroupParser parser = new GroupParser(tokens);
673 parser.group = this;
674 lexer.group = this;
675 try {
676 parser.templateDef(prefix);
677 }
678 catch (RecognitionException re) {
679 errMgr.groupSyntaxError(ErrorType.SYNTAX_ERROR, unqualifiedFileName, re, re.getMessage());
680 }
681
682 String templateName = Misc.getFileNameNoSuffix(unqualifiedFileName);
683 if ( prefix !=null && prefix.length()>0 ) templateName = prefix+templateName;
684 CompiledST impl = rawGetTemplate(templateName);
685 impl.prefix = prefix;
686 return impl;
687 }
688
689 /**
690 * Add an adaptor for a kind of object so ST knows how to pull properties

Callers 1

Calls 5

getFileNameNoSuffixMethod · 0.95
groupSyntaxErrorMethod · 0.45
getMessageMethod · 0.45
lengthMethod · 0.45
rawGetTemplateMethod · 0.45

Tested by

no test coverage detected