]> git.saurik.com Git - bison.git/blobdiff - src/output.c
* tests/glr-regr1.at (Badly Collapsed GLR States): Prototype yylex
[bison.git] / src / output.c
index 6395d6db62f8754860126162ab73c642c960a903..430164737fc14c2e6bf1f9b051ecbaed5315cba6 100644 (file)
@@ -136,7 +136,7 @@ prepare_symbols (void)
        const char *cp =
          quotearg_n_style (1, c_quoting_style,
                            symbols[i]->tag);
-       /* Width of the next token, including the two quotes, the coma
+       /* Width of the next token, including the two quotes, the comma
           and the space.  */
        int strsize = strlen (cp) + 2;
 
@@ -146,7 +146,14 @@ prepare_symbols (void)
            j = 2;
          }
 
-       obstack_sgrow (&format_obstack, cp);
+       for (; *cp; cp++)
+         switch (*cp)
+           {
+           case '[': obstack_sgrow (&format_obstack, "@<:@"); break;
+           case ']': obstack_sgrow (&format_obstack, "@:>@"); break;
+           default: obstack_1grow (&format_obstack, *cp); break;
+           }
+
        obstack_sgrow (&format_obstack, ", ");
        j += strsize;
       }
@@ -500,8 +507,9 @@ output_skeleton (void)
   full_path[pkgdatadirlen] = '/';
   strcpy (full_path + pkgdatadirlen + 1, m4sugar);
   in = fopen (full_path, "r");
-  if (! in || fclose (in) != 0)
+  if (! in)
     error (EXIT_FAILURE, errno, "%s", full_path);
+  xfclose (in);
   strcpy (full_path + pkgdatadirlen + 1, skeleton);
 
   /* Create an m4 subprocess connected to us via two pipes.  */
@@ -539,8 +547,6 @@ output_skeleton (void)
 
   fputs ("m4_wrap([m4_divert_pop(0)])\n", out);
   fputs ("m4_divert_push(0)dnl\n", out);
-  if (ferror (out))
-    error (EXIT_FAILURE, 0, "pipe output error");
   xfclose (out);
 
   /* Read and process m4's output.  */
@@ -549,8 +555,6 @@ output_skeleton (void)
   if (! in)
     error (EXIT_FAILURE, errno, "fdopen");
   scan_skel (in);
-  if (ferror (in))
-    error (EXIT_FAILURE, 0, "pipe input error");
   xfclose (in);
   reap_subpipe (pid, m4);
   timevar_pop (TV_M4);