* data/glr.c (YYTOKEN_TABLE): New macro.

(yytname): Define if YYTOKEN_TABLE.
* data/yacc.c (YYTOKEN_TABLE, yytname): Likewise.
* data/lalr1.cc (YYTOKEN_TABLE, yytname_): Likewise.
(YYERROR_VERBOSE): Define the same way the other skeletons do.
* src/output.c (prepare_symbols): Output token_table_flag.
This commit is contained in:
Paul Eggert
2005-07-22 17:07:31 +00:00
parent 0ffda36340
commit 141f57937b
4 changed files with 25 additions and 6 deletions

View File

@@ -172,6 +172,11 @@ b4_pre_prologue[
# define YYERROR_VERBOSE ]b4_error_verbose[
#endif
/* Enabling the token table. */
#ifndef YYTOKEN_TABLE
# define YYTOKEN_TABLE ]b4_token_table[
#endif
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
]m4_ifdef([b4_stype],
[b4_syncline([b4_stype_line], [b4_filename])
@@ -331,7 +336,7 @@ static const ]b4_int_type_for([b4_rline])[ yyrline[] =
};
#endif
#if (YYDEBUG) || YYERROR_VERBOSE
#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] =

View File

@@ -149,11 +149,19 @@ b4_syncline([@oline@], [@ofile@])[
# define YYDEBUG ]b4_debug[
#endif
/* Enabling verbose error message. */
#ifndef YYERROR_VERBOSE
/* Enabling verbose error messages. */
#ifdef YYERROR_VERBOSE
# undef YYERROR_VERBOSE
# define YYERROR_VERBOSE 1
#else
# define YYERROR_VERBOSE ]b4_error_verbose[
#endif
/* Enabling the token table. */
#ifndef YYTOKEN_TABLE
# define YYTOKEN_TABLE ]b4_token_table[
#endif
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
]m4_ifdef([b4_stype],
[b4_syncline([b4_stype_line], [b4_filename])
@@ -321,7 +329,7 @@ namespace yy
/// For a rule, its RHS length.
static const ]b4_int_type_for([b4_r2])[ yyr2_[];
#if YYDEBUG || YYERROR_VERBOSE
#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
/// For a symbol, its name in clear.
static const char* const yytname_[];
#endif
@@ -1030,7 +1038,7 @@ yy::]b4_parser_class_name[::yyr2_[] =
]b4_r2[
};
#if YYDEBUG || YYERROR_VERBOSE
#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
First, the terminals, then, starting at \a yyntokens_, nonterminals. */
const char*

View File

@@ -182,6 +182,11 @@ b4_location_if([#define yylloc b4_prefix[]lloc])])[
# define YYERROR_VERBOSE ]b4_error_verbose[
#endif
/* Enabling the token table. */
#ifndef YYTOKEN_TABLE
# define YYTOKEN_TABLE ]b4_token_table[
#endif
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
]m4_ifdef([b4_stype],
[b4_syncline([b4_stype_line], [b4_filename])
@@ -415,7 +420,7 @@ static const ]b4_int_type_for([b4_rline])[ yyrline[] =
};
#endif
#if YYDEBUG || YYERROR_VERBOSE
#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] =

View File

@@ -145,6 +145,7 @@ escaped_output (FILE *out, char const *string)
static void
prepare_symbols (void)
{
MUSCLE_INSERT_BOOL ("token_table", token_table_flag);
MUSCLE_INSERT_INT ("tokens_number", ntokens);
MUSCLE_INSERT_INT ("nterms_number", nvars);
MUSCLE_INSERT_INT ("undef_token_number", undeftoken->number);