mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-10 04:43:03 +00:00
java: use full locations for diagnostics about destructors
Currently we use the syncline to report errors about a symbol's destructor/printer. This is not accurate (only file and line), and this is incorrect: the file name is double quotes (a recent change, needed to make sure we escape properly double quotes in it). And worst of all: with --no-line, b4_syncline expands to nothing. Rather, push the locations into the backend, and use them. * src/muscle-tab.h, src/muscle-tab.c (muscle_location_grow): Make it public. * src/output.c (prepare_symbol_definitions): Use it to pubish the location of the printer and destructor. * data/skeletons/lalr1.java: Use complain_at instead of complain. * tests/java.at (Java invalid directives): Adjust expectations. * data/skeletons/bison.m4 (b4_symbol_action_location): Remove. We should not use b4_syncline this way.
This commit is contained in:
@@ -282,11 +282,7 @@ muscle_boundary_grow (char const *key, boundary bound)
|
||||
}
|
||||
|
||||
|
||||
/* In the format '[[file_name:line.column]], [[file_name:line.column]]',
|
||||
append LOC to MUSCLE. Use digraphs for special characters in each
|
||||
file name. */
|
||||
|
||||
static void
|
||||
void
|
||||
muscle_location_grow (char const *key, location loc)
|
||||
{
|
||||
muscle_boundary_grow (key, loc.start);
|
||||
|
||||
@@ -119,6 +119,11 @@ void muscle_pair_list_grow (const char *muscle,
|
||||
void muscle_user_name_list_grow (char const *key, char const *user_name,
|
||||
location loc);
|
||||
|
||||
/* In the format '[[file_name:line.column]], [[file_name:line.column]]',
|
||||
append LOC to MUSCLE. Use digraphs for special characters in each
|
||||
file name. */
|
||||
void muscle_location_grow (char const *key, location loc);
|
||||
|
||||
/* Indicates whether a variable's value was specified with -D/--define, with
|
||||
-F/--force-define, or in the grammar file. */
|
||||
typedef enum {
|
||||
|
||||
@@ -478,6 +478,9 @@ prepare_symbol_definitions (void)
|
||||
SET_KEY2 (pname, "line");
|
||||
MUSCLE_INSERT_INT (key, p->location.start.line);
|
||||
|
||||
SET_KEY2 (pname, "loc");
|
||||
muscle_location_grow (key, p->location);
|
||||
|
||||
SET_KEY (pname);
|
||||
MUSCLE_INSERT_STRING_RAW (key, p->code);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user