static int indexOfAnonymousClassInStruct(S s) { Pattern p = compileRegexp("\\$\\d"); Producer it = javaTokC_noMLS_iterator(s); S t; int idx = 0; while ((t = it.next()) != null) { if (isIdentifier(t) && regexpContains(p, t)) ret idx; idx += l(t); } ret -1; }