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

Report information
The Basics
Id:
129970
Status:
resolved
Priority:
Low/Low

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

BugTracker
Severity:
(no value)
Broken in:
(no value)
Fixed in:
(no value)



Subject: <nocontext:> has no effect in rules with subpatterns
Date: Wed, 3 Jul 2019 07:16:23 +0300
To: bug-Regexp-Grammars@rt.cpan.org
From: Alexander Karelas <alex.karelas@gmail.com>
E.g.: my $parser = qr/     <name>     <token: name>         <nocontext:>         <word= (\w+)> /x; "alex" =~ $parser; use Data::Dumper; print Dumper(\%/); gives: $VAR1 = {           '' => 'alex',           'name' => {                       'word' => 'alex',                       '' => 'alex'                     }         }; ...which contains some context in name (where I think it should not)
Subject: Re: [rt.cpan.org #129970] <nocontext:> has no effect in rules with subpatterns
Date: Tue, 16 Jul 2019 11:59:51 +0000
To: bug-Regexp-Grammars@rt.cpan.org
From: Damian Conway <damian@conway.org>
Hi Alex,

Thanks for the report, and apologies for the slow response.

That's definitely a bug, and I'm working on a solution.
The current workaround is to convert the named capture
to a separate token, like so:


    my $parser = qr/

         <name>

         <token: name>
             <nocontext:>
             <word>

        <token: word>
             \w+

    /x;

    "alex" =~ $parser;

    use Data::Dumper;
    print Dumper(\%/);


which gives:

    $VAR1 = {
              'name' => {
                          'word' => 'alex'
                        },
              '' => 'alex'
            };

as expected.

I will upload a new release as soon as I have found
out what's going on with the named capture version,
hopefully later this week.

Once again, thanks for bringing this to my attention.

Damian
Subject: Re: [rt.cpan.org #129970] <nocontext:> has no effect in rules with subpatterns
Date: Tue, 16 Jul 2019 22:19:14 +0000
To: bug-Regexp-Grammars@rt.cpan.org
From: Damian Conway <damian@conway.org>
I have found the bug, and fixed it.
The problem no longer occurs in v1.052,
which I have just uploaded to CPAN.

Thanks again for the report, Alex.
Much appreciated!

Damian


This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

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