Esempio n. 1
0
 /** Load template stream into this group */
 public CompiledST loadTemplateFile(String prefix, String fileName, CharStream templateStream) {
   GroupLexer lexer = new GroupLexer(templateStream);
   CommonTokenStream tokens = new CommonTokenStream(lexer);
   GroupParser parser = new GroupParser(tokens);
   parser.group = this;
   lexer.group = this;
   try {
     parser.templateDef(prefix);
   } catch (RecognitionException re) {
     errMgr.groupSyntaxError(ErrorType.SYNTAX_ERROR, fileName, re, re.getMessage());
   }
   String templateName = Misc.getFileNameNoSuffix(fileName);
   if (prefix != null && prefix.length() > 0) templateName = prefix + "/" + templateName;
   return rawGetTemplate(templateName);
 }
Esempio n. 2
0
 /** Load a group file with full path fileName; it's relative to root by prefix. */
 public void loadGroupFile(String prefix, String fileName) {
   // System.out.println("load group file prefix="+prefix+", fileName="+fileName);
   GroupParser parser = null;
   try {
     URL f = new URL(fileName);
     ANTLRInputStream fs = new ANTLRInputStream(f.openStream(), encoding);
     GroupLexer lexer = new GroupLexer(fs);
     fs.name = fileName;
     CommonTokenStream tokens = new CommonTokenStream(lexer);
     parser = new GroupParser(tokens);
     parser.group(this, prefix);
   } catch (Exception e) {
     errMgr.IOError(null, ErrorType.CANT_LOAD_GROUP_FILE, e, fileName);
   }
 }