+ /* skip commas */
+
+ if (*str == ',') {
+ if (root == NULL) {
+ return ERROR_OP;
+ } else if (root->func != Set) {
+ new = newelement (Set, MAX_OPERANDS);
+ new->ops[0] = root;
+ root = new;
+ }
+ str++;
+ continue;
+ }
+
+ /* check for parent */
+
+ if (*str == ')') {
+ if (next != NULL) {
+ *next = str + 1;
+ }
+ return root;
+ }
+ if (*str == '(') {
+ new = parser (str + 1, &str);
+ if (new == (void *)(-1)) {
+ return new;
+ }
+ if (root) {
+ for (i = 0, j = 0; i < root->nbops; i++) {
+ if (root->ops[i] == NULL) {
+ if (new->func == Set) {
+ root->ops[i] = new->ops[j++];
+ if (new->ops[j] == NULL) {
+ found = 1;
+ break;
+ }
+ } else {
+ root->ops[i] = new;
+ found = 1;
+ break;
+ }
+ }
+ }
+ if (!found) {
+ return ERROR_OP;
+ }
+ } else {
+ return root;
+ }
+ }
+