Am 4/16/02 3:36 PM schrieb "Vsevolod Buzinov" unter <[EMAIL PROTECTED]>:

> Parse::RecDescent is much help for my task, but what gets me into trouble is
> that I can't see a way to pass any parameters to a parser except to make them
> global variables.

 perldoc Parse::RecDescent

       Arguments can also be passed to the start rule, simply by
       appending them to the argument list with which the start
       rule is called (after the "line number" parameter). For
       example, given:

               $parser = new Parse::RecDescent ( $grammar );

               $parser->data($text, 1, "str", 2, \@arr);

               #             ^^^^^  ^  ^^^^^^^^^^^^^^^
               #               |    |         |
               # TEXT TO BE PARSED  |         |
               # STARTING LINE NUMBER         |
               # ELEMENTS OF @arg WHICH IS PASSED TO RULE data

       then within the productions of the rule `data', the array
       `@arg' will contain `("str", 2, \@arr)'.

.... If that's what you mean.

Marcel



Reply via email to