mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
* src/parse-gram.y (declaration): Have %parse-param and %lex-param
take two BRACED_CODE, not two string_content. Free the scanner's obstack when we are done. (code_content): New. * tests/calc.at: Adjust. * doc/bison.texinfo: Adjust. Also, make sure to include the `,' for these declarations.
This commit is contained in:
@@ -3847,7 +3847,7 @@ If you use a reentrant parser, you can optionally pass additional
|
||||
parameter information to it in a reentrant way. To do so, use the
|
||||
declaration @code{%parse-param}:
|
||||
|
||||
@deffn {Directive} %parse-param @var{argument-declaration} @var{argument-name}
|
||||
@deffn {Directive} %parse-param @{@var{argument-declaration}@}, @{@var{argument-name}@}
|
||||
@findex %parse-param
|
||||
Declare that @code{argument-name} is an additional @code{yyparse}
|
||||
argument. This argument is also passed to @code{yyerror}. The
|
||||
@@ -3858,8 +3858,8 @@ prototypes.
|
||||
Here's an example. Write this in the parser:
|
||||
|
||||
@example
|
||||
%parse-param "int *nastiness" "nastiness"
|
||||
%parse-param "int *randomness" "randomness"
|
||||
%parse-param @{int *nastiness@}, @{nastiness@}
|
||||
%parse-param @{int *randomness@}, @{randomness@}
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
@@ -4090,7 +4090,7 @@ If you wish to pass the additional parameter data to @code{yylex}, use
|
||||
@code{%lex-param} just like @code{%parse-param} (@pxref{Parser
|
||||
Function}).
|
||||
|
||||
@deffn {Directive} lex-param @var{argument-declaration} @var{argument-name}
|
||||
@deffn {Directive} lex-param @{@var{argument-declaration}@}, @{@var{argument-name}@}
|
||||
@findex %lex-param
|
||||
Declare that @code{argument-name} is an additional @code{yylex}
|
||||
argument.
|
||||
@@ -4099,9 +4099,9 @@ argument.
|
||||
For instance:
|
||||
|
||||
@example
|
||||
%parse-param "int *nastiness" "nastiness"
|
||||
%lex-param "int *nastiness" "nastiness"
|
||||
%parse-param "int *randomness" "randomness"
|
||||
%parse-param @{int *nastiness@}, @{nastiness@}
|
||||
%lex-param @{int *nastiness@}, @{nastiness@}
|
||||
%parse-param @{int *randomness@}, @{randomness@}
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
@@ -4190,7 +4190,7 @@ void yyerror (const char *msg); /* Yacc parsers. */
|
||||
void yyerror (YYLTYPE *locp, const char *msg); /* GLR parsers. */
|
||||
@end example
|
||||
|
||||
If @samp{%parse-param "int *nastiness" "nastiness"} is used, then:
|
||||
If @samp{%parse-param @{int *nastiness@}, @{nastiness@}} is used, then:
|
||||
|
||||
@example
|
||||
void yyerror (int *randomness, const char *msg); /* Yacc parsers. */
|
||||
@@ -4207,10 +4207,10 @@ convention of @code{yylex} @emph{and} the calling convention of
|
||||
%locations
|
||||
/* Pure yylex. */
|
||||
%pure-parser
|
||||
%lex-param "int *nastiness" "nastiness"
|
||||
%lex-param @{int *nastiness@}, @{nastiness@}
|
||||
/* Pure yyparse. */
|
||||
%parse-param "int *nastiness" "nastiness"
|
||||
%parse-param "int *randomness" "randomness"
|
||||
%parse-param @{int *nastiness@}, @{nastiness@}
|
||||
%parse-param @{int *randomness@}, @{randomness@}
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
@@ -6498,7 +6498,7 @@ Bison declaration to assign left associativity to token(s).
|
||||
@xref{Precedence Decl, ,Operator Precedence}.
|
||||
@end deffn
|
||||
|
||||
@deffn {Directive} %lex-param "@var{argument-declaration}" "@var{argument-name}"
|
||||
@deffn {Directive} %lex-param @{@var{argument-declaration}@}. @{@var{argument-name}"@}
|
||||
Bison declaration to specifying an additional parameter that
|
||||
@code{yylex} should accept. @xref{Pure Calling,, Calling Conventions
|
||||
for Pure Parsers}.
|
||||
@@ -6530,7 +6530,7 @@ Bison declaration to set the name of the parser file. @xref{Decl
|
||||
Summary}.
|
||||
@end deffn
|
||||
|
||||
@deffn {Directive} %parse-param "@var{argument-declaration}" "@var{argument-name}"
|
||||
@deffn {Directive} %parse-param @{@var{argument-declaration}@}, @{@var{argument-name}@}
|
||||
Bison declaration to specifying an additional parameter that
|
||||
@code{yyparse} should accept. @xref{Parser Function,, The Parser
|
||||
Function @code{yyparse}}.
|
||||
|
||||
Reference in New Issue
Block a user