mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-12 22:03:02 +00:00
multistart: turn start symbols into rules on $accept
Now that the parser can read several start symbols, let's process them, and create the corresponding rules. * src/parse-gram.y (grammar_declaration): Accept a list of start symbols. * src/reader.h, src/reader.c (grammar_start_symbol_set): Rename as... (grammar_start_symbols_set): this. * src/reader.h, src/reader.c (start_flag): Replace with... (start_symbols): this. * src/reader.c (grammar_start_symbols_set): Build a list of start symbols. (switching_token, create_start_rules): New. (check_and_convert_grammar): Use them to turn the list of start symbols into a set of rules. * src/reduce.c (nonterminals_reduce): Don't complain about $accept, it's an internal detail. (reduce_grammar): Complain about all the start symbols that don't derive sentences. * src/symtab.c (startsymbol, startsymbol_loc): Remove, replaced by start_symbols. symbols_pack): Move the check about the start symbols to... * src/symlist.c (check_start_symbols): here. Adjust to multiple start symbols. * tests/reduce.at (Empty Language): Generalize into... (Bad start symbols): this.
This commit is contained in:
11
src/symtab.c
11
src/symtab.c
@@ -60,8 +60,6 @@ symbol *errtoken = NULL;
|
||||
symbol *undeftoken = NULL;
|
||||
symbol *eoftoken = NULL;
|
||||
symbol *acceptsymbol = NULL;
|
||||
symbol *startsymbol = NULL;
|
||||
location startsymbol_loc;
|
||||
|
||||
/* Precedence relation graph. */
|
||||
static symgraph **prec_nodes;
|
||||
@@ -1146,15 +1144,6 @@ symbols_pack (void)
|
||||
|
||||
symbols_token_translations_init ();
|
||||
|
||||
if (startsymbol->content->class == unknown_sym)
|
||||
complain (&startsymbol_loc, fatal,
|
||||
_("the start symbol %s is undefined"),
|
||||
startsymbol->tag);
|
||||
else if (startsymbol->content->class == token_sym)
|
||||
complain (&startsymbol_loc, fatal,
|
||||
_("the start symbol %s is a token"),
|
||||
startsymbol->tag);
|
||||
|
||||
// If some user tokens are internationalized, the internal ones
|
||||
// should be too.
|
||||
if (has_translations ())
|
||||
|
||||
Reference in New Issue
Block a user