Re: Passing parameters to a parser

[email protected] (Vsevolod Buzinov)
Newsgroups perl.recdescent
Message-ID <20020417162256.A1372@localhost>
Marcel Grunauer wrote:

>                $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.

Thank you -- now I'm able to call an instance method of a class:
....
html: <rulevar: local $self = $arg[0]>
start_tag: '<' tagname attr(s?) '>'  {$self->start_handler ($item[2], $item[3])}
....
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.