/* public class Main { public static void main(String args[]) throws Exception { BDF_Lexer lex = new BDF_Lexer( new ANTLRFileStream(args[0]) ); CommonTokenStream tokens = new CommonTokenStream(lex); BDF_Parser g = new BDF_Parser(tokens); try { g.bdf_file(); } catch (RecognitionException e) { e.printStackTrace(); } } } */ import java.io.*; import org.antlr.runtime.*; import org.antlr.stringtemplate.*; import org.antlr.stringtemplate.language.*; public class Main { public static StringTemplateGroup templates; public static void main(String[] args) throws Exception { String templateFileName; int a = 0; if ( args.length<=1 ) { templateFileName = "JMX_Templates.stg"; } else { templateFileName = args[a]; a++; } templates = new StringTemplateGroup(new FileReader(templateFileName), DefaultTemplateLexer.class ); CharStream input = new ANTLRFileStream(args[a]); BDF_Lexer lexer = new BDF_Lexer(input); CommonTokenStream tokens = new CommonTokenStream(lexer); BDF_Parser parser = new BDF_Parser(tokens); parser.setTemplateLib(templates); RuleReturnScope r = parser.bdf_file(); System.out.println(r.getTemplate()); } }