Skip Menu |

This queue is for tickets about the Parse-RecDescent CPAN distribution.

Report information
The Basics
Id: 45262
Status: resolved
Priority: 0/
Queue: Parse-RecDescent

People
Owner: Nobody in particular
Requestors: ribasushi [...] leporine.io
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in:
  • 1.96.0
  • v1.95.1
Fixed in: (no value)



Subject: Spurious warnings on grammar re-parsing
After version 1.94 P::RD emits warnings if one parses a specific grammar more than once. As long as the grammar contains: sentence: ( token1 | token2 | ... | tokenN ) (s) rebuilding of such a grammar with P::RD->new ($gr) will trigger a multitude of: Use of uninitialized value in subtraction (-) at lib/Parse/RecDescent.pm line 1885. The alternative but semantically identical syntax does not produce any warnings: token: token1 | token2 | ... | tokenN sentence: tokens(s) Complete standalone test attached.
Subject: reentry.t
use warnings; use strict; $^W++; # for some reason use warnings doesn't cut it use Test::More; use Test::Warn; use Parse::RecDescent; my $g1 = <<'EOG'; { use warnings; use strict; my @seq; } genome : base(s) { $return = \@seq } base : A | C | G | T A : /a/ { push @seq, $item[0] } C : /c/ { push @seq, $item[0] } G : /g/ { push @seq, $item[0] } T : /t/ { push @seq, $item[0] } EOG my $g2 = <<'EOG'; { use warnings; use strict; my @seq; } genome : ( A | C | G | T )(s) { $return = \@seq } A : /a/ { push @seq, $item[0] } C : /c/ { push @seq, $item[0] } G : /g/ { push @seq, $item[0] } T : /t/ { push @seq, $item[0] } EOG my @sequences = (qw/aatgcttgc cctggattcg ctggaagtc ctgXc/); plan tests => @sequences * 4; for my $to_sequence (@sequences) { my ($p1, $p2); warnings_are (sub { $p1 = Parse::RecDescent->new ($g1); }, [], 'no warnings emitted during grammar1 parsing'); warnings_are (sub { $p2 = Parse::RecDescent->new ($g2); }, [], 'no warnings emitted during grammar2 parsing'); warnings_are (sub { is_deeply ( $p1->genome ($to_sequence), $p2->genome ($to_sequence), 'grammars produce same result' ); }, [], 'no warnings emitted during grammar execution'); }
Subject: Re: [rt.cpan.org #45262] Spurious warnings on grammar re-parsing
Date: Sat, 25 Apr 2009 12:03:01 +1000
To: bug-Parse-RecDescent [...] rt.cpan.org
From: Damian Conway <damian [...] conway.org>
Show quoted text
> After version 1.94 P::RD emits warnings if one parses a specific grammar > more than once.
Thanks for the report and especially for the test case! It made tracking down the problem vastly easier. I've done so now and fixed it for the next release. Much appreciated, Damian
This appears to have been addressed in a past release, the provided test file (Thank you!) passes against the current release.