* 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.
(Invocation): The output of "bison hack/foo.y" goes to foo.tab.c,
not to hack/foo.tab.c.
(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>
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
]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;
/* Line __line__ of glr.c. */
b4_syncline([@oline@], [@ofile@])],
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
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;
/* Line __line__ of glr.c. */
b4_syncline([@oline@], [@ofile@])],
[(yysemantic_stack_@{m4_eval([$1 - $2])@}m4_ifval([$3], [.$3]))])
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()
# -----------------
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
]m4_ifdef([b4_stype],
-[b4_syncline([b4_stype_line], [b4_filename])
+[b4_syncline([b4_stype_line], [b4_file_name])
union YYSTYPE b4_stype;
/* Line __line__ of lalr1.cc. */
b4_syncline([@oline@], [@ofile@])],
public:
/// Construct a position.
position () :
- filename (0),
+ file_name (0),
line (initial_line),
column (initial_column)
{
public:
/// File name to which this position refers.
- ]b4_filename_type[* filename;
+ ]b4_file_name_type[* file_name;
/// Current line number.
unsigned int line;
/// Current column number.
inline std::ostream&
operator<< (std::ostream& ostr, const position& pos)
{
- if (pos.filename)
- ostr << *pos.filename << ':';
+ if (pos.file_name)
+ ostr << *pos.file_name << ':';
return ostr << pos.line << '.' << pos.column;
}
{
position last = loc.end - 1;
ostr << loc.begin;
- if (last.filename
- && (!loc.begin.filename
- || *loc.begin.filename != *last.filename))
+ if (last.file_name
+ && (!loc.begin.file_name
+ || *loc.begin.file_name != *last.file_name))
ostr << '-' << last;
else if (loc.begin.line != last.line)
ostr << '-' << last.line << '.' << last.column;
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
]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;
/* Line __line__ of yacc.c. */
b4_syncline([@oline@], [@ofile@])],
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
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;
/* Line __line__ of yacc.c. */
b4_syncline([@oline@], [@ofile@])],
For instance, if your locations use a file name, you may use
@example
-%parse-param @{ const char *file @};
+%parse-param @{ char const *file_name @};
%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
@c - %locations
@c - class Position
@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
location tracking, see @ref{Locations, , Locations Overview}. Two
The name of the file. It will always be handled as a pointer, the
parser will never duplicate nor deallocate it. As an experimental
feature you may change it to @samp{@var{type}*} using @samp{%define
-"file_type" "@var{type}"}.
+"file_name_type" "@var{type}"}.
@end deftypemethod
@deftypemethod {position} {unsigned int} line
%initial-action
@{
// Initialize the initial location.
- @@$.begin.file = @@$.end.file = &driver.file;
+ @@$.begin.file_name = @@$.end.file_name = &driver.file;
@};
@end example
extern void bitset_stats_disable (void);
/* 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. */
-void bitset_stats_write (const char *filename);
+void bitset_stats_write (const char *file_name);
/* Dump bitset stats. */
extern void bitset_stats_dump (FILE *);
/* Read bitset statistics file. */
void
-bitset_stats_read (const char *filename)
+bitset_stats_read (const char *file_name)
{
FILE *file;
if (!bitset_stats_info)
return;
- if (!filename)
- filename = BITSET_STATS_FILE;
+ if (!file_name)
+ file_name = BITSET_STATS_FILE;
- file = fopen (filename, "r");
+ file = fopen (file_name, "r");
if (file)
{
if (fread (&bitset_stats_info_data, sizeof (bitset_stats_info_data),
/* Write bitset statistics file. */
void
-bitset_stats_write (const char *filename)
+bitset_stats_write (const char *file_name)
{
FILE *file;
if (!bitset_stats_info)
return;
- if (!filename)
- filename = BITSET_STATS_FILE;
+ if (!file_name)
+ file_name = BITSET_STATS_FILE;
- file = fopen (filename, "w");
+ file = fopen (file_name, "w");
if (file)
{
if (fwrite (&bitset_stats_info_data, sizeof (bitset_stats_info_data),
}
-/* Decompose FILENAME in four parts: *BASE, *TAB, and *EXT, the fourth
- part, (the directory) is ranging from FILENAME to the char before
+/* Decompose FILE_NAME in four parts: *BASE, *TAB, and *EXT, the fourth
+ part, (the directory) is ranging from FILE_NAME to the char before
*BASE, so we don't need an additional parameter.
*EXT points to the last period in the basename, or NULL if none.
`.tab' or `_tab' if present right before *EXT, or is NULL. *TAB
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:
'/tmp/foo.tab.c' -> *BASE = 'foo.tab.c', *TAB = '.tab.c', *EXT =
'foo' -> *BASE = 'foo', *TAB = NULL, *EXT = NULL. */
static void
-filename_split (const char *filename,
- const char **base, const char **tab, const char **ext)
+file_name_split (const char *file_name,
+ 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. */
*ext = strrchr (*base, '.');
files, remove the ".c" or ".tab.c" suffix. */
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. */
full_base_name =
{
/* Otherwise, the short base name is computed from the input
grammar: `foo/bar.yy' => `bar'. */
- filename_split (grammar_file, &base, &tab, &ext);
+ file_name_split (grammar_file, &base, &tab, &ext);
short_base_name =
xstrndup (base,
(strlen (base) - (ext ? strlen (ext) : 0)));
stpcpy (stpcpy (full_base_name, short_base_name), TAB_EXT);
/* 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)
compute_exts_from_gf (ext);
}
/* Version and input file. */
MUSCLE_INSERT_STRING ("version", VERSION);
- MUSCLE_INSERT_C_STRING ("filename", grammar_file);
+ MUSCLE_INSERT_C_STRING ("file_name", grammar_file);
}
%}
"@output ".*\n {
- char const *filename = yytext + sizeof "@output " - 1;
+ char const *file_name = yytext + sizeof "@output " - 1;
yytext[yyleng - 1] = '\0';
- if (*filename == '@')
+ if (*file_name == '@')
{
- if (strcmp (filename, "@output_header_name@") == 0)
- filename = spec_defines_file;
- else if (strcmp (filename, "@output_parser_name@") == 0)
- filename = parser_file_name;
+ if (strcmp (file_name, "@output_header_name@") == 0)
+ file_name = spec_defines_file;
+ else if (strcmp (file_name, "@output_parser_name@") == 0)
+ file_name = parser_file_name;
else
fatal ("invalid token in skeleton: %s", yytext);
}
free (outname);
xfclose (yyout);
}
- outname = xstrdup (filename);
+ outname = xstrdup (file_name);
yyout = xfopen (outname, "w");
lineno = 1;
}