develooper Front page | perl.perl5.porters | Postings from February 2000

perl5 & bison incompatibilty with the empty-yychar

From:
ignasi.roca
Date:
February 10, 2000 03:40
Subject:
perl5 & bison incompatibilty with the empty-yychar
Message ID:
5930DC161690D21196670090271575470139B70A@madt9.ssa.siemens.es
I'm using bison v1.28 to generate the perl5.005_63 parser, the perly.c.
Going on with perl5-tests, test op/misc.t fails on tests 45 and 46.

After analizing the problem I concluded that the reason is due that bison
sets yychar with '-2' instead of '-1'

I fixed the problem in the function Perl_yyerror() of modul toke.o, bellow
is a diff of the correction. 


============================================================================
==
*** toke.c.orig	Thu Dec  9 08:40:50 1999
--- toke.c	Thu Feb 10 11:47:37 2000
***************
*** 6964,6970 ****
--- 6964,6975 ----
      }
      else if (yychar > 255)
  	where = "next token ???";
+ #ifdef USE_PURE_BISON
+ /*  GNU Bison sets the value -2 */
+     else if (yychar == -2) {
+ #else
      else if ((yychar & 127) == 127) {
+ #endif
  	if (PL_lex_state == LEX_NORMAL ||
  	   (PL_lex_state == LEX_KNOWNEXT && PL_lex_defer == LEX_NORMAL))
  	    where = "at end of line";
============================================================================
==


-- Ignasi Roca




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About