// i must point at the (possibly imaginary) opening bracket (<) // index returned is index of closing bracket (>) static int tok_findEndOfAngleBracketPart(LS tok, int i) { int level = 1, j = i, level = 0, n = l(tok); while (j < n) { S t = tok.get(j); if (eq(t, "<")) ++level; else if (eq(t, ">")) --level; if (level == 0) ret j; j += 2; } ret n; }