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

Diff of /bison/src/output.c

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

revision 1.87 by marc, Tue Dec 11 20:19:44 2001 UTC revision 1.88 by akim, Fri Dec 14 15:39:05 2001 UTC
# Line 234  output_rule_data (void) Line 234  output_rule_data (void)
234    
235    j = 0;    j = 0;
236    for (i = 0; i < nsyms; i++)    for (i = 0; i < nsyms; i++)
     /* this used to be i<=nsyms, but that output a final "" symbol  
        almost by accident */  
237      {      {
238          /* Be sure not to use twice the same quotearg slot. */
239          const char *cp =
240            quotearg_n_style (1, c_quoting_style,
241                              quotearg_style (escape_quoting_style, tags[i]));
242        /* Width of the next token, including the two quotes, the coma        /* Width of the next token, including the two quotes, the coma
243           and the space.  */           and the space.  */
244        int strsize = 4;        int strsize = strlen (cp) + 2;
       char *p;  
   
       for (p = tags[i]; p && *p; p++)  
         if (*p == '"' || *p == '\\' || *p == '\n' || *p == '\t'  
             || *p == '\b')  
           strsize += 2;  
         else if (*p < 040 || *p >= 0177)  
           strsize += 4;  
         else  
           strsize++;  
245    
246        if (j + strsize > 75)        if (j + strsize > 75)
247          {          {
# Line 257  output_rule_data (void) Line 249  output_rule_data (void)
249            j = 2;            j = 2;
250          }          }
251    
252        obstack_1grow (&output_obstack, '\"');        obstack_sgrow (&output_obstack, cp);
253        for (p = tags[i]; p && *p; p++)        obstack_sgrow (&output_obstack, ", ");
         {  
           if (*p == '"' || *p == '\\')  
             obstack_fgrow1 (&output_obstack, "\\%c", *p);  
           else if (*p == '\n')  
             obstack_sgrow (&output_obstack, "\\n");  
           else if (*p == '\t')  
             obstack_sgrow (&output_obstack, "\\t");  
           else if (*p == '\b')  
             obstack_sgrow (&output_obstack, "\\b");  
           else if (*p < 040 || *p >= 0177)  
             obstack_fgrow1 (&output_obstack, "\\%03o", *p);  
           else  
             obstack_1grow (&output_obstack, *p);  
         }  
   
       obstack_sgrow (&output_obstack, "\", ");  
254        j += strsize;        j += strsize;
255      }      }
256    /* add a NULL entry to list of tokens */    /* add a NULL entry to list of tokens */

Legend:
Removed from v.1.87  
changed lines
  Added in v.1.88

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