Skip Menu |

This queue is for tickets about the HOP-Parser CPAN distribution.

Report information
The Basics
Id: 35997
Status: resolved
Priority: 0/
Queue: HOP-Parser

People
Owner: Nobody in particular
Requestors: xcaron [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 0.01
Fixed in: 0.02_01



Subject: HOP::Parser::optional sub truncates returned values list to head
Optional sub only returns head of value list. Problem is values are likely to be dropped when optional-ed parser is actually the result of a concatenate combinator. Here follows my proposed fix: sub optional { my $parser = shift; return alternate ( #T($parser, sub { [ shift ] }), # broken 0.01 $parser, # fixed \&null_list, ); } I believe this is Perl version and platform agnostic.
On Mon May 19 04:30:29 2008, XAV wrote: Show quoted text
> Optional sub only returns head of value list. Problem is values are > likely to be dropped when optional-ed parser is actually the result of a > concatenate combinator. Here follows my proposed fix: > > sub optional { > my $parser = shift; > return alternate ( > #T($parser, sub { [ shift ] }), # broken 0.01 > $parser, # fixed > \&null_list, > ); > } > > I believe this is Perl version and platform agnostic.
Sorry it's taken me so long to get around to this. I believe this issue is fixed in 0.02_01. You can also get it from github: http://github.com/Ovid/hop/tree/master Let me know if there are any problems. Cheers, Ovid