* 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:
Akim Demaille
2002-11-15 16:42:16 +00:00
parent 761c1926a1
commit 0f39aab92a
5 changed files with 208 additions and 163 deletions

View File

@@ -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}}.