I feel it's helpful to print Tokens in grammar_dump likewise Variables in grammar_dump.
How do you think about it? commit 5b52c99ac76923401b93d9bc6d05b3e206a2c0d7 (HEAD -> print_tokens) Author: Yuichiro Kaneko <[email protected]> Date: Tue Oct 22 12:18:32 2019 +0900 gram.c: Print tokens in grammar_dump * src/gram.c (grammar_dump): Print tokens likewise variables * tests/sets.at (Reduced Grammar): Update test case to catch up the change. diff --git a/src/gram.c b/src/gram.c index 5753f70f..e8c79263 100644 --- a/src/gram.c +++ b/src/gram.c @@ -259,6 +259,17 @@ grammar_dump (FILE *out, const char *title) "ntokens = %d, nvars = %d, nsyms = %d, nrules = %d, nritems = %d\n\n", ntokens, nvars, nsyms, nrules, nritems); + fprintf (out, "Tokens\n---------\n\n"); + { + fprintf (out, "Value Sprec Sassoc Tag\n"); + + for (symbol_number i = 0; i < ntokens; i++) + fprintf (out, "%5d %5d %5d %s\n", + i, + symbols[i]->content->prec, symbols[i]->content->assoc, + symbols[i]->tag); + fprintf (out, "\n\n"); + } fprintf (out, "Variables\n---------\n\n"); { diff --git a/tests/sets.at b/tests/sets.at index 5dbc50dc..80f95aac 100644 --- a/tests/sets.at +++ b/tests/sets.at @@ -329,6 +329,19 @@ Reduced Grammar ntokens = 7, nvars = 4, nsyms = 11, nrules = 6, nritems = 17 +Tokens +--------- + +Value Sprec Sassoc Tag + 0 0 0 $end + 1 0 0 error + 2 0 0 $undefined + 3 0 0 "+" + 4 0 0 "*" + 5 0 0 "useless" + 6 0 0 "num" + + Variables ---------
