MCPcopy Index your code
hub / github.com/antlr/codebuff / loadTemplateFile

Method loadTemplateFile

output/java8/1.4.19/STGroup.java:668–686  ·  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

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

Callers 2

importTemplatesMethod · 0.95

Calls 5

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

Tested by

no test coverage detected