StringTemplateGroup templates = new StringTemplateGroup(new CharArrayReader(TEMPLATE));
ANTLRStringStream stream = new ANTLRStringStream(source);
stream.name = String.valueOf(mapper.map(file));
ES3InstrumentLexer lexer = new ES3InstrumentLexer(stream);
TokenRewriteStream tokens = new TokenRewriteStream(lexer);
ES3InstrumentParser parser = new ES3InstrumentParser(tokens);
parser.setTemplateLib(templates);
try {
parser.program();
} catch (RecognitionException e) {
throw new RuntimeException(e);
}
return tokens.toString();