[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bug in compatibility mode
From: |
Akim Demaille |
Subject: |
Re: Bug in compatibility mode |
Date: |
Sun, 24 Feb 2002 14:33:20 +0100 |
User-agent: |
Gnus/5.090006 (Oort Gnus v0.06) XEmacs/21.4 (Common Lisp, i386-debian-linux) |
| Hello,
| there is a bug in yacc emulation mode, the original bug report is
available
| on debian bug tracking system :
| http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=134068&repeatmerged=yes
|
| I made a patch for this bug, but I am not sure that it does not create
| another problem.
|
| here is the patch :
| diff -bBdNrw -U5 bison-1.33-orig/src/reader.c bison-1.33/src/reader.c
| --- bison-1.33-orig/src/reader.c Thu Feb 7 18:12:44 2002
| +++ bison-1.33/src/reader.c Tue Feb 19 15:38:37 2002
| @@ -1142,13 +1142,13 @@
| }
|
| /* As a Bison extension, add the ending semicolon. Since some Yacc
| don't do that, help people using bison as a Yacc finding their
| missing semicolons. */
| - if (yacc_flag)
| + /*if (yacc_flag)
| obstack_sgrow (&action_obstack, "}\n break;");
| - else
| + else*/
| obstack_sgrow (&action_obstack, ";\n break;}");
| }
|
|
| /*-------------------------------------------------------------------.
| | After `%guard' is seen in the input file, copy the actual guard |
|
|
| here is the problem description :
| $ cat test.yy
| %{
| #include "stdio.h"
| %}
|
| %token PARAMS
|
| %%
|
|
| ocr: PARAMS {printf("params\n")} '{' /*...*/ '}'
| ;
|
| %%
|
|
| extern char *yytext;
| int yyerror(char *err)
| {
| fprintf(stderr, "%s at %s\n", err, yytext);
| exit(1);
| }
| $bison -y test.yy
| $gcc -c y.tab.c
| test.yy: In function `yyparse':
| test.yy:10: parse error before `}'
|
| please Cc me replies, thanks.
Your Bison file appears to be wrong: add the ending `;' in the { block
}. This is no bug, or rather, this bug (Bison adding the `;' itself)
is finely removed.