mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-15 07:13:02 +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:
@@ -261,3 +261,18 @@ muscles_m4_output (FILE *out)
|
||||
{
|
||||
hash_do_for_each (muscle_table, muscle_m4_output_processor, out);
|
||||
}
|
||||
|
||||
void
|
||||
muscle_boundary_grow (char const *key, boundary bound)
|
||||
{
|
||||
char *extension;
|
||||
MUSCLE_OBSTACK_SGROW (&muscle_obstack, bound.file);
|
||||
obstack_1grow (&muscle_obstack, ':');
|
||||
obstack_fgrow1 (&muscle_obstack, "%d", bound.line);
|
||||
obstack_1grow (&muscle_obstack, '.');
|
||||
obstack_fgrow1 (&muscle_obstack, "%d", bound.column);
|
||||
obstack_1grow (&muscle_obstack, '\0');
|
||||
extension = obstack_finish (&muscle_obstack);
|
||||
muscle_grow (key, extension, "");
|
||||
obstack_free (&muscle_obstack, extension);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user