[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Why was YYLEX_PARAM "deprecated"?
From: |
Akim Demaille |
Subject: |
Re: Why was YYLEX_PARAM "deprecated"? |
Date: |
Sat, 01 Mar 2003 13:41:12 +0100 |
User-agent: |
Gnus/5.090015 (Oort Gnus v0.15) Emacs/21.2 |
John> Why was YYLEX_PARAM marked "deprecated"?
Because using %lex-param is promoted now. But it is true that for
some reason I don't remember the documentation for %lex-param was
disabled :( It is high time to restore it.
@c For now, do not document %lex-param and %parse-param, since it's
@c not clear that the current behavior is stable enough. For example,
@c we may need to add %error-param.
@clear documentparam
@ifset documentparam
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 @address@hidden@}
@findex %parse-param
Declare that an argument declared by @code{argument-declaration} is an
additional @code{yyparse} argument.
The @var{argument-declaration} is used when declaring
functions or prototypes. The last identifier in
@var{argument-declaration} must be the argument name.
@end deffn
Here's an example. Write this in the parser:
@example
%parse-param @{int address@hidden
%parse-param @{int address@hidden
@end example
@noindent
Then call the parser like this:
@example
@{
int nastiness, randomness;
@dots{} /* @r{Store proper data in @code{nastiness} and @code{randomness}.}
*/
value = yyparse (&nastiness, &randomness);
@dots{}
@}
@end example
@noindent
In the grammar actions, use expressions like this to refer to the data:
@example
exp: @dots{} @{ @dots{}; *randomness += 1; @dots{} @}
@end example
@end ifset
I don't think we need a error-param at all.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: Why was YYLEX_PARAM "deprecated"?,
Akim Demaille <=