Skip Menu |
 

This queue is for tickets about the Regexp-Grammars CPAN distribution.

Report information
The Basics
Id: 111051
Status: resolved
Priority: 0/
Queue: Regexp-Grammars

People
Owner: Nobody in particular
Requestors: keith [...] westgates.net
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: with_actions class not called for match not at beginning of string
Date: Sat, 9 Jan 2016 17:05:53 -0500
To: bug-Regexp-Grammars [...] rt.cpan.org
From: Keith Westgate <westgate [...] gmail.com>
Download (untitled) / with headers
text/plain 1.9k
version : Regexp-Grammars-1.044 perl: This is perl 5, version 12, subversion 2 (v5.12.2) built for x86_64-linux-thread-multi os: Linux vlsj-westgate 2.6.18-371.el5 #1 SMP Thu Sep 5 21:21:44 EDT 2013 x86_64 GNU/Linux I've taken the calc example and was playing with it. I've noticed that when the match doesn't start at the beginning of the line the with_action in not called. You'll notice below then when the data is 4, you see the message "ANSWERED called" as well as the results being "processed". however, when i feed it ".4", while it says it matched, I don't see "ANSWERED called" and the results come back as 4. output follows: vlsj-westgate@westgate_ml2@13:56:28> PERL5LIB=/vobs/uth/perl ./x.pl Show quoted text
data>>> 4
=====> Trying <grammar> from position 0 4\n |...Trying <Answer> | |...Trying subpattern /\d+/ \n | | \_____subpattern /\d+/ matched '4' ANSWER called | \_____<Answer> matched '4' --> processed Show quoted text
data>>> .4
=====> Trying <grammar> from position 0 .4\n |...Trying <Answer> | |...Trying subpattern /\d+/ | | \FAIL subpattern /\d+/ | \FAIL <Answer> \FAIL <grammar> =====> Trying <grammar> from position 1 4\n |...Trying <Answer> | |...Trying subpattern /\d+/ \n | | \_____subpattern /\d+/ matched '4' | \_____<Answer> matched '4' --> 4 Show quoted text
data>>>
here's the code: #!/grid/common/bin/perl -w use strict; use v5.10; use warnings; my $calculator = do{ use Regexp::Grammars; qr{ <debug: run> <Answer> <rule: Answer> \d+ }xms }; print("data>>> "); while (my $input = <>) { if ($input =~ $calculator->with_actions('Calculator_Actions') ) { say '--> ', $/{Answer}; } print("data>>> "); } package Calculator_Actions; use List::Util qw< reduce >; sub Answer { my ($self, $MATCH) = @_; say "ANSWER called"; my $value = "processed"; return $value; }
Download x.pl
text/x-perl 547b

Message body is not shown because sender requested not to inline it.

Download run.log
application/octet-stream 652b

Message body not shown because it is not plain text.

Subject: Re: [rt.cpan.org #111051] with_actions class not called for match not at beginning of string
Date: Tue, 12 Jan 2016 15:56:52 +1100
To: bug-Regexp-Grammars [...] rt.cpan.org
From: Damian Conway <damian [...] conway.org>
Download (untitled) / with headers
text/plain 155b
Thanks for the report, Keith. I've just uploaded v1.045, which (I hope!) squashes that bug. Let me know if you find otherwise. Much appreciated! Damian


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.