Re: R:RD grammars inside object

[email protected] ("Ted Zlatanov") 13 Oct 2004 10:49:31 -0400
Newsgroups perl.recdescent
Organization Теодор Златанов @ Cienfuegos
Message-ID <[email protected]>
On Wed, 13 Oct 2004, [email protected] wrote:

> package Blah;
> 
> our %hash;
> 
>$::RD_AUTOACTION = q{ 	$Blah::hash{$item[0]} = $item[0]; 1 };# f.e.
> 	........
> sub parse { 
> 	my $self = shift;
> 	my $str = join ' ',  @{ $$self{cmd} };
> 	my $parser = new Parse::RecDescent ($grammar); 
> 	$parser->start($str) or die "parsing error !!\n"; }
> 
> Now I want to do something like this :
> 
>$::RD_AUTOACTION = q{ 	$$self{_blah}{$item[0]} = $item[0]; 1 };
> 
> i.e. How to accesses object-instance-data from inside the grammar
> instead of the class-data.

I don't know the "proper" way, but why not make $parser a global
variable and access it that way from the auto-action?  Does it provide
what you need?

Ted