// Use the longest match attempted match to generate an error message
Candidate best = resolver.getBestAttempt();
int exprIdx = null != best ? best.exprIdx : 0;
StringBuilder buf = new StringBuilder();
TokenConsumer tc = new CssPrettyPrinter(buf);
RenderContext rc = new RenderContext(tc);
boolean needsSpace = false;
int k = 0;
for (CssTree child : expr.children()) {
if (needsSpace) {
buf.append(' ');
}
int len = buf.length();
if (k++ == exprIdx) {
buf.append(" ==>");
child.render(rc);
tc.noMoreTokens();
buf.append("<== ");
} else {
child.render(rc);
}
needsSpace = (len < buf.length());