mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-10 12:53:03 +00:00
Make it easier to write deterministic tests.
Continues Akim's work from his 2009-06-10 commits. * src/reader.c (check_and_convert_grammar): Don't add any symbols after the first symbols_do invocation. * src/symtab.c (symbols_sorted): New static global. (user_token_number_redeclaration): Update comments. (symbol_from_uniqstr): If a new symbol is being created, assert that symbols_sorted hasn't been allocated yet. (symbols_free): Free symbols_sorted. (symbols_cmp, symbols_cmp_qsort): New functions. (symbols_do): Sort symbol_table into symbols_sorted on first invocation. * tests/input.at (Numbered tokens): Recombine tests now that the output should be deterministic across multiple numbers.
This commit is contained in:
@@ -641,9 +641,6 @@ check_and_convert_grammar (void)
|
||||
if (nrules == 0)
|
||||
fatal (_("no rules in the input grammar"));
|
||||
|
||||
/* Report any undefined symbols and consider them nonterminals. */
|
||||
symbols_check_defined ();
|
||||
|
||||
/* If the user did not define her ENDTOKEN, do it now. */
|
||||
if (!endtoken)
|
||||
{
|
||||
@@ -654,6 +651,9 @@ check_and_convert_grammar (void)
|
||||
endtoken->user_token_number = 0;
|
||||
}
|
||||
|
||||
/* Report any undefined symbols and consider them nonterminals. */
|
||||
symbols_check_defined ();
|
||||
|
||||
/* Find the start symbol if no %start. */
|
||||
if (!start_flag)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user