Subject: | objrule exposes internal data |
#!/usr/bin/perl
use Regexp::Grammars;
my $gr = qr {
<main>
<objrule: main>
foo
# <stuff>
# <rule: stuff>
# bar
}x;
sub new {
use Data::Dumper;
print Dumper \@_;
bless {};
}
'foo bar' =~ $gr;
The output of this program is:
$VAR1 = [
'main',
{
'@' => {},
'!' => '-1'
}
];
The "@" and "!" keys are passed to the "new" constructor. These hash
keys are not documented so I assume they are not meant to be seen. I
suggest that they be removed before the hash is passed to the
constructor.
If you include the 3 commented lines in the grammar, there will be a "~"
hash key too.