mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-16 15:53:03 +00:00
parser: use grammar_file instead of current_file
* src/parse-gram (%initial-action): here. (handle_skeleton): Don't depend on the current file name to look for "local" skeletons (subject to changes coming from "#lines"): depend only on the initial file name, the one given on the command line.
This commit is contained in:
@@ -136,8 +136,8 @@
|
|||||||
{
|
{
|
||||||
/* Bison's grammar can initial empty locations, hence a default
|
/* Bison's grammar can initial empty locations, hence a default
|
||||||
location is needed. */
|
location is needed. */
|
||||||
boundary_set (&@$.start, current_file, 1, 1, 1);
|
boundary_set (&@$.start, grammar_file, 1, 1, 1);
|
||||||
boundary_set (&@$.end, current_file, 1, 1, 1);
|
boundary_set (&@$.end, grammar_file, 1, 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Define the tokens together with their human representation. */
|
/* Define the tokens together with their human representation. */
|
||||||
@@ -1033,16 +1033,16 @@ handle_skeleton (location const *loc, char const *skel)
|
|||||||
char const *skeleton_user = skel;
|
char const *skeleton_user = skel;
|
||||||
if (strchr (skeleton_user, '/'))
|
if (strchr (skeleton_user, '/'))
|
||||||
{
|
{
|
||||||
size_t dir_length = strlen (current_file);
|
size_t dir_length = strlen (grammar_file);
|
||||||
while (dir_length && current_file[dir_length - 1] != '/')
|
while (dir_length && grammar_file[dir_length - 1] != '/')
|
||||||
--dir_length;
|
--dir_length;
|
||||||
while (dir_length && current_file[dir_length - 1] == '/')
|
while (dir_length && grammar_file[dir_length - 1] == '/')
|
||||||
--dir_length;
|
--dir_length;
|
||||||
char *skeleton_build =
|
char *skeleton_build =
|
||||||
xmalloc (dir_length + 1 + strlen (skeleton_user) + 1);
|
xmalloc (dir_length + 1 + strlen (skeleton_user) + 1);
|
||||||
if (dir_length > 0)
|
if (dir_length > 0)
|
||||||
{
|
{
|
||||||
memcpy (skeleton_build, current_file, dir_length);
|
memcpy (skeleton_build, grammar_file, dir_length);
|
||||||
skeleton_build[dir_length++] = '/';
|
skeleton_build[dir_length++] = '/';
|
||||||
}
|
}
|
||||||
strcpy (skeleton_build + dir_length, skeleton_user);
|
strcpy (skeleton_build + dir_length, skeleton_user);
|
||||||
|
|||||||
Reference in New Issue
Block a user