* doc/bison.texinfo: Correct typos in previous fix.

* data/glr.c: b4_filename -> b4_file_name.
* data/lalr1.cc: Likewise.  Also, b4_filename_type -> b4_file_name_type.
All uses changed.
(class position): filename -> file_name.  All uses changed.
* data/yacc.c: b4_filename -> b4_file_name.
* lib/bitset.h: filename -> file_name in local vars.
* lib/bitset_stats.c: Likewise.
* src/files.c: Likewise.
* src/scan-skel.l ("@output ".*\n): Likewise.
* src/files.c (file_name_split): Renamed from filename_split.
* src/muscle_tab.c (muscle_init): Output b4_file_name, not b4_filename.
This commit is contained in:
Paul Eggert
2005-09-09 22:42:15 +00:00
parent a420f9620e
commit 48b16bbc04
10 changed files with 57 additions and 45 deletions

View File

@@ -6,6 +6,17 @@
(Invocation): The output of "bison hack/foo.y" goes to foo.tab.c, (Invocation): The output of "bison hack/foo.y" goes to foo.tab.c,
not to hack/foo.tab.c. not to hack/foo.tab.c.
(Calc++ Top Level): 2nd arg of main is not const. (Calc++ Top Level): 2nd arg of main is not const.
* data/glr.c: b4_filename -> b4_file_name.
* data/lalr1.cc: Likewise. Also, b4_filename_type -> b4_file_name_type.
All uses changed.
(class position): filename -> file_name. All uses changed.
* data/yacc.c: b4_filename -> b4_file_name.
* lib/bitset.h: filename -> file_name in local vars.
* lib/bitset_stats.c: Likewise.
* src/files.c: Likewise.
* src/scan-skel.l ("@output ".*\n): Likewise.
* src/files.c (file_name_split): Renamed from filename_split.
* src/muscle_tab.c (muscle_init): Output b4_file_name, not b4_filename.
2005-09-08 Paul Eggert <eggert@cs.ucla.edu> 2005-09-08 Paul Eggert <eggert@cs.ucla.edu>

View File

@@ -179,7 +179,7 @@ b4_pre_prologue[
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
]m4_ifdef([b4_stype], ]m4_ifdef([b4_stype],
[b4_syncline([b4_stype_line], [b4_filename]) [b4_syncline([b4_stype_line], [b4_file_name])
typedef union m4_bregexp(b4_stype, [^{], [YYSTYPE ])b4_stype YYSTYPE; typedef union m4_bregexp(b4_stype, [^{], [YYSTYPE ])b4_stype YYSTYPE;
/* Line __line__ of glr.c. */ /* Line __line__ of glr.c. */
b4_syncline([@oline@], [@ofile@])], b4_syncline([@oline@], [@ofile@])],
@@ -2306,7 +2306,7 @@ b4_token_defines(b4_tokens)
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
m4_ifdef([b4_stype], m4_ifdef([b4_stype],
[b4_syncline([b4_stype_line], [b4_filename]) [b4_syncline([b4_stype_line], [b4_file_name])
typedef union m4_bregexp(b4_stype, [^{], [YYSTYPE ])b4_stype YYSTYPE; typedef union m4_bregexp(b4_stype, [^{], [YYSTYPE ])b4_stype YYSTYPE;
/* Line __line__ of glr.c. */ /* Line __line__ of glr.c. */
b4_syncline([@oline@], [@ofile@])], b4_syncline([@oline@], [@ofile@])],

View File

@@ -48,7 +48,7 @@ m4_define([b4_rhs_value],
[(yysemantic_stack_@{m4_eval([$1 - $2])@}m4_ifval([$3], [.$3]))]) [(yysemantic_stack_@{m4_eval([$1 - $2])@}m4_ifval([$3], [.$3]))])
m4_define_default([b4_location_type], [location]) m4_define_default([b4_location_type], [location])
m4_define_default([b4_filename_type], [std::string]) m4_define_default([b4_file_name_type], [std::string])
# b4_lhs_location() # b4_lhs_location()
# ----------------- # -----------------
@@ -164,7 +164,7 @@ b4_syncline([@oline@], [@ofile@])[
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
]m4_ifdef([b4_stype], ]m4_ifdef([b4_stype],
[b4_syncline([b4_stype_line], [b4_filename]) [b4_syncline([b4_stype_line], [b4_file_name])
union YYSTYPE b4_stype; union YYSTYPE b4_stype;
/* Line __line__ of lalr1.cc. */ /* Line __line__ of lalr1.cc. */
b4_syncline([@oline@], [@ofile@])], b4_syncline([@oline@], [@ofile@])],
@@ -1256,7 +1256,7 @@ namespace yy
public: public:
/// Construct a position. /// Construct a position.
position () : position () :
filename (0), file_name (0),
line (initial_line), line (initial_line),
column (initial_column) column (initial_column)
{ {
@@ -1288,7 +1288,7 @@ namespace yy
public: public:
/// File name to which this position refers. /// File name to which this position refers.
]b4_filename_type[* filename; ]b4_file_name_type[* file_name;
/// Current line number. /// Current line number.
unsigned int line; unsigned int line;
/// Current column number. /// Current column number.
@@ -1332,8 +1332,8 @@ namespace yy
inline std::ostream& inline std::ostream&
operator<< (std::ostream& ostr, const position& pos) operator<< (std::ostream& ostr, const position& pos)
{ {
if (pos.filename) if (pos.file_name)
ostr << *pos.filename << ':'; ostr << *pos.file_name << ':';
return ostr << pos.line << '.' << pos.column; return ostr << pos.line << '.' << pos.column;
} }
@@ -1435,9 +1435,9 @@ namespace yy
{ {
position last = loc.end - 1; position last = loc.end - 1;
ostr << loc.begin; ostr << loc.begin;
if (last.filename if (last.file_name
&& (!loc.begin.filename && (!loc.begin.file_name
|| *loc.begin.filename != *last.filename)) || *loc.begin.file_name != *last.file_name))
ostr << '-' << last; ostr << '-' << last;
else if (loc.begin.line != last.line) else if (loc.begin.line != last.line)
ostr << '-' << last.line << '.' << last.column; ostr << '-' << last.line << '.' << last.column;

View File

@@ -189,7 +189,7 @@ b4_location_if([#define yylloc b4_prefix[]lloc])])[
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
]m4_ifdef([b4_stype], ]m4_ifdef([b4_stype],
[b4_syncline([b4_stype_line], [b4_filename]) [b4_syncline([b4_stype_line], [b4_file_name])
typedef union m4_bregexp(b4_stype, [^{], [YYSTYPE ])b4_stype YYSTYPE; typedef union m4_bregexp(b4_stype, [^{], [YYSTYPE ])b4_stype YYSTYPE;
/* Line __line__ of yacc.c. */ /* Line __line__ of yacc.c. */
b4_syncline([@oline@], [@ofile@])], b4_syncline([@oline@], [@ofile@])],
@@ -1414,7 +1414,7 @@ b4_token_defines(b4_tokens)
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
m4_ifdef([b4_stype], m4_ifdef([b4_stype],
[b4_syncline([b4_stype_line], [b4_filename]) [b4_syncline([b4_stype_line], [b4_file_name])
typedef union m4_bregexp(b4_stype, [^{], [YYSTYPE ])b4_stype YYSTYPE; typedef union m4_bregexp(b4_stype, [^{], [YYSTYPE ])b4_stype YYSTYPE;
/* Line __line__ of yacc.c. */ /* Line __line__ of yacc.c. */
b4_syncline([@oline@], [@ofile@])], b4_syncline([@oline@], [@ofile@])],

View File

@@ -3779,10 +3779,11 @@ Declare that the @var{code} must be invoked before parsing each time
For instance, if your locations use a file name, you may use For instance, if your locations use a file name, you may use
@example @example
%parse-param @{ const char *file @}; %parse-param @{ char const *file_name @};
%initial-action %initial-action
@{ @{
@@$.begin.file = @@$.end.file = file; @@$.begin.file_name = @@$.end.file_name = file_name;
@@$.begin.file_name = @@$.end.file_name = file_name;
@}; @};
@end example @end example
@@ -6950,7 +6951,7 @@ Symbols}.
@c - %locations @c - %locations
@c - class Position @c - class Position
@c - class Location @c - class Location
@c - %define "file_type" "const symbol::Symbol" @c - %define "file_name_type" "const symbol::Symbol"
When the directive @code{%locations} is used, the C++ parser supports When the directive @code{%locations} is used, the C++ parser supports
location tracking, see @ref{Locations, , Locations Overview}. Two location tracking, see @ref{Locations, , Locations Overview}. Two
@@ -6962,7 +6963,7 @@ and a @code{location}, a range composed of a pair of
The name of the file. It will always be handled as a pointer, the The name of the file. It will always be handled as a pointer, the
parser will never duplicate nor deallocate it. As an experimental parser will never duplicate nor deallocate it. As an experimental
feature you may change it to @samp{@var{type}*} using @samp{%define feature you may change it to @samp{@var{type}*} using @samp{%define
"file_type" "@var{type}"}. "file_name_type" "@var{type}"}.
@end deftypemethod @end deftypemethod
@deftypemethod {position} {unsigned int} line @deftypemethod {position} {unsigned int} line
@@ -7322,7 +7323,7 @@ automatically propagated.
%initial-action %initial-action
@{ @{
// Initialize the initial location. // Initialize the initial location.
@@$.begin.file = @@$.end.file = &driver.file; @@$.begin.file_name = @@$.end.file_name = &driver.file;
@}; @};
@end example @end example

View File

@@ -371,10 +371,10 @@ extern void bitset_stats_enable (void);
extern void bitset_stats_disable (void); extern void bitset_stats_disable (void);
/* Read bitset stats file of accummulated stats. */ /* Read bitset stats file of accummulated stats. */
void bitset_stats_read (const char *filename); void bitset_stats_read (const char *file_name);
/* Write bitset stats file of accummulated stats. */ /* Write bitset stats file of accummulated stats. */
void bitset_stats_write (const char *filename); void bitset_stats_write (const char *file_name);
/* Dump bitset stats. */ /* Dump bitset stats. */
extern void bitset_stats_dump (FILE *); extern void bitset_stats_dump (FILE *);

View File

@@ -241,17 +241,17 @@ bitset_stats_disable (void)
/* Read bitset statistics file. */ /* Read bitset statistics file. */
void void
bitset_stats_read (const char *filename) bitset_stats_read (const char *file_name)
{ {
FILE *file; FILE *file;
if (!bitset_stats_info) if (!bitset_stats_info)
return; return;
if (!filename) if (!file_name)
filename = BITSET_STATS_FILE; file_name = BITSET_STATS_FILE;
file = fopen (filename, "r"); file = fopen (file_name, "r");
if (file) if (file)
{ {
if (fread (&bitset_stats_info_data, sizeof (bitset_stats_info_data), if (fread (&bitset_stats_info_data, sizeof (bitset_stats_info_data),
@@ -271,17 +271,17 @@ bitset_stats_read (const char *filename)
/* Write bitset statistics file. */ /* Write bitset statistics file. */
void void
bitset_stats_write (const char *filename) bitset_stats_write (const char *file_name)
{ {
FILE *file; FILE *file;
if (!bitset_stats_info) if (!bitset_stats_info)
return; return;
if (!filename) if (!file_name)
filename = BITSET_STATS_FILE; file_name = BITSET_STATS_FILE;
file = fopen (filename, "w"); file = fopen (file_name, "w");
if (file) if (file)
{ {
if (fwrite (&bitset_stats_info_data, sizeof (bitset_stats_info_data), if (fwrite (&bitset_stats_info_data, sizeof (bitset_stats_info_data),

View File

@@ -165,8 +165,8 @@ compute_exts_from_src (const char *ext)
} }
/* Decompose FILENAME in four parts: *BASE, *TAB, and *EXT, the fourth /* Decompose FILE_NAME in four parts: *BASE, *TAB, and *EXT, the fourth
part, (the directory) is ranging from FILENAME to the char before part, (the directory) is ranging from FILE_NAME to the char before
*BASE, so we don't need an additional parameter. *BASE, so we don't need an additional parameter.
*EXT points to the last period in the basename, or NULL if none. *EXT points to the last period in the basename, or NULL if none.
@@ -175,7 +175,7 @@ compute_exts_from_src (const char *ext)
`.tab' or `_tab' if present right before *EXT, or is NULL. *TAB `.tab' or `_tab' if present right before *EXT, or is NULL. *TAB
cannot be equal to *BASE. cannot be equal to *BASE.
None are allocated, they are simply pointers to parts of FILENAME. None are allocated, they are simply pointers to parts of FILE_NAME.
Examples: Examples:
'/tmp/foo.tab.c' -> *BASE = 'foo.tab.c', *TAB = '.tab.c', *EXT = '/tmp/foo.tab.c' -> *BASE = 'foo.tab.c', *TAB = '.tab.c', *EXT =
@@ -194,10 +194,10 @@ compute_exts_from_src (const char *ext)
'foo' -> *BASE = 'foo', *TAB = NULL, *EXT = NULL. */ 'foo' -> *BASE = 'foo', *TAB = NULL, *EXT = NULL. */
static void static void
filename_split (const char *filename, file_name_split (const char *file_name,
const char **base, const char **tab, const char **ext) const char **base, const char **tab, const char **ext)
{ {
*base = base_name (filename); *base = base_name (file_name);
/* Look for the extension, i.e., look for the last dot. */ /* Look for the extension, i.e., look for the last dot. */
*ext = strrchr (*base, '.'); *ext = strrchr (*base, '.');
@@ -232,7 +232,7 @@ compute_base_names (void)
files, remove the ".c" or ".tab.c" suffix. */ files, remove the ".c" or ".tab.c" suffix. */
if (spec_outfile) if (spec_outfile)
{ {
filename_split (spec_outfile, &base, &tab, &ext); file_name_split (spec_outfile, &base, &tab, &ext);
/* The full base name goes up the EXT, excluding it. */ /* The full base name goes up the EXT, excluding it. */
full_base_name = full_base_name =
@@ -270,7 +270,7 @@ compute_base_names (void)
{ {
/* Otherwise, the short base name is computed from the input /* Otherwise, the short base name is computed from the input
grammar: `foo/bar.yy' => `bar'. */ grammar: `foo/bar.yy' => `bar'. */
filename_split (grammar_file, &base, &tab, &ext); file_name_split (grammar_file, &base, &tab, &ext);
short_base_name = short_base_name =
xstrndup (base, xstrndup (base,
(strlen (base) - (ext ? strlen (ext) : 0))); (strlen (base) - (ext ? strlen (ext) : 0)));
@@ -281,7 +281,7 @@ compute_base_names (void)
stpcpy (stpcpy (full_base_name, short_base_name), TAB_EXT); stpcpy (stpcpy (full_base_name, short_base_name), TAB_EXT);
/* Compute the extensions from the grammar file name. */ /* Compute the extensions from the grammar file name. */
filename_split (grammar_file, &base, &tab, &ext); file_name_split (grammar_file, &base, &tab, &ext);
if (ext && !yacc_flag) if (ext && !yacc_flag)
compute_exts_from_gf (ext); compute_exts_from_gf (ext);
} }

View File

@@ -74,7 +74,7 @@ muscle_init (void)
/* Version and input file. */ /* Version and input file. */
MUSCLE_INSERT_STRING ("version", VERSION); MUSCLE_INSERT_STRING ("version", VERSION);
MUSCLE_INSERT_C_STRING ("filename", grammar_file); MUSCLE_INSERT_C_STRING ("file_name", grammar_file);
} }

View File

@@ -45,15 +45,15 @@
%} %}
"@output ".*\n { "@output ".*\n {
char const *filename = yytext + sizeof "@output " - 1; char const *file_name = yytext + sizeof "@output " - 1;
yytext[yyleng - 1] = '\0'; yytext[yyleng - 1] = '\0';
if (*filename == '@') if (*file_name == '@')
{ {
if (strcmp (filename, "@output_header_name@") == 0) if (strcmp (file_name, "@output_header_name@") == 0)
filename = spec_defines_file; file_name = spec_defines_file;
else if (strcmp (filename, "@output_parser_name@") == 0) else if (strcmp (file_name, "@output_parser_name@") == 0)
filename = parser_file_name; file_name = parser_file_name;
else else
fatal ("invalid token in skeleton: %s", yytext); fatal ("invalid token in skeleton: %s", yytext);
} }
@@ -63,7 +63,7 @@
free (outname); free (outname);
xfclose (yyout); xfclose (yyout);
} }
outname = xstrdup (filename); outname = xstrdup (file_name);
yyout = xfopen (outname, "w"); yyout = xfopen (outname, "w");
lineno = 1; lineno = 1;
} }