This series of patches builds on top of the previous one (https://lists.gnu.org/r/bison-patches/2020-01/msg00044.html). It brings the following features with parse.error=custom or detailed (which I prefer to my previous proposal, 'rich').
Comments and feedback would be most useful. It is again also available on Savannah, and here: https://github.com/akimd/bison/pull/22. 1. Faithfulness The token strings are no longer doubly-quoted, and no longer depend on the current locale. So for instance %token MAXWELL "ββΓπΈβ = -βπ΅β/βt" gives with an UTF-8 able locale static const char *const yytname[] = { "$end", "error", "$undefined", "\"ββΓπΈβ = -βπ΅β/βt\"", "$accept", "e", YY_NULLPTR }; With the C locale, you get static const char *const yytname[] = { "$end", "error", "$undefined", "\"\\342\\210\\207\\342\\203\\227\\303\\227\\360\\235\\220\\270\\342\\203\\227 = -\\342\\210\\202\\360\\235\\220\\265\\342\\203\\227/\\342\\210\\202t\"", "$accept", "e", YY_NULLPTR }; With custom/detailed, you always get static const char *const yy_sname[] = { "$end", "error", "$undefined", "ββΓπΈβ = -βπ΅β/βt", "$accept", "e", YY_NULLPTR }; 2. Internationalization Token aliases can be (selectively) translated. For instance in the gramnar file %token NUMBER _("number") in which case the yysymbol_name function returns _("number") instead of "number". It is the user responsibility to define a _ function (and N_). data/skeletons/bison.m4 | 13 +- data/skeletons/c.m4 | 2 +- data/skeletons/glr.c | 126 ++++---- data/skeletons/yacc.c | 55 +++- src/output.c | 89 +++++- src/parse-gram.c | 657 +++++++++++++++++++--------------------- src/parse-gram.h | 131 ++++---- src/parse-gram.y | 28 +- src/scan-gram.l | 25 +- src/symtab.c | 3 +- src/symtab.h | 7 +- tests/calc.at | 77 +++-- tests/local.at | 5 +- tests/regression.at | 24 +- 14 files changed, 691 insertions(+), 551 deletions(-) -- 2.24.1
