/[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.82 by akim, Sun Jun 30 17:34:31 2002 UTC revision 1.83 by akim, Sun Jun 30 17:34:52 2002 UTC
# Line 103  print_core (FILE *out, state_t *state) Line 103  print_core (FILE *out, state_t *state)
103        previous_lhs = rules[rule].lhs;        previous_lhs = rules[rule].lhs;
104    
105        for (sp = rules[rule].rhs; sp < sp1; sp++)        for (sp = rules[rule].rhs; sp < sp1; sp++)
106          fprintf (out, " %s", symbol_tag_get (symbols[*sp]));          fprintf (out, " %s", symbols[*sp]->tag);
107        fputs (" .", out);        fputs (" .", out);
108        for (/* Nothing */; *sp >= 0; ++sp)        for (/* Nothing */; *sp >= 0; ++sp)
109          fprintf (out, " %s", symbol_tag_get (symbols[*sp]));          fprintf (out, " %s", symbols[*sp]->tag);
110    
111        /* Display the lookaheads?  */        /* Display the lookaheads?  */
112        if (report_flag & report_lookaheads)        if (report_flag & report_lookaheads)
# Line 135  print_transitions (state_t *state, FILE Line 135  print_transitions (state_t *state, FILE
135          && TRANSITION_IS_SHIFT (transitions, i) == display_transitions_p)          && TRANSITION_IS_SHIFT (transitions, i) == display_transitions_p)
136        {        {
137          symbol_t *symbol = symbols[TRANSITION_SYMBOL (transitions, i)];          symbol_t *symbol = symbols[TRANSITION_SYMBOL (transitions, i)];
138          max_length (&width, symbol_tag_get (symbol));          max_length (&width, symbol->tag);
139        }        }
140    
141    /* Nothing to report. */    /* Nothing to report. */
# Line 151  print_transitions (state_t *state, FILE Line 151  print_transitions (state_t *state, FILE
151          && TRANSITION_IS_SHIFT (transitions, i) == display_transitions_p)          && TRANSITION_IS_SHIFT (transitions, i) == display_transitions_p)
152        {        {
153          symbol_t *symbol = symbols[TRANSITION_SYMBOL (transitions, i)];          symbol_t *symbol = symbols[TRANSITION_SYMBOL (transitions, i)];
154          const char *tag = symbol_tag_get (symbol);          const char *tag = symbol->tag;
155          state_number_t state1 = transitions->states[i];          state_number_t state1 = transitions->states[i];
156          int j;          int j;
157    
# Line 180  print_errs (FILE *out, state_t *state) Line 180  print_errs (FILE *out, state_t *state)
180    /* Compute the width of the lookaheads column.  */    /* Compute the width of the lookaheads column.  */
181    for (i = 0; i < errp->num; ++i)    for (i = 0; i < errp->num; ++i)
182      if (errp->symbols[i])      if (errp->symbols[i])
183        max_length (&width, symbol_tag_get (symbols[errp->symbols[i]]));        max_length (&width, symbols[errp->symbols[i]]->tag);
184    
185    /* Nothing to report. */    /* Nothing to report. */
186    if (!width)    if (!width)
# Line 193  print_errs (FILE *out, state_t *state) Line 193  print_errs (FILE *out, state_t *state)
193    for (i = 0; i < errp->num; ++i)    for (i = 0; i < errp->num; ++i)
194      if (errp->symbols[i])      if (errp->symbols[i])
195        {        {
196          const char *tag = symbol_tag_get (symbols[errp->symbols[i]]);          const char *tag = symbols[errp->symbols[i]]->tag;
197          int j;          int j;
198          fprintf (out, "    %s", tag);          fprintf (out, "    %s", tag);
199          for (j = width - strlen (tag); j > 0; --j)          for (j = width - strlen (tag); j > 0; --j)
# Line 288  print_reduction (FILE *out, size_t width Line 288  print_reduction (FILE *out, size_t width
288    if (!enabled)    if (!enabled)
289      fputc ('[', out);      fputc ('[', out);
290    fprintf (out, _("reduce using rule %d (%s)"),    fprintf (out, _("reduce using rule %d (%s)"),
291             rule->number - 1, symbol_tag_get (rule->lhs));             rule->number - 1, rule->lhs->tag);
292    if (!enabled)    if (!enabled)
293      fputc (']', out);      fputc (']', out);
294    fputc ('\n', out);    fputc ('\n', out);
# Line 331  print_reductions (FILE *out, state_t *st Line 331  print_reductions (FILE *out, state_t *st
331              if (count == 0)              if (count == 0)
332                {                {
333                  if (state->lookaheads_rule[j] != default_rule)                  if (state->lookaheads_rule[j] != default_rule)
334                    max_length (&width, symbol_tag_get (symbols[i]));                    max_length (&width, symbols[i]->tag);
335                  count++;                  count++;
336                }                }
337              else              else
338                {                {
339                  max_length (&width, symbol_tag_get (symbols[i]));                  max_length (&width, symbols[i]->tag);
340                }                }
341            }            }
342      }      }
# Line 361  print_reductions (FILE *out, state_t *st Line 361  print_reductions (FILE *out, state_t *st
361                {                {
362                  if (state->lookaheads_rule[j] != default_rule)                  if (state->lookaheads_rule[j] != default_rule)
363                    print_reduction (out, width,                    print_reduction (out, width,
364                                     symbol_tag_get (symbols[i]),                                     symbols[i]->tag,
365                                     state->lookaheads_rule[j], TRUE);                                     state->lookaheads_rule[j], TRUE);
366                  else                  else
367                    defaulted = 1;                    defaulted = 1;
# Line 371  print_reductions (FILE *out, state_t *st Line 371  print_reductions (FILE *out, state_t *st
371                {                {
372                  if (defaulted)                  if (defaulted)
373                    print_reduction (out, width,                    print_reduction (out, width,
374                                     symbol_tag_get (symbols[i]),                                     symbols[i]->tag,
375                                     default_rule, TRUE);                                     default_rule, TRUE);
376                  defaulted = 0;                  defaulted = 0;
377                  print_reduction (out, width,                  print_reduction (out, width,
378                                   symbol_tag_get (symbols[i]),                                   symbols[i]->tag,
379                                   state->lookaheads_rule[j], FALSE);                                   state->lookaheads_rule[j], FALSE);
380                }                }
381            }            }
# Line 463  print_grammar (FILE *out) Line 463  print_grammar (FILE *out)
463    for (i = 0; i < max_user_token_number + 1; i++)    for (i = 0; i < max_user_token_number + 1; i++)
464      if (token_translations[i] != undeftoken->number)      if (token_translations[i] != undeftoken->number)
465        {        {
466          const char *tag = symbol_tag_get (symbols[token_translations[i]]);          const char *tag = symbols[token_translations[i]]->tag;
467          rule_number_t r;          rule_number_t r;
468          item_number_t *rhsp;          item_number_t *rhsp;
469    
# Line 491  print_grammar (FILE *out) Line 491  print_grammar (FILE *out)
491      {      {
492        int left_count = 0, right_count = 0;        int left_count = 0, right_count = 0;
493        rule_number_t r;        rule_number_t r;
494        const char *tag = symbol_tag_get (symbols[i]);        const char *tag = symbols[i]->tag;
495    
496        for (r = 1; r < nrules + 1; r++)        for (r = 1; r < nrules + 1; r++)
497          {          {

Legend:
Removed from v.1.82  
changed lines
  Added in v.1.83

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