From 01cfa697919c2a7563c61d7a07863445317efa13 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Sun, 3 Nov 2002 06:41:59 +0000
Subject: [PATCH] (prepare_symbols): When printing token names, escape "[" as
 "@<:@" and likewise for "]".

---
 src/output.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/output.c b/src/output.c
index f7ea8182..43016473 100644
--- a/src/output.c
+++ b/src/output.c
@@ -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;
       }
-- 
2.47.2