310 |
add_lookback_edge (int stateno, int ruleno, int gotono) |
add_lookback_edge (int stateno, int ruleno, int gotono) |
311 |
{ |
{ |
312 |
int i; |
int i; |
|
int k; |
|
|
int found; |
|
313 |
shorts *sp; |
shorts *sp; |
314 |
|
|
315 |
i = state_table[stateno]->lookaheadsp; |
for (i = 0; i < state_table[stateno]->nlookaheads; ++i) |
316 |
k = state_table[stateno + 1]->lookaheadsp; |
if (LAruleno[state_table[stateno]->lookaheadsp + i] == ruleno) |
317 |
found = 0; |
break; |
|
while (!found && i < k) |
|
|
{ |
|
|
if (LAruleno[i] == ruleno) |
|
|
found = 1; |
|
|
else |
|
|
i++; |
|
|
} |
|
318 |
|
|
319 |
assert (found); |
assert (LAruleno[state_table[stateno]->lookaheadsp + i] == ruleno); |
320 |
|
|
321 |
sp = XCALLOC (shorts, 1); |
sp = XCALLOC (shorts, 1); |
322 |
sp->next = lookback[i]; |
sp->next = lookback[state_table[stateno]->lookaheadsp + i]; |
323 |
sp->value = gotono; |
sp->value = gotono; |
324 |
lookback[i] = sp; |
lookback[state_table[stateno]->lookaheadsp + i] = sp; |
325 |
} |
} |
326 |
|
|
327 |
|
|