Don't use "filename", as per GNU coding standards. Use "file name" or

"file" or "name", depending on the context.
(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.
This commit is contained in:
Paul Eggert
2005-09-09 22:14:28 +00:00
parent 326eb46f40
commit fa4d969f11

View File

@@ -1716,12 +1716,12 @@ With all the source in a single file, you use the following command to
convert it into a parser file: convert it into a parser file:
@example @example
bison @var{file_name}.y bison @var{file}.y
@end example @end example
@noindent @noindent
In this example the file was called @file{rpcalc.y} (for ``Reverse Polish In this example the file was called @file{rpcalc.y} (for ``Reverse Polish
@sc{calc}ulator''). Bison produces a file named @file{@var{file_name}.tab.c}, @sc{calc}ulator''). Bison produces a file named @file{@var{file}.tab.c},
removing the @samp{.y} from the original file name. The file output by removing the @samp{.y} from the original file name. The file output by
Bison contains the source code for @code{yyparse}. The additional Bison contains the source code for @code{yyparse}. The additional
functions in the input file (@code{yylex}, @code{yyerror} and @code{main}) functions in the input file (@code{yylex}, @code{yyerror} and @code{main})
@@ -3779,10 +3779,10 @@ 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 *filename @}; %parse-param @{ const char *file @};
%initial-action %initial-action
@{ @{
@@$.begin.filename = @@$.end.filename = filename; @@$.begin.file = @@$.end.file = file;
@}; @};
@end example @end example
@@ -4133,7 +4133,7 @@ parser file contains just @code{#define} directives and static variable
declarations. declarations.
This option also tells Bison to write the C code for the grammar actions This option also tells Bison to write the C code for the grammar actions
into a file named @file{@var{filename}.act}, in the form of a into a file named @file{@var{file}.act}, in the form of a
brace-surrounded body fit for a @code{switch} statement. brace-surrounded body fit for a @code{switch} statement.
@end deffn @end deffn
@@ -4146,8 +4146,8 @@ associate errors with the parser file, treating it an independent source
file in its own right. file in its own right.
@end deffn @end deffn
@deffn {Directive} %output="@var{filename}" @deffn {Directive} %output="@var{file}"
Specify the @var{filename} for the parser file. Specify @var{file} for the parser file.
@end deffn @end deffn
@deffn {Directive} %pure-parser @deffn {Directive} %pure-parser
@@ -6605,14 +6605,15 @@ bison @var{infile}
Here @var{infile} is the grammar file name, which usually ends in Here @var{infile} is the grammar file name, which usually ends in
@samp{.y}. The parser file's name is made by replacing the @samp{.y} @samp{.y}. The parser file's name is made by replacing the @samp{.y}
with @samp{.tab.c}. Thus, the @samp{bison foo.y} filename yields with @samp{.tab.c} and removing any leading directory. Thus, the
@file{foo.tab.c}, and the @samp{bison hack/foo.y} filename yields @samp{bison foo.y} file name yields
@file{hack/foo.tab.c}. It's also possible, in case you are writing @file{foo.tab.c}, and the @samp{bison hack/foo.y} file name yields
@file{foo.tab.c}. It's also possible, in case you are writing
C++ code instead of C in your grammar file, to name it @file{foo.ypp} C++ code instead of C in your grammar file, to name it @file{foo.ypp}
or @file{foo.y++}. Then, the output files will take an extension like or @file{foo.y++}. Then, the output files will take an extension like
the given one as input (respectively @file{foo.tab.cpp} and the given one as input (respectively @file{foo.tab.cpp} and
@file{foo.tab.c++}). @file{foo.tab.c++}).
This feature takes effect with all options that manipulate filenames like This feature takes effect with all options that manipulate file names like
@samp{-o} or @samp{-d}. @samp{-o} or @samp{-d}.
For example : For example :
@@ -6770,11 +6771,11 @@ Pretend that @code{%verbose} was specified, i.e, write an extra output
file containing verbose descriptions of the grammar and file containing verbose descriptions of the grammar and
parser. @xref{Decl Summary}. parser. @xref{Decl Summary}.
@item -o @var{filename} @item -o @var{file}
@itemx --output=@var{filename} @itemx --output=@var{file}
Specify the @var{filename} for the parser file. Specify the @var{file} for the parser file.
The other output files' names are constructed from @var{filename} as The other output files' names are constructed from @var{file} as
described under the @samp{-v} and @samp{-d} options. described under the @samp{-v} and @samp{-d} options.
@item -g @item -g
@@ -6786,7 +6787,7 @@ be @file{foo.vcg}.
@item --graph=@var{graph-file} @item --graph=@var{graph-file}
The behavior of @var{--graph} is the same than @samp{-g}. The only The behavior of @var{--graph} is the same than @samp{-g}. The only
difference is that it has an optional argument which is the name of difference is that it has an optional argument which is the name of
the output graph filename. the output graph file.
@end table @end table
@node Option Cross Key @node Option Cross Key
@@ -6902,13 +6903,13 @@ used for location tracking. @xref{C++ Location Values}.
@item stack.hh @item stack.hh
An auxiliary class @code{stack} used by the parser. An auxiliary class @code{stack} used by the parser.
@item @var{filename}.hh @item @var{file}.hh
@itemx @var{filename}.cc @itemx @var{file}.cc
The declaration and implementation of the C++ parser class. The declaration and implementation of the C++ parser class.
@var{filename} is the name of the output file. It follows the same @var{file} is the name of the output file. It follows the same
rules as with regular C parsers. rules as with regular C parsers.
Note that @file{@var{filename}.hh} is @emph{mandatory}, the C++ cannot Note that @file{@var{file}.hh} is @emph{mandatory}, the C++ cannot
work without the parser class declaration. Therefore, you must either work without the parser class declaration. Therefore, you must either
pass @option{-d}/@option{--defines} to @command{bison}, or use the pass @option{-d}/@option{--defines} to @command{bison}, or use the
@samp{%defines} directive. @samp{%defines} directive.
@@ -6949,7 +6950,7 @@ Symbols}.
@c - %locations @c - %locations
@c - class Position @c - class Position
@c - class Location @c - class Location
@c - %define "filename_type" "const symbol::Symbol" @c - %define "file_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
@@ -6957,11 +6958,11 @@ auxiliary classes define a @code{position}, a single point in a file,
and a @code{location}, a range composed of a pair of and a @code{location}, a range composed of a pair of
@code{position}s (possibly spanning several files). @code{position}s (possibly spanning several files).
@deftypemethod {position} {std::string*} filename @deftypemethod {position} {std::string*} file
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
"filename_type" "@var{type}"}. "file_type" "@var{type}"}.
@end deftypemethod @end deftypemethod
@deftypemethod {position} {unsigned int} line @deftypemethod {position} {unsigned int} line
@@ -6989,8 +6990,8 @@ Various forms of syntactic sugar for @code{columns}.
@deftypemethod {position} {position} operator<< (std::ostream @var{o}, const position& @var{p}) @deftypemethod {position} {position} operator<< (std::ostream @var{o}, const position& @var{p})
Report @var{p} on @var{o} like this: Report @var{p} on @var{o} like this:
@samp{@var{filename}:@var{line}.@var{column}}, or @samp{@var{file}:@var{line}.@var{column}}, or
@samp{@var{line}.@var{column}} if @var{filename} is null. @samp{@var{line}.@var{column}} if @var{file} is null.
@end deftypemethod @end deftypemethod
@deftypemethod {location} {position} begin @deftypemethod {location} {position} begin
@@ -7321,7 +7322,7 @@ automatically propagated.
%initial-action %initial-action
@{ @{
// Initialize the initial location. // Initialize the initial location.
@@$.begin.filename = @@$.end.filename = &driver.file; @@$.begin.file = @@$.end.file = &driver.file;
@}; @};
@end example @end example
@@ -7530,7 +7531,7 @@ The top level file, @file{calc++.cc}, poses no problem.
#include "calc++-driver.hh" #include "calc++-driver.hh"
int int
main (int argc, const char* argv[]) main (int argc, char *argv[])
@{ @{
calcxx_driver driver; calcxx_driver driver;
for (++argv; argv[0]; ++argv) for (++argv; argv[0]; ++argv)
@@ -7923,7 +7924,7 @@ Bison declaration to assign non-associativity to token(s).
@xref{Precedence Decl, ,Operator Precedence}. @xref{Precedence Decl, ,Operator Precedence}.
@end deffn @end deffn
@deffn {Directive} %output="@var{filename}" @deffn {Directive} %output="@var{file}"
Bison declaration to set the name of the parser file. @xref{Decl Bison declaration to set the name of the parser file. @xref{Decl
Summary}. Summary}.
@end deffn @end deffn