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

Diff of /bison/src/conflicts.c

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

revision 1.91 by akim, Mon Jul 29 17:31:46 2002 UTC revision 1.92 by akim, Tue Jul 30 11:09:59 2002 UTC
# Line 385  count_rr_conflicts (state_t *state, int Line 385  count_rr_conflicts (state_t *state, int
385    return rrc_count;    return rrc_count;
386  }  }
387    
388    
389  /*--------------------------------------------------------------.  /*--------------------------------------------------------------.
390  | Return a human readable string which reports shift/reduce and |  | Return a human readable string which reports shift/reduce and |
391  | reduce/reduce conflict numbers (SRC_NUM, RRC_NUM).            |  | reduce/reduce conflict numbers (SRC_NUM, RRC_NUM).            |
# Line 416  conflict_report (int src_num, int rrc_nu Line 417  conflict_report (int src_num, int rrc_nu
417        cp += strlen (cp);        cp += strlen (cp);
418      }      }
419    
   *cp++ = '.';  
   *cp++ = '\n';  
420    *cp++ = '\0';    *cp++ = '\0';
421    
422    return res;    return res;
423  }  }
424    
425    
426    /*----------------------------------------------------------------.
427    | Same as above, but report the number of conflicts a` la POSIX.  |
428    `----------------------------------------------------------------*/
429    
430    static void
431    conflict_report_yacc (int src_num, int rrc_num)
432    {
433      /* If invoked with `--yacc', use the output format specified by
434         POSIX.  */
435      fprintf (stderr, _("conflicts: "));
436      if (src_num > 0)
437        fprintf (stderr, _(" %d shift/reduce"), src_num);
438      if (src_num > 0 && rrc_num > 0)
439        fprintf (stderr, ",");
440      if (rrc_num > 0)
441        fprintf (stderr, _(" %d reduce/reduce"), rrc_num);
442      putc ('\n', stderr);
443    }
444    
445    
446  /*-----------------------------------------------------------.  /*-----------------------------------------------------------.
447  | Output the detailed description of states with conflicts.  |  | Output the detailed description of states with conflicts.  |
448  `-----------------------------------------------------------*/  `-----------------------------------------------------------*/
# Line 443  conflicts_output (FILE *out) Line 462  conflicts_output (FILE *out)
462        if (conflicts[i])        if (conflicts[i])
463          {          {
464            fprintf (out, _("State %d contains "), i);            fprintf (out, _("State %d contains "), i);
465            fputs (conflict_report (count_sr_conflicts (s),            fprintf (out, "%s.\n",
466                                    count_rr_conflicts (s, TRUE)), out);                     conflict_report (count_sr_conflicts (s),
467                                        count_rr_conflicts (s, TRUE)));
468            printed_sth = TRUE;            printed_sth = TRUE;
469          }          }
470      }      }
# Line 530  conflicts_print (void) Line 550  conflicts_print (void)
550    
551    /* Report the total number of conflicts on STDERR.  */    /* Report the total number of conflicts on STDERR.  */
552    if (yacc_flag)    if (yacc_flag)
553      {      conflict_report_yacc (src_total, rrc_total);
       /* If invoked with `--yacc', use the output format specified by  
          POSIX.  */  
       fprintf (stderr, _("conflicts: "));  
       if (src_total > 0)  
         fprintf (stderr, _(" %d shift/reduce"), src_total);  
       if (src_total > 0 && rrc_total > 0)  
         fprintf (stderr, ",");  
       if (rrc_total > 0)  
         fprintf (stderr, _(" %d reduce/reduce"), rrc_total);  
       putc ('\n', stderr);  
     }  
554    else    else
555      {      warn ("%s", conflict_report (src_total, rrc_total));
       fprintf (stderr, _("%s contains "), infile);  
       fputs (conflict_report (src_total, rrc_total), stderr);  
     }  
556    
557    if (expected_conflicts != -1 && !src_ok)    if (expected_conflicts != -1 && !src_ok)
558      {      complain (ngettext ("expected %d shift/reduce conflict",
559        complain_message_count++;                          "expected %d shift/reduce conflicts",
560        fprintf (stderr, ngettext ("expected %d shift/reduce conflict\n",                          expected_conflicts),
561                                   "expected %d shift/reduce conflicts\n",                expected_conflicts);
                                  expected_conflicts),  
                expected_conflicts);  
     }  
562  }  }
563    
564    

Legend:
Removed from v.1.91  
changed lines
  Added in v.1.92

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