- }
- if (p != nil) {
- suberror("too many subscripts for ", a, nil);
- } else if (t != nil) {
- suberror("not enough subscripts for ", a, nil);
- }
- } else {
- suberror("\"", a, "\" is not an array");
+ while (p != nil and t != nil) {
+ esub = p->value.arg[0];
+ if (not compatible(rtype(t), rtype(esub->nodetype))) {
+ suberror("subscript \"", esub, "\" is the wrong type");
+ }
+ r = build(O_INDEX, r, esub);
+ r->nodetype = eltype;
+ p = p->value.arg[1];
+ t = t->chain;
+ }
+ if (p != nil) {
+ suberror("too many subscripts for ", a, nil);
+ } else if (t != nil) {
+ suberror("not enough subscripts for ", a, nil);
+ }
+ break;
+
+ default:
+ suberror("\"", a, "\" is not an array");
+ break;