parse cases like a[b]->c[d]->e[f]->g;