public Renderable compile(Class<?> page, Template template) { PageCompilingContext pc = new PageCompilingContext(); pc.page = page; pc.template = template; pc.lexicalScopes.push(new MvelEvaluatorCompiler(page)); WidgetChain widgetChain; widgetChain = walk(pc, HtmlParser.parse(template.getText())); // TODO - get the errors when !(isValid) if (!pc.errors.isEmpty() || !pc.warnings.isEmpty()) { // If there were any errors we must track them. metrics.logErrorsAndWarnings(page, pc.errors, pc.warnings); // Only explode if there are errors. if (!pc.errors.isEmpty()) throw new TemplateCompileException(page, template.getText(), pc.errors, pc.warnings); } return widgetChain; }