| 1019 | } |
| 1020 | |
| 1021 | static void parse_arginfo(bucket *a, char *args, int argslen) |
| 1022 | { |
| 1023 | char *p=args, *tmp; |
| 1024 | int i, redec=0; |
| 1025 | |
| 1026 | if (a->args >= 0) { |
| 1027 | if (a->args != argslen) |
| 1028 | error(rescan_lineno, 0, 0, "number of arguments of %s does't " |
| 1029 | "agree with previous declaration", a->name); |
| 1030 | redec = 1; } |
| 1031 | else { |
| 1032 | if (!(a->args = argslen)) return; |
| 1033 | if (!(a->argnames = NEW2(argslen, char *)) || |
| 1034 | !(a->argtags = NEW2(argslen, char *))) |
| 1035 | no_space(); } |
| 1036 | if (!args) return; |
| 1037 | for (i=0; i<argslen; i++) { |
| 1038 | while (isspace(*p)) if (*p++ == '\n') rescan_lineno++; |
| 1039 | if (*p++ != '$') bad_formals(); |
| 1040 | while (isspace(*p)) if (*p++ == '\n') rescan_lineno++; |
| 1041 | if (*p == '<') { |
| 1042 | havetags = 1; |
| 1043 | if (!(p = parse_id(p+1, &tmp))) bad_formals(); |
| 1044 | while (isspace(*p)) if (*p++ == '\n') rescan_lineno++; |
| 1045 | if (*p++ != '>') bad_formals(); |
| 1046 | if (redec) { |
| 1047 | if (a->argtags[i] != tmp) |
| 1048 | error(rescan_lineno, 0, 0, "type of argument %d to %s " |
| 1049 | "doesn't agree with previous declaration", i+1, |
| 1050 | a->name); } |
| 1051 | else |
| 1052 | a->argtags[i] = tmp; } |
| 1053 | else if (!redec) |
| 1054 | a->argtags[i] = 0; |
| 1055 | if (!(p = parse_id(p, &a->argnames[i]))) bad_formals(); |
| 1056 | while (isspace(*p)) if (*p++ == '\n') rescan_lineno++; |
| 1057 | if (*p++) bad_formals(); } |
| 1058 | free(args); |
| 1059 | } |
| 1060 | |
| 1061 | static char *compile_arg(char **theptr, char *yyvaltag) |
| 1062 | { |
no test coverage detected