JetTemplateParser parser = new JetTemplateParser(new CommonTokenStream(lexer));
parser.removeErrorListeners(); // remove ConsoleErrorListener
parser.addErrorListener(JetTemplateErrorListener.getInstance());
parser.setErrorHandler(new JetTemplateErrorStrategy());
TemplateContext templateParseTree = parser.template();
JetTemplateCodeVisitor visitor = new JetTemplateCodeVisitor(engine, engine.getVariableResolver(), engine.getSecurityManager(), parser, resource);
Code code = templateParseTree.accept(visitor);
return code.toString();
}