Add syncline support and location accessor to internal %define

interfaces.
* data/bison.m4 (b4_percent_define_get_loc): New.
(b4_percent_define_get_syncline): New.
(b4_percent_define_flag_if): Use b4_percent_define_get_loc.
(b4_percent_define_default): Record defining location as line 1 rather
than 0 for the sake of synchronizing #line's, and define
b4_percent_define_syncline(VARIABLE).
(b4_percent_define_check_values): Use b4_percent_define_get_loc.
* src/muscle_tab.c (muscle_syncline_grow): New.
(muscle_code_grow): Use muscle_syncline_grow.
(muscle_percent_define_insert): Use muscle_percent_define_get_loc, and
define b4_percent_define_syncline(VARIABLE).
(muscle_percent_define_get_loc): New.
(muscle_percent_define_get_syncline): New.
(muscle_percent_define_flag_if): Use muscle_percent_define_get_loc, and
remove some unused variables.
(muscle_percent_define_default): Record defining location as line 1
rather than 0 for the sake of synchronizing #line's, and define
b4_percent_define_syncline(VARIABLE).
(muscle_percent_define_check_values): Use
muscle_percent_define_get_loc.
* src/muscle_tab.h (muscle_percent_define_get_loc): Prototype.
(muscle_percent_define_get_syncline): Prototype.
* tests/skeletons.at (%define Boolean variables: invalid skeleton
defaults): Update output for location change.
(Complaining during macro argument expansion): Extend to test
b4_percent_define_get_loc and b4_percent_define_get_syncline errors.
This commit is contained in:
Joel E. Denny
2007-10-08 04:00:13 +00:00
parent 7dc4a6940c
commit 35b8730d01
5 changed files with 181 additions and 34 deletions

View File

@@ -136,6 +136,22 @@ void muscle_percent_define_insert (char const *variable, location variable_loc,
freeing the memory of the returned string. */
char *muscle_percent_define_get (char const *variable);
/* Mimic muscle_percent_define_get_loc in ../data/bison.m4 exactly. That is,
if the %define variable VARIABLE is undefined, complain fatally since that's
a Bison error. Otherwise, return its definition location in a form
approriate for the first argument of warn_at, complain_at, or fatal_at.
Don't record this as a Bison usage of VARIABLE as there's no reason to
suspect that the user-supplied value has yet influenced the output. */
location muscle_percent_define_get_loc (char const *variable);
/* Mimic muscle_percent_define_get_syncline in ../data/bison.m4 exactly. That
is, if the %define variable VARIABLE is undefined, complain fatally since
that's a Bison error. Otherwise, return its definition location as a
b4_syncline invocation. Don't record this as a Bison usage of VARIABLE as
there's no reason to suspect that the user-supplied value has yet influenced
the output. */
char const *muscle_percent_define_get_syncline (char const *variable);
/* Mimic b4_percent_define_ifdef in ../data/bison.m4 exactly. That is, if the
%define variable VARIABLE is defined, return true. Otherwise, return false.
Also, record Bison's usage of VARIABLE by defining