]> git.saurik.com Git - bison.git/commitdiff
(prepare_symbols): When printing token names, escape "[" as "@<:@" and
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 3 Nov 2002 06:41:59 +0000 (06:41 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Sun, 3 Nov 2002 06:41:59 +0000 (06:41 +0000)
likewise for "]".

src/output.c

index f7ea8182b9ccc55b46ecd95b457f1b0d88e1247b..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;
       }