From 3650b4b8dddf39f6d6f5b2514d1f036548c5fe2e Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Fri, 26 Jul 2002 06:24:11 +0000 Subject: [PATCH] * src/output.c (prepare_tokens): Go up to ntokens, not ntokens + 1. * doc/bison.texinfo (Decl Summary): s/$illegal/$undefined./. * tests/regression.at (Web2c Actions): Adjust. --- ChangeLog | 6 ++++++ doc/bison.texinfo | 8 ++++---- src/output.c | 6 +++--- tests/regression.at | 4 ++-- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2f34da0..f581e54 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2002-07-25 Akim Demaille + * src/output.c (prepare_tokens): Go up to ntokens, not ntokens + 1. + * doc/bison.texinfo (Decl Summary): s/$illegal/$undefined./. + * tests/regression.at (Web2c Actions): Adjust. + +2002-07-25 Akim Demaille + Stop storing rules from 1 to nrules + 1. * src/LR0.c, src/closure.c, src/derives.c, src/gram.c, src/lalr.c diff --git a/doc/bison.texinfo b/doc/bison.texinfo index 03d3cc9..a4c1a4b 100644 --- a/doc/bison.texinfo +++ b/doc/bison.texinfo @@ -3552,10 +3552,10 @@ Request a pure (reentrant) parser program (@pxref{Pure Decl, ,A Pure @item %token-table Generate an array of token names in the parser file. The name of the array is @code{yytname}; @code{yytname[@var{i}]} is the name of the -token whose internal Bison token code number is @var{i}. The first three -elements of @code{yytname} are always @code{"$"}, @code{"error"}, and -@code{"$illegal"}; after these come the symbols defined in the grammar -file. +token whose internal Bison token code number is @var{i}. The first +three elements of @code{yytname} are always @code{"$"}, @code{"error"}, +and @code{"$undefined."}; after these come the symbols defined in the +grammar file. For single-character literal tokens and literal string tokens, the name in the table includes the single-quote or double-quote characters: for diff --git a/src/output.c b/src/output.c index 127950f..5b8ca10 100644 --- a/src/output.c +++ b/src/output.c @@ -344,11 +344,11 @@ prepare_tokens (void) /* Output YYTOKNUM. */ { int i; - int *values = XCALLOC (int, ntokens + 1); - for (i = 0; i < ntokens + 1; ++i) + int *values = XCALLOC (int, ntokens); + for (i = 0; i < ntokens; ++i) values[i] = symbols[i]->user_token_number; muscle_insert_int_table ("toknum", values, - 0, 1, ntokens + 1); + values[0], 1, ntokens); free (values); } } diff --git a/tests/regression.at b/tests/regression.at index 468610e..d9578a4 100644 --- a/tests/regression.at +++ b/tests/regression.at @@ -587,9 +587,9 @@ static const char *const yytname[] = "$", "error", "$undefined.", "\"if\"", "\"const\"", "\"then\"", "\"else\"", "$axiom", "statement", "struct_stat", "if", "else", 0 }; -static const short yytoknum[] = +static const unsigned short yytoknum[] = { - 0, 256, 257, 258, 259, 260, 261, -1 + 0, 256, 257, 258, 259, 260, 261 }; static const unsigned char yyr1[] = { -- 2.7.4