mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-11 13:23:04 +00:00
Merge remote-tracking branch 'origin/maint'
* origin/maint: parser: accept #line NUM m4: use a safer pattern to enable/disable output tests: beware of gnulib's need for config.h gnulib: update yacc.c, glr.c: check and fix the display of locations formatting changes glr.c: remove stray macro Conflicts: data/c.m4 data/glr.cc data/lalr1.cc data/lalr1.java data/location.cc data/stack.hh data/yacc.c src/scan-gram.l
This commit is contained in:
@@ -107,7 +107,7 @@ location_print (FILE *out, location loc)
|
||||
quotearg_n_style (3, escape_quoting_style, loc.start.file));
|
||||
if (0 <= loc.start.line)
|
||||
{
|
||||
res += fprintf(out, ":%d", loc.start.line);
|
||||
res += fprintf (out, ":%d", loc.start.line);
|
||||
if (0 <= loc.start.column)
|
||||
res += fprintf (out, ".%d", loc.start.column);
|
||||
}
|
||||
@@ -118,7 +118,7 @@ location_print (FILE *out, location loc)
|
||||
loc.end.file));
|
||||
if (0 <= loc.end.line)
|
||||
{
|
||||
res += fprintf(out, ":%d", loc.end.line);
|
||||
res += fprintf (out, ":%d", loc.end.line);
|
||||
if (0 <= end_col)
|
||||
res += fprintf (out, ".%d", end_col);
|
||||
}
|
||||
|
||||
@@ -193,7 +193,7 @@ eqopt ([[:space:]]*=)?
|
||||
|
||||
/* #line directives are not documented, and may be withdrawn or
|
||||
modified in future versions of Bison. */
|
||||
^"#line "{int}" \"".*"\"\n" {
|
||||
^"#line "{int}(" \"".*"\"")?"\n" {
|
||||
handle_syncline (yytext + sizeof "#line " - 1, *loc);
|
||||
}
|
||||
}
|
||||
@@ -974,23 +974,27 @@ convert_ucn_to_byte (char const *ucn)
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------.
|
||||
| Handle '#line INT "FILE"'. ARGS has already skipped '#line '. |
|
||||
`----------------------------------------------------------------*/
|
||||
/*---------------------------------------------------------------------.
|
||||
| Handle '#line INT( "FILE")?\n'. ARGS has already skipped '#line '. |
|
||||
`---------------------------------------------------------------------*/
|
||||
|
||||
static void
|
||||
handle_syncline (char *args, location loc)
|
||||
{
|
||||
char *after_num;
|
||||
unsigned long int lineno = strtoul (args, &after_num, 10);
|
||||
char *file = strchr (after_num, '"') + 1;
|
||||
*strchr (file, '"') = '\0';
|
||||
char *file;
|
||||
unsigned long int lineno = strtoul (args, &file, 10);
|
||||
if (INT_MAX <= lineno)
|
||||
{
|
||||
complain (&loc, Wother, _("line number overflow"));
|
||||
lineno = INT_MAX;
|
||||
}
|
||||
current_file = uniqstr_new (file);
|
||||
|
||||
file = strchr (file, '"');
|
||||
if (file)
|
||||
{
|
||||
*strchr (file + 1, '"') = '\0';
|
||||
current_file = uniqstr_new (file + 1);
|
||||
}
|
||||
boundary_set (&scanner_cursor, current_file, lineno, 1);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user