/[bison]/bison/src/print.c
ViewVC logotype

Diff of /bison/src/print.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.45 by akim, Thu Dec 27 18:13:31 2001 UTC revision 1.46 by akim, Thu Dec 27 18:13:47 2001 UTC
# Line 102  print_core (FILE *out, state_t *state) Line 102  print_core (FILE *out, state_t *state)
102            for (/* Nothing */; *sp >= 0; ++sp)            for (/* Nothing */; *sp >= 0; ++sp)
103              fprintf (out, " %s", escape (tags[*sp]));              fprintf (out, " %s", escape (tags[*sp]));
104    
105            fprintf (out, _("   (rule %d)"), rule);            fprintf (out, _("   (rule %d)"), rule - 1);
106            fputc ('\n', out);            fputc ('\n', out);
107          }          }
108    
# Line 189  print_reductions (FILE *out, state_t *st Line 189  print_reductions (FILE *out, state_t *st
189        int rule = redp->rules[0];        int rule = redp->rules[0];
190        int symbol = rule_table[rule].lhs;        int symbol = rule_table[rule].lhs;
191        fprintf (out, _("    $default\treduce using rule %d (%s)\n\n"),        fprintf (out, _("    $default\treduce using rule %d (%s)\n\n"),
192                 rule, escape (tags[symbol]));                 rule - 1, escape (tags[symbol]));
193        return;        return;
194      }      }
195    
# Line 221  print_reductions (FILE *out, state_t *st Line 221  print_reductions (FILE *out, state_t *st
221        for (i = 0; i < ntokens; i++)        for (i = 0; i < ntokens; i++)
222          if (BITISSET (lookaheadset, i))          if (BITISSET (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 (tags[i]), default_rule,                     escape (tags[i]), default_rule - 1,
225                     escape2 (tags[rule_table[default_rule].lhs]));                     escape2 (tags[rule_table[default_rule].lhs]));
226    
227        fprintf (out, _("    $default\treduce using rule %d (%s)\n\n"),        fprintf (out, _("    $default\treduce using rule %d (%s)\n\n"),
228                 default_rule, escape (tags[rule_table[default_rule].lhs]));                 default_rule - 1, escape (tags[rule_table[default_rule].lhs]));
229      }      }
230    else if (state->nlookaheads >= 1)    else if (state->nlookaheads >= 1)
231      {      {
# Line 280  print_reductions (FILE *out, state_t *st Line 280  print_reductions (FILE *out, state_t *st
280                          fprintf (out,                          fprintf (out,
281                                   _("    %-4s\treduce using rule %d (%s)\n"),                                   _("    %-4s\treduce using rule %d (%s)\n"),
282                                   escape (tags[i]),                                   escape (tags[i]),
283                                   LAruleno[state->lookaheadsp + j],                                   LAruleno[state->lookaheadsp + j] - 1,
284                                   escape2 (tags[rule_table[LAruleno[state->lookaheadsp + j]].lhs]));                                   escape2 (tags[rule_table[LAruleno[state->lookaheadsp + j]].lhs]));
285                        else                        else
286                          defaulted = 1;                          defaulted = 1;
# Line 293  print_reductions (FILE *out, state_t *st Line 293  print_reductions (FILE *out, state_t *st
293                          fprintf (out,                          fprintf (out,
294                                   _("    %-4s\treduce using rule %d (%s)\n"),                                   _("    %-4s\treduce using rule %d (%s)\n"),
295                                   escape (tags[i]),                                   escape (tags[i]),
296                                   LAruleno[default_LA],                                   LAruleno[default_LA] - 1,
297                                   escape2 (tags[rule_table[LAruleno[default_LA]].lhs]));                                   escape2 (tags[rule_table[LAruleno[default_LA]].lhs]));
298                        defaulted = 0;                        defaulted = 0;
299                        fprintf (out,                        fprintf (out,
300                                 _("    %-4s\t[reduce using rule %d (%s)]\n"),                                 _("    %-4s\t[reduce using rule %d (%s)]\n"),
301                                 escape (tags[i]),                                 escape (tags[i]),
302                                 LAruleno[state->lookaheadsp + j],                                 LAruleno[state->lookaheadsp + j] - 1,
303                                 escape2 (tags[rule_table[LAruleno[state->lookaheadsp + j]].lhs]));                                 escape2 (tags[rule_table[LAruleno[state->lookaheadsp + j]].lhs]));
304                      }                      }
305                  }                  }
# Line 308  print_reductions (FILE *out, state_t *st Line 308  print_reductions (FILE *out, state_t *st
308    
309        if (default_LA >= 0)        if (default_LA >= 0)
310          fprintf (out, _("    $default\treduce using rule %d (%s)\n"),          fprintf (out, _("    $default\treduce using rule %d (%s)\n"),
311                   default_rule, escape (tags[rule_table[default_rule].lhs]));                   default_rule - 1,
312                     escape (tags[rule_table[default_rule].lhs]));
313      }      }
314  }  }
315    
# Line 322  print_actions (FILE *out, state_t *state Line 323  print_actions (FILE *out, state_t *state
323    if (shiftp->nshifts == 0 && redp->nreds == 0)    if (shiftp->nshifts == 0 && redp->nreds == 0)
324      {      {
325        if (final_state == state->number)        if (final_state == state->number)
326          fprintf (out, _("    $default\taccept\n"));         fprintf (out, _("    $default\taccept\n"));
327        else        else
328          fprintf (out, _("    NO ACTIONS\n"));         fprintf (out, _("    NO ACTIONS\n"));
329        return;        return;
330      }      }
331    
# Line 375  print_grammar (FILE *out) Line 376  print_grammar (FILE *out)
376      if (rule_table[i].useful)      if (rule_table[i].useful)
377        {        {
378          fprintf (out, _("  %3d %3d %s ->"),          fprintf (out, _("  %3d %3d %s ->"),
379                   i, rule_table[i].line, escape (tags[rule_table[i].lhs]));                   i - 1, rule_table[i].line, escape (tags[rule_table[i].lhs]));
380          rule = &ritem[rule_table[i].rhs];          rule = &ritem[rule_table[i].rhs];
381          if (*rule >= 0)          if (*rule >= 0)
382            while (*rule >= 0)            while (*rule >= 0)
# Line 403  print_grammar (FILE *out) Line 404  print_grammar (FILE *out)
404              if (*rule == token_translations[i])              if (*rule == token_translations[i])
405                {                {
406                  END_TEST (65);                  END_TEST (65);
407                  sprintf (buffer + strlen (buffer), " %d", j);                  sprintf (buffer + strlen (buffer), " %d", j - 1);
408                  break;                  break;
409                }                }
410          fprintf (out, "%s\n", buffer);          fprintf (out, "%s\n", buffer);
# Line 443  print_grammar (FILE *out) Line 444  print_grammar (FILE *out)
444              {              {
445                END_TEST (65);                END_TEST (65);
446                if (rule_table[j].lhs == i)                if (rule_table[j].lhs == i)
447                  sprintf (buffer + strlen (buffer), " %d", j);                  sprintf (buffer + strlen (buffer), " %d", j - 1);
448              }              }
449          }          }
450    
# Line 459  print_grammar (FILE *out) Line 460  print_grammar (FILE *out)
460                  if (*rule == i)                  if (*rule == i)
461                    {                    {
462                      END_TEST (65);                      END_TEST (65);
463                      sprintf (buffer + strlen (buffer), " %d", j);                      sprintf (buffer + strlen (buffer), " %d", j - 1);
464                      break;                      break;
465                    }                    }
466              }              }

Legend:
Removed from v.1.45  
changed lines
  Added in v.1.46

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26