mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
Provide warn_at, complain_at, and fatal_at function callbacks to the
skeletons, and use this for %code qualifier complaints. * data/bison.m4 (b4_error_at): New, invoked by... (b4_warn_at, b4_complain_at, b4_fatal_at): ... these new macros to wrap the skeleton scanner's new @warn_at(...@), @complain_at(...@), and @fatal_at(...@) directives. (b4_check_percent_code_qualifiers): Rewrite to expect locations for qualifiers in b4_used_percent_code_qualifiers and to use b4_complain_at. * src/location.c, src/location.h (boundary_set_from_string): New global function. * src/muscle_tab.c, src/muscle_tab.h (muscle_boundary_grow): New global function. * src/parse-gram.y (grammar_declaration): Add locations for qualifiers to b4_used_percent_code_qualifiers. * src/scan-skel.l (fail_for_at_directive_too_few_args): New static function. (AT_DIRECTIVE_ARGC_MAX): Increase for boundary arguments. (lineno): Rename to... (out_lineno): ... this so I don't misunderstand it again. (SC_AT_DIRECTIVE_SKIP_WS): Don't increment out_lineno for newlines here; these newlines are in the input but not the output file. (SC_AT_DIRECTIVE_ARG): Likewise. Extract directive execution to... (at_directive_perform): ... this new static function, and add handling of new @warn_at(...@), @complain_at(...@), and @fatal_at(...@) directives. * tests/input.at (Reject bad %code qualifiers): Update test output with locations and extend. * tests/output.at (Output file name: [, Output file name: ]): Remove bogus comment about these tests failing.
This commit is contained in:
@@ -711,38 +711,80 @@ AT_SETUP([Reject bad %code qualifiers])
|
||||
|
||||
AT_DATA([input-c.y],
|
||||
[[%code "" {}
|
||||
%code "bad" {}
|
||||
%code "bad" {}
|
||||
%%
|
||||
start: ;
|
||||
]])
|
||||
AT_CHECK([[bison input-c.y]], [1], [],
|
||||
[[input-c.y: `' is not a recognized %code qualifier
|
||||
[[input-c.y:1.7-8: `' is not a recognized %code qualifier
|
||||
input-c.y:2.7-11: `bad' is not a recognized %code qualifier
|
||||
input-c.y:3.7-11: `bad' is not a recognized %code qualifier
|
||||
]])
|
||||
|
||||
AT_DATA([input-c-glr.y],
|
||||
[[%code "bad" {}
|
||||
[[%code "" {}
|
||||
%code "bad" {}
|
||||
%code "bad" {}
|
||||
%%
|
||||
start: ;
|
||||
]])
|
||||
AT_CHECK([[bison input-c-glr.y]], [1], [],
|
||||
[[input-c-glr.y: `bad' is not a recognized %code qualifier
|
||||
[[input-c-glr.y:1.7-8: `' is not a recognized %code qualifier
|
||||
input-c-glr.y:2.7-11: `bad' is not a recognized %code qualifier
|
||||
input-c-glr.y:3.8-12: `bad' is not a recognized %code qualifier
|
||||
]])
|
||||
|
||||
AT_DATA([input-c++.y],
|
||||
[[%code "bad" {}
|
||||
[[%code "" {}
|
||||
%code "bad" {}
|
||||
%code "" {}
|
||||
%%
|
||||
start: ;
|
||||
]])
|
||||
AT_CHECK([[bison input-c++.y]], [1], [],
|
||||
[[input-c++.y: `bad' is not a recognized %code qualifier
|
||||
[[input-c++.y:1.7-8: `' is not a recognized %code qualifier
|
||||
input-c++.y:2.7-11: `bad' is not a recognized %code qualifier
|
||||
input-c++.y:3.8-9: `' is not a recognized %code qualifier
|
||||
]])
|
||||
|
||||
AT_DATA([input-c++-glr.y],
|
||||
[[%code "bad" {}
|
||||
%code "" {}
|
||||
%code "" {}
|
||||
%%
|
||||
start: ;
|
||||
]])
|
||||
AT_CHECK([[bison input-c++-glr.y]], [1], [],
|
||||
[[input-c++-glr.y: `bad' is not a recognized %code qualifier
|
||||
[[input-c++-glr.y:1.7-11: `bad' is not a recognized %code qualifier
|
||||
input-c++-glr.y:2.7-8: `' is not a recognized %code qualifier
|
||||
input-c++-glr.y:3.7-8: `' is not a recognized %code qualifier
|
||||
]])
|
||||
|
||||
AT_DATA([special-char-@@.y],
|
||||
[[%code "bad" {}
|
||||
%code "" {}
|
||||
%code "" {}
|
||||
%%
|
||||
start: ;
|
||||
]])
|
||||
AT_CHECK([[bison special-char-@@.y]], [1], [],
|
||||
[[special-char-@@.y:1.7-11: `bad' is not a recognized %code qualifier
|
||||
special-char-@@.y:2.7-8: `' is not a recognized %code qualifier
|
||||
special-char-@@.y:3.7-8: `' is not a recognized %code qualifier
|
||||
]])
|
||||
|
||||
AT_DATA([special-char-@:>@.y],
|
||||
[[%code "bad" {}
|
||||
%code "" {}
|
||||
%code "" {}
|
||||
%%
|
||||
start: ;
|
||||
]])
|
||||
AT_CHECK([[bison special-char-@:>@.y]], [1], [],
|
||||
[[special-char-@:>@.y:1.7-11: `bad' is not a recognized %code qualifier
|
||||
special-char-@:>@.y:2.7-8: `' is not a recognized %code qualifier
|
||||
special-char-@:>@.y:3.7-8: `' is not a recognized %code qualifier
|
||||
]])
|
||||
|
||||
AT_CLEANUP
|
||||
|
||||
@@ -193,8 +193,5 @@ AT_CHECK_OUTPUT_FILE_NAME([[#]])
|
||||
AT_CHECK_OUTPUT_FILE_NAME([[@@]])
|
||||
AT_CHECK_OUTPUT_FILE_NAME([[@{]])
|
||||
AT_CHECK_OUTPUT_FILE_NAME([[@}]])
|
||||
|
||||
# Bison isn't M4-quoting file names before inserting them into muscles, so
|
||||
# these tests currently fail.
|
||||
AT_CHECK_OUTPUT_FILE_NAME([[@<:@]])
|
||||
AT_CHECK_OUTPUT_FILE_NAME([[@:>@]])
|
||||
|
||||
Reference in New Issue
Block a user