]> git.saurik.com Git - bison.git/commitdiff
(yy::]b4_parser_class_name[::parse): Port
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 22 May 2005 07:31:24 +0000 (07:31 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Sun, 22 May 2005 07:31:24 +0000 (07:31 +0000)
yesterday's yacc.c fix.

data/lalr1.cc

index 9863ae995587ebf282d9badaa09074d8fd758a3e..eef5a13c3b4cae58121e07de529f09f197093dd3 100644 (file)
@@ -544,6 +544,8 @@ yy::]b4_parser_class_name[::set_debug_level (debug_level_type l)
 int
 yy::]b4_parser_class_name[::parse ()
 {
 int
 yy::]b4_parser_class_name[::parse ()
 {
+  int yyresult_;
+
   YYCDEBUG << "Starting parse" << std::endl;
 
   yynerrs_ = 0;
   YYCDEBUG << "Starting parse" << std::endl;
 
   yynerrs_ = 0;
@@ -813,14 +815,18 @@ yyerrlab1:
 
   /* Accept.  */
 yyacceptlab:
 
   /* Accept.  */
 yyacceptlab:
-  return 0;
+  yyresult_ = 0;
+  goto yyreturn;
 
   /* Abort.  */
 yyabortlab:
 
   /* Abort.  */
 yyabortlab:
-  /* Free the lookahead. */
-  yydestruct_ ("Error: discarding lookahead", yyilooka_, &yylval, &yylloc);
-  yylooka_ = yyempty_;
-  return 1;
+  yyresult_ = 1;
+  goto yyreturn;
+
+yyreturn:
+  if (yylooka_ != yyeof_ && yylooka_ != yyempty_)
+    yydestruct_ ("Error: discarding lookahead", yyilooka_, &yylval, &yylloc);
+  return yyresult_;
 }
 
 void
 }
 
 void