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:
Joel E. Denny
2009-08-08 20:19:01 -04:00
parent 28169bab1f
commit 83b60c97ee
4 changed files with 72 additions and 33 deletions

View File

@@ -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)
{