mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 20:33:03 +00:00
reader: reduce the "scope" of global variables
We have too many global variables, adding structure would help. For a start, let's hide some of the variables closer to their usage. * src/getargs.c, src/files.h (current_file): Move to... * src/scan-gram.c: here. * src/scan-gram.h (gram_in, gram__flex_debug): Remove, make them private to the scanner. * src/reader.h, src/reader.c (reader): Take a grammar file as argument. Move the handling of scanner variables to... * src/scan-gram.l (gram_scanner_open, gram_scanner_close): here. (gram_scanner_initialize): Remove, replaced by gram_scanner_open. * src/main.c: Adjust.
This commit is contained in:
12
src/reader.c
12
src/reader.c
@@ -710,24 +710,20 @@ packgram (void)
|
||||
`------------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
reader (void)
|
||||
reader (const char *gram)
|
||||
{
|
||||
/* Set up symbol_table, semantic_type_table, and the built-in
|
||||
symbols. */
|
||||
symbols_new ();
|
||||
|
||||
gram_in = xfopen (grammar_file, "r");
|
||||
|
||||
gram__flex_debug = trace_flag & trace_scan;
|
||||
gram_debug = trace_flag & trace_parse;
|
||||
gram_scanner_initialize ();
|
||||
gram_scanner_open (gram);
|
||||
gram_parse ();
|
||||
gram_scanner_close ();
|
||||
|
||||
prepare_percent_define_front_end_variables ();
|
||||
|
||||
if (complaint_status < status_complaint)
|
||||
check_and_convert_grammar ();
|
||||
|
||||
xfclose (gram_in);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
Reference in New Issue
Block a user