CC: | casiano.rodriguez.leon [...] gmail.com |
Subject: | Warnings when redefining <token: ws> |
Dear Damian,
Many thanks for your modules and for your books. They are great.
The program below produces a couple of warnings. May be is not a bug,
but it looks like one:
$ perl5.10.1 -w tokenvsruleandws.pl
ab /* 1 */ c d
Use of uninitialized value in scalar assignment at (re_eval 16) line 1,
<> line 1.
Use of uninitialized value in scalar assignment at (re_eval 14) line 1,
<> line 1.
$VAR1 = {
'' => 'ab /* 1 */ c d',
's' => {
'' => 'ab /* 1 */ c d',
'c' => 'c d',
'a' => 'ab'
}
};
********************************
The program (see below) redefines token <ws>. The warnings still appear
even if the token <ws> is simply redefined as:
<token: ws> \s*
This is the program:
$ cat tokenvsruleandws.pl
use strict;
use warnings;
use 5.010;
use Data::Dumper;
my $rbb = do {
use Regexp::Grammars;
qr{
<s>
<token: ws> (?: \s+ | /\* .*? \*/)*+
<rule: s> <a> <c>
<rule: c> c d
<token: a> a b
}xs;
};
while (my $input = <>) {
if ($input =~ m{$rbb}) {
say Dumper \%/;
}
else {
say "Does not match";
}
}
*******************************
Thanks
Casiano