[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Bison 1.75a mishandles unbalanced "[" or "]" in token names
From: |
Paul Eggert |
Subject: |
Bison 1.75a mishandles unbalanced "[" or "]" in token names |
Date: |
Sat, 2 Nov 2002 22:47:11 -0800 (PST) |
Recent versions of Bison mishandle token names that contain unbalanced
"[" or "]". I installed this patch. I'll add a test case too, in a
patch I'll install soon.
2002-11-02 Paul Eggert <address@hidden>
* src/output.c (prepare_symbols): When printing token names,
escape "[" as "@<:@" and likewise for "]".
Index: output.c
===================================================================
RCS file: /cvsroot/bison/bison/src/output.c,v
retrieving revision 1.203
retrieving revision 1.204
diff -p -u -r1.203 -r1.204
--- output.c 30 Oct 2002 06:20:02 -0000 1.203
+++ output.c 3 Nov 2002 06:41:59 -0000 1.204
@@ -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;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Bison 1.75a mishandles unbalanced "[" or "]" in token names,
Paul Eggert <=