mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
yacc.c: add support for parse.error detailed
"detailed" error messages are almost like "verbose", except that we don't double escape them, they don't get inner quotes, we don't use yytnamerr, and we hide the table. "custom" is exposed with the "detailed" tokens, not the "verbose" ones: they are not double-quoted. Because there's a risk that some people use yytname even without "verbose", let's keep yytname (instead of yys_name) in "simple" parse.error. * src/output.c (prepare_symbol_names): Be ready to output symbol names unquoted. (prepare_symbol_names): Output both the old tname table, and the new symbol_names one. * data/skeletons/bison.m4: Accept 'detailed'. * data/skeletons/yacc.c: When parse.error is 'detailed', don't emit yytname and yytnamerr, just yysymbol_name with the table inside. * tests/calc.at: Adjust.
This commit is contained in:
@@ -1018,16 +1018,17 @@ m4_define([b4_bison_locations_if],
|
||||
|
||||
# b4_error_verbose_if([IF-ERRORS-ARE-VERBOSE], [IF-NOT])
|
||||
# ------------------------------------------------------
|
||||
# Map %define parse.error "(custom|simple|verbose)" to b4_error_verbose_if and
|
||||
# b4_error_verbose_flag.
|
||||
# Map %define parse.error "(custom|detailed|simple|verbose)" to
|
||||
# b4_error_verbose_if and b4_error_verbose_flag.
|
||||
b4_percent_define_default([[parse.error]], [[simple]])
|
||||
b4_percent_define_check_values([[[[parse.error]],
|
||||
[[custom]], [[simple]], [[verbose]]]])
|
||||
[[custom]], [[detailed]], [[simple]], [[verbose]]]])
|
||||
m4_define([b4_error_verbose_flag],
|
||||
[m4_case(b4_percent_define_get([[parse.error]]),
|
||||
[custom], [[1]],
|
||||
[simple], [[0]],
|
||||
[verbose], [[1]])])
|
||||
[custom], [[1]],
|
||||
[detailed], [[1]],
|
||||
[simple], [[0]],
|
||||
[verbose], [[1]])])
|
||||
b4_define_flag_if([error_verbose])
|
||||
|
||||
# yytoken_table is needed to support verbose errors.
|
||||
|
||||
Reference in New Issue
Block a user