X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/93ede233f5c0a96c0c4dc37b4b43d288d008f4e4..7742ddebf1f73cc15138d41c11a39f32b43c3ef5:/src/reader.c diff --git a/src/reader.c b/src/reader.c index f1577b48..9bec971a 100644 --- a/src/reader.c +++ b/src/reader.c @@ -1738,12 +1738,12 @@ symbols_save (void) if (c != '\0') continue; - obstack_fgrow2 (&tokendefs, "# define\t%s\t%d\n", + obstack_fgrow2 (&tokendefs, "# define %s\t%d\n", symbol, bp->user_token_number); if (semantic_parser) /* FIXME: This is probably wrong, and should be just as above. --akim. */ - obstack_fgrow2 (&tokendefs, "# define\tT%s\t%d\n", symbol, bp->value); + obstack_fgrow2 (&tokendefs, "# define T%s\t%d\n", symbol, bp->value); } obstack_1grow (&tokendefs, 0); @@ -1865,6 +1865,14 @@ reader (void) undeftoken->class = token_sym; undeftoken->user_token_number = 2; + /* Initialize the obstacks. */ + obstack_init (&action_obstack); + obstack_init (&attrs_obstack); + obstack_init (&guard_obstack); + obstack_init (&output_obstack); + + finput = xfopen (infile, "r"); + /* Read the declaration section. Copy %{ ... %} groups to TABLE_OBSTACK and FDEFINES file. Also notice any %token, %left, etc. found there. */ @@ -1875,6 +1883,9 @@ reader (void) /* Some C code is given at the end of the grammar file. */ read_additionnal_code (); + lex_free (); + xfclose (finput); + /* Assign the symbols their symbol numbers. Write #defines for the token symbols into FDEFINES if requested. */ packsymbols ();