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

Method loadTemplateFile

output/java/1.4.13/STGroup.java:656–674  ·  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

654 */
655
656 public CompiledST loadTemplateFile(String prefix, String unqualifiedFileName, CharStream templateStream) {
657 GroupLexer lexer = new GroupLexer(templateStream);
658 CommonTokenStream tokens = new CommonTokenStream(lexer);
659 GroupParser parser = new GroupParser(tokens);
660 parser.group = this;
661 lexer.group = this;
662 try {
663 parser.templateDef(prefix);
664 }
665 catch (RecognitionException re) {
666 errMgr.groupSyntaxError(ErrorType.SYNTAX_ERROR, unqualifiedFileName, re, re.getMessage());
667 }
668
669 String templateName = Misc.getFileNameNoSuffix(unqualifiedFileName);
670 if ( prefix!=null && prefix.length()>0 ) templateName = prefix+templateName;
671 CompiledST impl = rawGetTemplate(templateName);
672 impl.prefix = prefix;
673 return impl;
674 }
675
676 /**
677 * 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