/[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.25 by akim, Mon Nov 19 10:08:02 2001 UTC revision 1.26 by akim, Mon Nov 19 10:19:20 2001 UTC
# Line 68  print_core (FILE *out, int state) Line 68  print_core (FILE *out, int state)
68          sp++;          sp++;
69    
70        rule = -(*sp);        rule = -(*sp);
71        fprintf (out, "    %s  ->  ", tags[rlhs[rule]]);        fprintf (out, "    %s  ->  ", tags[rule_table[rule].lhs]);
72    
73        for (sp = ritem + rrhs[rule]; sp < sp1; sp++)        for (sp = ritem + rule_table[rule].rhs; sp < sp1; sp++)
74          {          {
75            fprintf (out, "%s ", tags[*sp]);            fprintf (out, "%s ", tags[*sp]);
76          }          }
# Line 168  print_actions (FILE *out, int state) Line 168  print_actions (FILE *out, int state)
168    if (state_table[state].consistent && redp)    if (state_table[state].consistent && redp)
169      {      {
170        rule = redp->rules[0];        rule = redp->rules[0];
171        symbol = rlhs[rule];        symbol = rule_table[rule].lhs;
172        fprintf (out, _("    $default\treduce using rule %d (%s)\n\n"),        fprintf (out, _("    $default\treduce using rule %d (%s)\n\n"),
173                 rule, tags[symbol]);                 rule, tags[symbol]);
174      }      }
# Line 230  print_grammar (FILE *out) Line 230  print_grammar (FILE *out)
230    fprintf (out, "\n%s\n\n", _("Grammar"));    fprintf (out, "\n%s\n\n", _("Grammar"));
231    for (i = 1; i <= nrules; i++)    for (i = 1; i <= nrules; i++)
232      /* Don't print rules disabled in reduce_grammar_tables.  */      /* Don't print rules disabled in reduce_grammar_tables.  */
233      if (rlhs[i] >= 0)      if (rule_table[i].lhs >= 0)
234        {        {
235          fprintf (out, _("rule %-4d %s ->"), i, tags[rlhs[i]]);          fprintf (out, _("rule %-4d %s ->"), i, tags[rule_table[i].lhs]);
236          rule = &ritem[rrhs[i]];          rule = &ritem[rule_table[i].rhs];
237          if (*rule > 0)          if (*rule > 0)
238            while (*rule > 0)            while (*rule > 0)
239              fprintf (out, " %s", tags[*rule++]);              fprintf (out, " %s", tags[*rule++]);
# Line 256  print_grammar (FILE *out) Line 256  print_grammar (FILE *out)
256          sprintf (buffer, " (%d)", i);          sprintf (buffer, " (%d)", i);
257    
258          for (j = 1; j <= nrules; j++)          for (j = 1; j <= nrules; j++)
259            for (rule = &ritem[rrhs[j]]; *rule > 0; rule++)            for (rule = &ritem[rule_table[j].rhs]; *rule > 0; rule++)
260              if (*rule == token_translations[i])              if (*rule == token_translations[i])
261                {                {
262                  END_TEST (65);                  END_TEST (65);
# Line 274  print_grammar (FILE *out) Line 274  print_grammar (FILE *out)
274    
275        for (j = 1; j <= nrules; j++)        for (j = 1; j <= nrules; j++)
276          {          {
277            if (rlhs[j] == i)            if (rule_table[j].lhs == i)
278              left_count++;              left_count++;
279            for (rule = &ritem[rrhs[j]]; *rule > 0; rule++)            for (rule = &ritem[rule_table[j].rhs]; *rule > 0; rule++)
280              if (*rule == i)              if (*rule == i)
281                {                {
282                  right_count++;                  right_count++;
# Line 298  print_grammar (FILE *out) Line 298  print_grammar (FILE *out)
298            for (j = 1; j <= nrules; j++)            for (j = 1; j <= nrules; j++)
299              {              {
300                END_TEST (65);                END_TEST (65);
301                if (rlhs[j] == i)                if (rule_table[j].lhs == i)
302                  sprintf (buffer + strlen (buffer), " %d", j);                  sprintf (buffer + strlen (buffer), " %d", j);
303              }              }
304          }          }
# Line 311  print_grammar (FILE *out) Line 311  print_grammar (FILE *out)
311            sprintf (buffer + strlen (buffer), _(" on right:"));            sprintf (buffer + strlen (buffer), _(" on right:"));
312            for (j = 1; j <= nrules; j++)            for (j = 1; j <= nrules; j++)
313              {              {
314                for (rule = &ritem[rrhs[j]]; *rule > 0; rule++)                for (rule = &ritem[rule_table[j].rhs]; *rule > 0; rule++)
315                  if (*rule == i)                  if (*rule == i)
316                    {                    {
317                      END_TEST (65);                      END_TEST (65);

Legend:
Removed from v.1.25  
changed lines
  Added in v.1.26

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