* 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

@@ -158,7 +158,8 @@ braced_code_t current_braced_code = action_braced_code;
%type <string> STRING string_content
BRACED_CODE PROLOGUE EPILOGUE epilogue.opt action
BRACED_CODE action
PROLOGUE EPILOGUE
%type <struniq> TYPE
%type <integer> INT
%type <symbol> ID symbol string_as_id
@@ -170,7 +171,6 @@ input:
declarations "%%" grammar epilogue.opt
{
yycontrol->errcode = 0;
epilogue_set ($4, @4);
}
;
@@ -418,12 +418,10 @@ string_content:
epilogue.opt:
/* Nothing. */
{
$$ = xstrdup ("");
}
| "%%" EPILOGUE
{
$$ = $2;
epilogue_augment ($2, @2);
scanner_last_string_free ();
}
;
@@ -464,6 +462,10 @@ yyprint (FILE *file,
case EPILOGUE:
fprintf (file, " = {{ %s }}", value->string);
break;
default:
fprintf (file, "unknown token type");
break;
}
}