From c03ae9665927bdbb60fcf83654e11ed0d4b25e96 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Sat, 29 Dec 2001 14:19:31 +0000 Subject: [PATCH] * src/reader.c, src/reader.h (user_toknums): Remove. Adjust all users to use symbols[i]->user_token_number. --- ChangeLog | 6 ++++++ src/output.c | 14 ++++++++++---- src/reader.c | 3 --- src/reader.h | 1 - 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 849440c3..969bf196 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2001-12-29 Akim Demaille + + * src/reader.c, src/reader.h (user_toknums): Remove. + Adjust all users to use symbols[i]->user_token_number. + + 2001-12-29 Akim Demaille * src/gram.c, src/gram.h (sprec, sassoc): Remove. diff --git a/src/output.c b/src/output.c index fe029d41..37ce24cf 100644 --- a/src/output.c +++ b/src/output.c @@ -276,9 +276,16 @@ output_rule_data (void) muscle_insert ("tname", obstack_finish (&format_obstack)); /* Output YYTOKNUM. */ - output_table_data (&format_obstack, user_toknums, - 0, 1, ntokens + 1); - muscle_insert ("toknum", obstack_finish (&format_obstack)); + { + short *values = XCALLOC (short, ntokens + 1); + for (i = 0; i < ntokens + 1; ++i) + values[i] = symbols[i]->user_token_number; + output_table_data (&format_obstack, values, + 0, 1, ntokens + 1); + muscle_insert ("toknum", obstack_finish (&format_obstack)); + XFREE (values); + } + /* Output YYR1. */ { @@ -1102,7 +1109,6 @@ output (void) if (semantic_parser) output_stos (); output_rule_data (); - XFREE (user_toknums); output_actions (); prepare (); diff --git a/src/reader.c b/src/reader.c index cff0f911..527194e0 100644 --- a/src/reader.c +++ b/src/reader.c @@ -52,7 +52,6 @@ typedef struct symbol_list } symbol_list; int lineno; -short *user_toknums; static symbol_list *grammar; static int start_flag; static bucket *startval; @@ -1567,7 +1566,6 @@ packsymbols (void) int tokno = 1; int last_user_token_number; - user_toknums = XCALLOC (short, nsyms + 1); symbols = XCALLOC (bucket *, nsyms); max_user_token_number = 256; @@ -1640,7 +1638,6 @@ packsymbols (void) } symbols[bp->value] = bp; - user_toknums[bp->value] = bp->user_token_number; } token_translations_init (); diff --git a/src/reader.h b/src/reader.h index e4c77c2f..5c6c9027 100644 --- a/src/reader.h +++ b/src/reader.h @@ -31,6 +31,5 @@ extern void reader PARAMS ((void)); extern int lineno; -extern short *user_toknums; #endif /* !READER_H_ */ -- 2.45.2