Date: Mon, 29 Jun 1998 16:36:47 +0200 From: Matthias Meixner Organization: TH Darmstadt, Mikroelektronische Systeme While using your version of BTYacc (V2.1), I have found a bug. It does not correctly handle typenames, if one typename is a prefix of another one and if this type is used after the longer one. In this case BTYacc produces invalid code. e.g. in: -------
| 683 | // b: A {$$=$1;} |
| 684 | // |
| 685 | static char *cache_tag(char *tag, int len) |
| 686 | { |
| 687 | int i; |
| 688 | char *s; |
| 689 | |
| 690 | for (i = 0; i < ntags; ++i) { |
| 691 | if (strncmp(tag, tag_table[i], len) == 0 && |
| 692 | // VM: this is bug fix proposed by Matthias Meixner |
| 693 | tag_table[i][len]==0) |
| 694 | return (tag_table[i]); } |
| 695 | if (ntags >= tagmax) { |
| 696 | tagmax += 16; |
| 697 | tag_table = tag_table ? RENEW(tag_table, tagmax, char *) |
| 698 | : NEW2(tagmax, char *); |
| 699 | if (tag_table == 0) no_space(); } |
| 700 | s = MALLOC(len + 1); |
| 701 | if (s == 0) no_space(); |
| 702 | strncpy(s, tag, len); |
| 703 | s[len] = 0; |
| 704 | tag_table[ntags++] = s; |
| 705 | return s; |
| 706 | } |
| 707 | |
| 708 | char *get_tag() |
| 709 | { |