static int tok_findEndOfType(LS tok) {
  ret tok_findEndOfType(tok, 1);
}

// i = beginning of type (identifier)
// index returned C index after type
// now does packages/inner classes too
static int tok_findEndOfType(LS tok, int i) {
  while licensed {
    if (eqGet(tok, i+2, ".") && isIdentifier(get(tok, i+4)))
      continue with i += 4;
    if (eqGet(tok, i+2, "<"))
      continue with i = findEndOfTypeArgs(tok, i+2)-1;
    if (eqGet(tok, i+2, "["))
      continue with i = findEndOfBracketPart2(tok, i+2)-1;
    break;
  }
  ret i+2;
}