More fixes related to last two patches.

* data/bison.m4 (b4_integral_parser_tables_map): Fix YYTABLE
comments: zero indicates syntax error not default action.
* data/c.m4 (b4_table_value_equals): Comment that YYID must be
defined.
* data/glr.c (yyis_pact_ninf): Rename to...
(yypact_value_is_default): ... this.
(yyisDefaultedState): Update for rename.
(yyis_table_ninf): Rename to...
(yytable_value_is_error): ... this, and check for value zero
besides just YYTABLE_NINF.
(yygetLRActions): Check for default value from yypact.  It
appears that this check is always performed before this function
is invoked, and so adding the check here is probably redundant.
However, the code may evolve after this subtlety is forgotten.
Also, update for rename to yytable_value_is_error.  Because that
macro now checks for zero, a different but equivalent branch of
the if-then-else here is evaluated.
(yyreportSyntaxError): Update for rename to
yytable_value_is_error.  The zero condition was mishandled
before.
(yyrecoverSyntaxError): Update for renames.  No behavioral
changes.
* data/lalr1.cc, data/lalr1.java (yy_pact_value_is_default_):
New function.
(yy_table_value_is_error_): New function.
(parse): Use new functions where possible.  No behavioral
changes.
(yysyntax_error_, yysyntax_error): Use yy_table_value_is_error_.
The zero condition was mishandled before.
* data/yacc.c (yyis_pact_ninf): Rename to...
(yypact_value_is_default): ... this.
(yyis_table_ninf): Rename to...
(yytable_value_is_error): ... this, and check for value zero
besides just YYTABLE_NINF.
(yysyntax_error): Update for rename to yytable_value_is_error.
The zero condition was mishandled before.
(yyparse): Update for renames.  No behavioral changes.
* src/tables.h: Improve comments about yypact, yytable, etc.
more.  Most importantly, say yytable value of zero means syntax
error not default action.
This commit is contained in:
Joel E. Denny
2009-08-25 19:41:49 -04:00
parent 53f036ce02
commit f2b30bdf37
10 changed files with 366 additions and 277 deletions

View File

@@ -1,4 +1,4 @@
/* A Bison parser, made by GNU Bison 2.4.386-e6c849. */
/* A Bison parser, made by GNU Bison 2.4.388-53f03. */
/* Interface for Bison's Yacc-like parsers in C
@@ -157,7 +157,7 @@
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
{
/* Line 1608 of yacc.c */
/* Line 1609 of yacc.c */
#line 94 "parse-gram.y"
symbol *symbol;
@@ -171,7 +171,7 @@ typedef union YYSTYPE
named_ref *named_ref;
/* Line 1608 of yacc.c */
/* Line 1609 of yacc.c */
#line 176 "src/parse-gram.h"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1