When reducing initial empty rules, Bison parser read an initial

location that is not defined.  This results in garbage, and that
affects Bison's own parser.  Therefore we need (i) to extend Bison
to support a means to initialize this location, and (ii) to use
this CVS Bison to fix CVS Bison's parser.
* src/reader.h, reader.c (epilogue_augment): Remove, replace
with...
* src/muscle_tab.h, src/muscle_tab.c (muscle_code_grow): this.
* src/parse-gram.y: Adjust.
(%initial-action): New.
(%error-verbose): Since we require CVS Bison, there is no reason
not to use it.
* src/scan-gram.l: Adjust.
* src/Makefile.am (YACC): New, to make sure we use our own parser.
* data/yacc.c (yyparse): Use b4_initial_action.
This commit is contained in:
Akim Demaille
2003-08-25 15:16:25 +00:00
parent 388f8b197d
commit cd3684cfa8
12 changed files with 524 additions and 434 deletions

View File

@@ -154,6 +154,26 @@ muscle_grow (const char *key, const char *val, const char *separator)
}
/*------------------------------------------------------------------.
| Append VALUE to the current value of KEY, using muscle_grow. But |
| in addition, issue a synchronization line for the location LOC. |
`------------------------------------------------------------------*/
void
muscle_code_grow (const char *key, const char *val, location loc)
{
char *extension = NULL;
obstack_fgrow1 (&muscle_obstack, "]b4_syncline([[%d]], [[", loc.start.line);
MUSCLE_OBSTACK_SGROW (&muscle_obstack,
quotearg_style (c_quoting_style, loc.start.file));
obstack_sgrow (&muscle_obstack, "]])[\n");
obstack_sgrow (&muscle_obstack, val);
obstack_1grow (&muscle_obstack, 0);
extension = obstack_finish (&muscle_obstack);
muscle_grow (key, extension, "");
}
/*-------------------------------------------------------------------.
| MUSCLE is an M4 list of pairs. Create or extend it with the pair |
| (A1, A2). Note that because the muscle values are output *double* |