* doc/bison.texinfo (Decl Summary, Bison Options): Clarify what's put into

the -d output file.
This commit is contained in:
Paul Eggert
2004-05-25 19:09:01 +00:00
parent 6712933e0f
commit 4bfd5e4e53
2 changed files with 31 additions and 10 deletions

View File

@@ -1,3 +1,9 @@
2004-05-25 Paul Eggert <eggert@cs.ucla.edu>
* doc/bison.texinfo (Decl Summary, Bison Options): Clarify what's
put into the -d output file, and mention what to do if YYSTYPE is
defined as a macro.
2004-05-24 Paul Eggert <eggert@cs.ucla.edu> 2004-05-24 Paul Eggert <eggert@cs.ucla.edu>
Undo change made earlier today: it caused autopoint to not bring Undo change made earlier today: it caused autopoint to not bring

View File

@@ -3739,17 +3739,33 @@ already defined, so that the debugging facilities are compiled.
@xref{Tracing, ,Tracing Your Parser}. @xref{Tracing, ,Tracing Your Parser}.
@deffn {Directive} %defines @deffn {Directive} %defines
Write an extra output file containing macro definitions for the token Write a header file containing macro definitions for the token type
type names defined in the grammar and the semantic value type names defined in the grammar as well as a few other declarations.
@code{YYSTYPE}, as well as a few @code{extern} variable declarations.
If the parser output file is named @file{@var{name}.c} then this file If the parser output file is named @file{@var{name}.c} then this file
is named @file{@var{name}.h}. is named @file{@var{name}.h}.
This output file is essential if you wish to put the definition of Unless @code{YYSTYPE} is already defined as a macro, the output header
@code{yylex} in a separate source file, because @code{yylex} needs to declares @code{YYSTYPE}. Therefore, if you have defined a
be able to refer to token type codes and the variable @code{YYSTYPE} macro (@pxref{Value Type, ,Data Types of Semantic
@code{yylval}. @xref{Token Values, ,Semantic Values of Tokens}. Values}) you need to arrange for this definition to be propagated to
all modules, e.g., by putting the macro definition in another,
prerequisite header that is included both by your parser and by any
other module that needs @code{YYSTYPE}.
Unless your parser is pure, the output header declares @code{yylval}
as an external variable. @xref{Pure Decl, ,A Pure (Reentrant)
Parser}.
If you have also used locations, the output header declares
@code{YYLTYPE} and @code{yylloc} using a protocol similar to that of
@code{YYSTYPE} and @code{yylval}. @xref{Locations, ,Tracking
Locations}.
This output file is normally essential if you wish to put the
definition of @code{yylex} in a separate source file, because
@code{yylex} typically needs to be able to refer to the
above-mentioned declarations and to the token type codes.
@xref{Token Values, ,Semantic Values of Tokens}.
@end deffn @end deffn
@deffn {Directive} %destructor @deffn {Directive} %destructor
@@ -6281,8 +6297,7 @@ Adjust the output:
@itemx --defines @itemx --defines
Pretend that @code{%defines} was specified, i.e., write an extra output Pretend that @code{%defines} was specified, i.e., write an extra output
file containing macro definitions for the token type names defined in file containing macro definitions for the token type names defined in
the grammar and the semantic value type @code{YYSTYPE}, as well as a few the grammar, as well as a few other declarations. @xref{Decl Summary}.
@code{extern} variable declarations. @xref{Decl Summary}.
@item --defines=@var{defines-file} @item --defines=@var{defines-file}
Same as above, but save in the file @var{defines-file}. Same as above, but save in the file @var{defines-file}.