mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-26 12:43:03 +00:00
* src/main.c (main): Free `infile'.
* src/scan-gram.l (handle_syncline): New. Recognize `#line'. * src/output.c (user_actions_output, symbol_destructors_output) (symbol_printers_output): Use the location's file name, not infile. * src/reader.c (prologue_augment, epilogue_set): Likewise.
This commit is contained in:
10
ChangeLog
10
ChangeLog
@@ -1,3 +1,13 @@
|
|||||||
|
2002-11-06 Akim Demaille <akim@epita.fr>
|
||||||
|
|
||||||
|
* src/main.c (main): Free `infile'.
|
||||||
|
* src/scan-gram.l (handle_syncline): New.
|
||||||
|
Recognize `#line'.
|
||||||
|
* src/output.c (user_actions_output, symbol_destructors_output)
|
||||||
|
(symbol_printers_output): Use the location's file name, not
|
||||||
|
infile.
|
||||||
|
* src/reader.c (prologue_augment, epilogue_set): Likewise.
|
||||||
|
|
||||||
2002-11-05 Paul Hilfinger <Hilfinger@CS.Berkeley.EDU>
|
2002-11-05 Paul Hilfinger <Hilfinger@CS.Berkeley.EDU>
|
||||||
|
|
||||||
* src/tables.c (matching_state): Don't allow states to match if
|
* src/tables.c (matching_state): Don't allow states to match if
|
||||||
|
|||||||
3
NEWS
3
NEWS
@@ -21,6 +21,9 @@ Changes in version 1.75a, 2002-10-24:
|
|||||||
In addition, they provide a means for yyerror to remain pure, and
|
In addition, they provide a means for yyerror to remain pure, and
|
||||||
to access to the current location.
|
to access to the current location.
|
||||||
|
|
||||||
|
* #line
|
||||||
|
Bison now recognizes #line in its input, and forwards them.
|
||||||
|
|
||||||
Changes in version 1.75, 2002-10-14:
|
Changes in version 1.75, 2002-10-14:
|
||||||
|
|
||||||
* Bison should now work on 64-bit hosts.
|
* Bison should now work on 64-bit hosts.
|
||||||
|
|||||||
4
TODO
4
TODO
@@ -185,10 +185,6 @@ skeleton muscles. []
|
|||||||
** tests/pure-parser.at []
|
** tests/pure-parser.at []
|
||||||
New tests.
|
New tests.
|
||||||
|
|
||||||
* input synclines
|
|
||||||
Some users create their foo.y files, and equip them with #line. Bison
|
|
||||||
should recognize these, and preserve them.
|
|
||||||
|
|
||||||
* BTYacc
|
* BTYacc
|
||||||
See if we can integrate backtracking in Bison. Charles-Henri de
|
See if we can integrate backtracking in Bison. Charles-Henri de
|
||||||
Boysson <de-boy_c@epita.fr> is working on this, and already has some
|
Boysson <de-boy_c@epita.fr> is working on this, and already has some
|
||||||
|
|||||||
@@ -419,5 +419,5 @@ getargs (int argc, char *argv[])
|
|||||||
usage (EXIT_FAILURE);
|
usage (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
infile = argv[optind];
|
infile = xstrdup (argv[optind]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -158,6 +158,8 @@ main (int argc, char *argv[])
|
|||||||
reduce_free ();
|
reduce_free ();
|
||||||
conflicts_free ();
|
conflicts_free ();
|
||||||
grammar_free ();
|
grammar_free ();
|
||||||
|
/* FIXME: We are leaking all the other file names. */
|
||||||
|
free (infile);
|
||||||
|
|
||||||
/* The scanner memory cannot be released right after parsing, as it
|
/* The scanner memory cannot be released right after parsing, as it
|
||||||
contains things such as user actions, prologue, epilogue etc. */
|
contains things such as user actions, prologue, epilogue etc. */
|
||||||
|
|||||||
@@ -280,7 +280,7 @@ user_actions_output (FILE *out)
|
|||||||
fprintf (out, muscle_find ("linef"),
|
fprintf (out, muscle_find ("linef"),
|
||||||
rules[r].action_location.first_line,
|
rules[r].action_location.first_line,
|
||||||
quotearg_style (c_quoting_style,
|
quotearg_style (c_quoting_style,
|
||||||
muscle_find ("filename")));
|
rules[r].action_location.file));
|
||||||
fprintf (out, " %s\n break;\n\n",
|
fprintf (out, " %s\n break;\n\n",
|
||||||
rules[r].action);
|
rules[r].action);
|
||||||
}
|
}
|
||||||
@@ -381,7 +381,8 @@ symbol_destructors_output (FILE *out)
|
|||||||
destructor, typename. */
|
destructor, typename. */
|
||||||
fprintf (out, "%s[[[%s]], [[%d]], [[%s]], [[%d]], [[%s]], [[%s]]]",
|
fprintf (out, "%s[[[%s]], [[%d]], [[%s]], [[%d]], [[%s]], [[%s]]]",
|
||||||
first ? "" : ",\n",
|
first ? "" : ",\n",
|
||||||
infile, symbol->destructor_location.first_line,
|
symbol->destructor_location.file,
|
||||||
|
symbol->destructor_location.first_line,
|
||||||
symbol->tag,
|
symbol->tag,
|
||||||
symbol->number,
|
symbol->number,
|
||||||
symbol->destructor,
|
symbol->destructor,
|
||||||
@@ -414,7 +415,8 @@ symbol_printers_output (FILE *out)
|
|||||||
printer, typename. */
|
printer, typename. */
|
||||||
fprintf (out, "%s[[[%s]], [[%d]], [[%s]], [[%d]], [[%s]], [[%s]]]",
|
fprintf (out, "%s[[[%s]], [[%d]], [[%s]], [[%d]], [[%s]], [[%s]]]",
|
||||||
first ? "" : ",\n",
|
first ? "" : ",\n",
|
||||||
infile, symbol->printer_location.first_line,
|
symbol->printer_location.file,
|
||||||
|
symbol->printer_location.first_line,
|
||||||
symbol->tag,
|
symbol->tag,
|
||||||
symbol->number,
|
symbol->number,
|
||||||
symbol->printer,
|
symbol->printer,
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ prologue_augment (const char *prologue, location_t location)
|
|||||||
obstack_fgrow2 (oout, muscle_find ("linef"),
|
obstack_fgrow2 (oout, muscle_find ("linef"),
|
||||||
location.first_line,
|
location.first_line,
|
||||||
quotearg_style (c_quoting_style,
|
quotearg_style (c_quoting_style,
|
||||||
muscle_find ("filename")));
|
location.file));
|
||||||
}
|
}
|
||||||
obstack_sgrow (oout, prologue);
|
obstack_sgrow (oout, prologue);
|
||||||
}
|
}
|
||||||
@@ -94,7 +94,7 @@ epilogue_set (const char *epilogue, location_t location)
|
|||||||
obstack_fgrow2 (&muscle_obstack, muscle_find ("linef"),
|
obstack_fgrow2 (&muscle_obstack, muscle_find ("linef"),
|
||||||
location.first_line,
|
location.first_line,
|
||||||
quotearg_style (c_quoting_style,
|
quotearg_style (c_quoting_style,
|
||||||
muscle_find ("filename")));
|
location.file));
|
||||||
}
|
}
|
||||||
obstack_sgrow (&muscle_obstack, epilogue);
|
obstack_sgrow (&muscle_obstack, epilogue);
|
||||||
obstack_1grow (&muscle_obstack, 0);
|
obstack_1grow (&muscle_obstack, 0);
|
||||||
|
|||||||
1256
src/scan-gram.c
1256
src/scan-gram.c
File diff suppressed because it is too large
Load Diff
@@ -177,6 +177,7 @@ static void handle_dollar (braced_code_t code_kind,
|
|||||||
char *cp, location_t location);
|
char *cp, location_t location);
|
||||||
static void handle_at (braced_code_t code_kind,
|
static void handle_at (braced_code_t code_kind,
|
||||||
char *cp, location_t location);
|
char *cp, location_t location);
|
||||||
|
static void handle_syncline (char *args, location_t *location);
|
||||||
static int convert_ucn_to_byte (char const *hex_text);
|
static int convert_ucn_to_byte (char const *hex_text);
|
||||||
|
|
||||||
%}
|
%}
|
||||||
@@ -254,6 +255,8 @@ splice (\\[ \f\t\v]*\n)*
|
|||||||
YY_STEP;
|
YY_STEP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
^"#line "{int}" \""[^\"]*"\"\n" handle_syncline (yytext + strlen ("#line "), yylloc); YY_STEP;
|
||||||
|
|
||||||
"=" return EQUAL;
|
"=" return EQUAL;
|
||||||
":" rule_length = 0; return COLON;
|
":" rule_length = 0; return COLON;
|
||||||
"|" rule_length = 0; return PIPE;
|
"|" rule_length = 0; return PIPE;
|
||||||
@@ -899,6 +902,24 @@ convert_ucn_to_byte (char const *ucn)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------.
|
||||||
|
| Handle `#line INT "FILE"'. ARGS has already skipped `#line '. |
|
||||||
|
`----------------------------------------------------------------*/
|
||||||
|
|
||||||
|
static void
|
||||||
|
handle_syncline (char *args, location_t *location)
|
||||||
|
{
|
||||||
|
int lineno = strtol (args, &args, 10);
|
||||||
|
const char *file = NULL;
|
||||||
|
file = strchr (args, '"') + 1;
|
||||||
|
*strchr (file, '"') = 0;
|
||||||
|
/* FIXME: Leaking... Can't free, as some locations are still
|
||||||
|
pointing to the old file name. */
|
||||||
|
infile = xstrdup (file);
|
||||||
|
location->file = infile;
|
||||||
|
location->last_line = lineno;
|
||||||
|
}
|
||||||
|
|
||||||
/*-------------------------.
|
/*-------------------------.
|
||||||
| Initialize the scanner. |
|
| Initialize the scanner. |
|
||||||
`-------------------------*/
|
`-------------------------*/
|
||||||
|
|||||||
Reference in New Issue
Block a user