Le 9 juin 2010 à 03:39, Zona Walcott a écrit :

> I have specified 2 parameters for parse-param  as:
> %parse-param {void* scan_info, PNode *pp }
> %lex-param {void *scan_info}

This is incorrect.  Use %parse-param several times, once for each argument.

----------------------

   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 `%parse-param':

 -- Directive: %parse-param {ARGUMENT-DECLARATION}
     Declare that an argument declared by the braced-code
     ARGUMENT-DECLARATION is an additional `yyparse' argument.  The
     ARGUMENT-DECLARATION is used when declaring functions or
     prototypes.  The last identifier in ARGUMENT-DECLARATION must be
     the argument name.

   Here's an example.  Write this in the parser:

     %parse-param {int *nastiness}
     %parse-param {int *randomness}

Then call the parser like this:

     {
       int nastiness, randomness;
       ...  /* Store proper data in `nastiness' and `randomness'.  */
       value = yyparse (&nastiness, &randomness);
       ...
     }


Reply via email to