68 |
static void |
static void |
69 |
allocate_itemsets (void) |
allocate_itemsets (void) |
70 |
{ |
{ |
71 |
int i; |
int i, r; |
72 |
|
short *rhsp; |
73 |
|
|
74 |
/* Count the number of occurrences of all the symbols in RITEMS. |
/* Count the number of occurrences of all the symbols in RITEMS. |
75 |
Note that useless productions (hence useless nonterminals) are |
Note that useless productions (hence useless nonterminals) are |
78 |
int count = 0; |
int count = 0; |
79 |
short *symbol_count = XCALLOC (short, nsyms + nuseless_nonterminals); |
short *symbol_count = XCALLOC (short, nsyms + nuseless_nonterminals); |
80 |
|
|
81 |
for (i = 0; i < nritems; ++i) |
for (r = 1; r < nrules + 1; ++r) |
82 |
if (ritem[i] >= 0) |
for (rhsp = rules[r].rhs; *rhsp >= 0; ++rhsp) |
83 |
{ |
{ |
84 |
count++; |
count++; |
85 |
symbol_count[ritem[i]]++; |
symbol_count[*rhsp]++; |
86 |
} |
} |
87 |
|
|
88 |
/* See comments before new_itemsets. All the vectors of items |
/* See comments before new_itemsets. All the vectors of items |