1 |
/* Print information on generated parser, for bison, |
/* Print information on generated parser, for bison, |
2 |
Copyright 1984, 1986, 1989, 2000, 2001, 2002 Free Software Foundation, Inc. |
Copyright (C) 1984, 1986, 1989, 2000, 2001, 2002 |
3 |
|
Free Software Foundation, Inc. |
4 |
|
|
5 |
This file is part of Bison, the GNU Compiler Compiler. |
This file is part of Bison, the GNU Compiler Compiler. |
6 |
|
|
214 |
|
|
215 |
if (state->nlookaheads == 1 && !nodefault) |
if (state->nlookaheads == 1 && !nodefault) |
216 |
{ |
{ |
217 |
int default_rule = LAruleno[state->lookaheadsp]; |
rule_t *default_rule = LArule[state->lookaheadsp]; |
218 |
|
|
219 |
bitset_and (lookaheadset, LA[state->lookaheadsp], shiftset); |
bitset_and (lookaheadset, LA[state->lookaheadsp], shiftset); |
220 |
|
|
221 |
for (i = 0; i < ntokens; i++) |
for (i = 0; i < ntokens; i++) |
222 |
if (bitset_test (lookaheadset, i)) |
if (bitset_test (lookaheadset, i)) |
223 |
fprintf (out, _(" %-4s\t[reduce using rule %d (%s)]\n"), |
fprintf (out, _(" %-4s\t[reduce using rule %d (%s)]\n"), |
224 |
escape (symbols[i]->tag), default_rule - 1, |
escape (symbols[i]->tag), |
225 |
escape2 (rules[default_rule].lhs->tag)); |
default_rule->number - 1, |
226 |
|
escape2 (default_rule->lhs->tag)); |
227 |
|
|
228 |
fprintf (out, _(" $default\treduce using rule %d (%s)\n\n"), |
fprintf (out, _(" $default\treduce using rule %d (%s)\n\n"), |
229 |
default_rule - 1, escape (rules[default_rule].lhs->tag)); |
default_rule->number - 1, |
230 |
|
escape (default_rule->lhs->tag)); |
231 |
} |
} |
232 |
else if (state->nlookaheads >= 1) |
else if (state->nlookaheads >= 1) |
233 |
{ |
{ |
234 |
int cmax = 0; |
int cmax = 0; |
235 |
int default_LA = -1; |
int default_LA = -1; |
236 |
int default_rule = 0; |
rule_t *default_rule = NULL; |
237 |
|
|
238 |
if (!nodefault) |
if (!nodefault) |
239 |
for (i = 0; i < state->nlookaheads; ++i) |
for (i = 0; i < state->nlookaheads; ++i) |
251 |
{ |
{ |
252 |
cmax = count; |
cmax = count; |
253 |
default_LA = state->lookaheadsp + i; |
default_LA = state->lookaheadsp + i; |
254 |
default_rule = LAruleno[state->lookaheadsp + i]; |
default_rule = LArule[state->lookaheadsp + i]; |
255 |
} |
} |
256 |
|
|
257 |
bitset_or (shiftset, shiftset, lookaheadset); |
bitset_or (shiftset, shiftset, lookaheadset); |
278 |
fprintf (out, |
fprintf (out, |
279 |
_(" %-4s\treduce using rule %d (%s)\n"), |
_(" %-4s\treduce using rule %d (%s)\n"), |
280 |
escape (symbols[i]->tag), |
escape (symbols[i]->tag), |
281 |
LAruleno[state->lookaheadsp + j] - 1, |
LArule[state->lookaheadsp + j]->number - 1, |
282 |
escape2 (rules[LAruleno[state->lookaheadsp + j]].lhs->tag)); |
escape2 (LArule[state->lookaheadsp + j]->lhs->tag)); |
283 |
else |
else |
284 |
defaulted = 1; |
defaulted = 1; |
285 |
|
|
291 |
fprintf (out, |
fprintf (out, |
292 |
_(" %-4s\treduce using rule %d (%s)\n"), |
_(" %-4s\treduce using rule %d (%s)\n"), |
293 |
escape (symbols[i]->tag), |
escape (symbols[i]->tag), |
294 |
LAruleno[default_LA] - 1, |
LArule[default_LA]->number - 1, |
295 |
escape2 (rules[LAruleno[default_LA]].lhs->tag)); |
escape2 (LArule[default_LA]->lhs->tag)); |
296 |
defaulted = 0; |
defaulted = 0; |
297 |
fprintf (out, |
fprintf (out, |
298 |
_(" %-4s\t[reduce using rule %d (%s)]\n"), |
_(" %-4s\t[reduce using rule %d (%s)]\n"), |
299 |
escape (symbols[i]->tag), |
escape (symbols[i]->tag), |
300 |
LAruleno[state->lookaheadsp + j] - 1, |
LArule[state->lookaheadsp + j]->number - 1, |
301 |
escape2 (rules[LAruleno[state->lookaheadsp + j]].lhs->tag)); |
escape2 (LArule[state->lookaheadsp + j]->lhs->tag)); |
302 |
} |
} |
303 |
} |
} |
304 |
} |
} |
305 |
|
|
306 |
if (default_LA >= 0) |
if (default_LA >= 0) |
307 |
fprintf (out, _(" $default\treduce using rule %d (%s)\n"), |
fprintf (out, _(" $default\treduce using rule %d (%s)\n"), |
308 |
default_rule - 1, |
default_rule->number - 1, |
309 |
escape (rules[default_rule].lhs->tag)); |
escape (default_rule->lhs->tag)); |
310 |
} |
} |
311 |
} |
} |
312 |
|
|