* src/scan-gram.l, src/reader.h (scanner_last_string_free):

Restore.
* src/scan-gram.l (last_string): Is global to the file, not to
yylex.
* src/parse-gram.y (input): Don't append the epilogue here,
(epilogue.opt): do it here, and free the scanner's obstack.
* src/reader.c (epilogue_set): Rename as...
(epilogue_augment): this.
* data/c.m4 (b4_epilogue): Defaults to empty.
This commit is contained in:
Akim Demaille
2002-11-12 08:26:38 +00:00
parent 573a6cd356
commit 7ec2d4cd39
7 changed files with 56 additions and 27 deletions

View File

@@ -142,6 +142,10 @@ extend_location (location_t *loc, char const *token, int size)
static struct obstack string_obstack;
/* A string representing the most recently saved token. */
static char *last_string;
#define YY_OBS_GROW \
obstack_grow (&string_obstack, yytext, yyleng)
@@ -154,6 +158,11 @@ static struct obstack string_obstack;
#define YY_OBS_FREE \
obstack_free (&string_obstack, last_string)
void
scanner_last_string_free (void)
{
YY_OBS_FREE;
}
/* Within well-formed rules, RULE_LENGTH is the number of values in
the current rule so far, which says where to find `$0' with respect
@@ -199,9 +208,6 @@ splice (\\[ \f\t\v]*\n)*
/* Scanner context when scanning C code. */
int c_context IF_LINT (= 0);
/* A string representing the most recently saved token. */
char *last_string;
/* At each yylex invocation, mark the current position as the
start of the next token. */
YY_STEP;