/[bison]/bison/doc/bison.texinfo
ViewVC logotype

Diff of /bison/doc/bison.texinfo

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.86 by eggert, Wed Nov 27 18:32:12 2002 UTC revision 1.87 by eggert, Fri Nov 29 08:43:12 2002 UTC
# Line 3847  If you use a reentrant parser, you can o Line 3847  If you use a reentrant parser, you can o
3847  parameter information to it in a reentrant way.  To do so, use the  parameter information to it in a reentrant way.  To do so, use the
3848  declaration @code{%parse-param}:  declaration @code{%parse-param}:
3849    
3850  @deffn {Directive} %parse-param @{@var{argument-declaration}@}, @{@var{argument-name}@}  @deffn {Directive} %parse-param @{@var{argument-declaration}@}
3851  @findex %parse-param  @findex %parse-param
3852  Declare that @code{argument-name} is an additional @code{yyparse}  Declare that an argument declared by @code{argument-declaration} is an
3853  argument.  This argument is also passed to @code{yyerror}.  The  additional @code{yyparse} argument.  This argument is also passed to
3854  @var{argument-declaration} is used when declaring functions or  @code{yyerror}.  The @var{argument-declaration} is used when declaring
3855  prototypes.  functions or prototypes.  The last identifier in
3856    @var{argument-declaration} must be the argument name.
3857  @end deffn  @end deffn
3858    
3859  Here's an example.  Write this in the parser:  Here's an example.  Write this in the parser:
3860    
3861  @example  @example
3862  %parse-param @{int *nastiness@},  @{nastiness@}  %parse-param @{int *nastiness@}
3863  %parse-param @{int *randomness@}, @{randomness@}  %parse-param @{int *randomness@}
3864  @end example  @end example
3865    
3866  @noindent  @noindent
# Line 4090  If you wish to pass the additional param Line 4091  If you wish to pass the additional param
4091  @code{%lex-param} just like @code{%parse-param} (@pxref{Parser  @code{%lex-param} just like @code{%parse-param} (@pxref{Parser
4092  Function}).  Function}).
4093    
4094  @deffn {Directive} lex-param @{@var{argument-declaration}@}, @{@var{argument-name}@}  @deffn {Directive} lex-param @{@var{argument-declaration}@}
4095  @findex %lex-param  @findex %lex-param
4096  Declare that @code{argument-name} is an additional @code{yylex}  Declare that @code{argument-declaration} is an additional @code{yylex}
4097  argument.  argument declaration.
4098  @end deffn  @end deffn
4099    
4100  For instance:  For instance:
4101    
4102  @example  @example
4103  %parse-param @{int *nastiness@},  @{nastiness@}  %parse-param @{int *nastiness@}
4104  %lex-param   @{int *nastiness@},  @{nastiness@}  %lex-param   @{int *nastiness@}
4105  %parse-param @{int *randomness@}, @{randomness@}  %parse-param @{int *randomness@}
4106  @end example  @end example
4107    
4108  @noindent  @noindent
# Line 4190  void yyerror (const char *msg); Line 4191  void yyerror (const char *msg);
4191  void yyerror (YYLTYPE *locp, const char *msg);  /* GLR parsers.   */  void yyerror (YYLTYPE *locp, const char *msg);  /* GLR parsers.   */
4192  @end example  @end example
4193    
4194  If @samp{%parse-param @{int *nastiness@}, @{nastiness@}} is used, then:  If @samp{%parse-param @{int *nastiness@}} is used, then:
4195    
4196  @example  @example
4197  void yyerror (int *randomness, const char *msg);  /* Yacc parsers.  */  void yyerror (int *randomness, const char *msg);  /* Yacc parsers.  */
# Line 4207  convention of @code{yylex} @emph{and} th Line 4208  convention of @code{yylex} @emph{and} th
4208  %locations  %locations
4209  /* Pure yylex.  */  /* Pure yylex.  */
4210  %pure-parser  %pure-parser
4211  %lex-param   @{int *nastiness@},  @{nastiness@}  %lex-param   @{int *nastiness@}
4212  /* Pure yyparse.  */  /* Pure yyparse.  */
4213  %parse-param @{int *nastiness@},  @{nastiness@}  %parse-param @{int *nastiness@}
4214  %parse-param @{int *randomness@}, @{randomness@}  %parse-param @{int *randomness@}
4215  @end example  @end example
4216    
4217  @noindent  @noindent
# Line 6498  Bison declaration to assign left associa Line 6499  Bison declaration to assign left associa
6499  @xref{Precedence Decl, ,Operator Precedence}.  @xref{Precedence Decl, ,Operator Precedence}.
6500  @end deffn  @end deffn
6501    
6502  @deffn {Directive} %lex-param @{@var{argument-declaration}@}. @{@var{argument-name}"@}  @deffn {Directive} %lex-param @{@var{argument-declaration}@}
6503  Bison declaration to specifying an additional parameter that  Bison declaration to specifying an additional parameter that
6504  @code{yylex} should accept.  @xref{Pure Calling,, Calling Conventions  @code{yylex} should accept.  @xref{Pure Calling,, Calling Conventions
6505  for Pure Parsers}.  for Pure Parsers}.
# Line 6530  Bison declaration to set the name of the Line 6531  Bison declaration to set the name of the
6531  Summary}.  Summary}.
6532  @end deffn  @end deffn
6533    
6534  @deffn {Directive} %parse-param @{@var{argument-declaration}@}, @{@var{argument-name}@}  @deffn {Directive} %parse-param @{@var{argument-declaration}@}
6535  Bison declaration to specifying an additional parameter that  Bison declaration to specifying an additional parameter that
6536  @code{yyparse} should accept.  @xref{Parser Function,, The Parser  @code{yyparse} should accept.  @xref{Parser Function,, The Parser
6537  Function @code{yyparse}}.  Function @code{yyparse}}.

Legend:
Removed from v.1.86  
changed lines
  Added in v.1.87

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26