yysyntax_error: avoid duplicate lookahead collection.

Except when memory reallocation is required, this change
eliminates the need to invoke yysyntax_error twice and thus to
repeat the collection of lookaheads.  It also prepares for
future extensions that will make those repetitions more
expensive and that will require additional memory management in
yysyntax_error.  Finally, it fixes an obscure bug already
exercised in the test suite.
* data/yacc.c (yysyntax_error): Add arguments for message
buffer variables stored in the parser.  Instead of size, return
status similar to yyparse status but indicating success of
message creation.  Other than the actual reallocation of the
message buffer, import and clean up memory management code
from...
(yyparse, yypush_parse): ... here.
* tests/regression.at (parse.error=verbose overflow): No longer
an expected failure.
This commit is contained in:
Joel E. Denny
2009-09-23 17:39:39 -04:00
parent 52cea04ad3
commit 45319f1365
5 changed files with 470 additions and 437 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,4 @@
/* A Bison parser, made by GNU Bison 2.4.404-c6ab. */
/* A Bison parser, made by GNU Bison 2.4.425-305c-dirty. */
/* Interface for Bison's Yacc-like parsers in C
@@ -31,7 +31,7 @@
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
/* "%code requires" blocks. */
/* Line 1616 of yacc.c */
/* Line 1624 of yacc.c */
#line 201 "src/parse-gram.y"
# ifndef PARAM_TYPE
@@ -46,7 +46,7 @@
# endif
/* Line 1616 of yacc.c */
/* Line 1624 of yacc.c */
#line 51 "src/parse-gram.h"
/* Tokens. */
@@ -173,7 +173,7 @@
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
{
/* Line 1616 of yacc.c */
/* Line 1624 of yacc.c */
#line 88 "src/parse-gram.y"
assoc assoc;
@@ -186,13 +186,13 @@ typedef union YYSTYPE
uniqstr uniqstr;
unsigned char character;
/* Line 1616 of yacc.c */
/* Line 1624 of yacc.c */
#line 225 "src/parse-gram.y"
param_type param;
/* Line 1616 of yacc.c */
/* Line 1624 of yacc.c */
#line 197 "src/parse-gram.h"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1