# New Ticket Created by  Timothy Smith 
# Please include the string:  [perl #107254]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=107254 >


Here is a test case where the match succeeds, but the match object
doesn't save the subrule capture in some cases:

grammar G {
    rule TOP { ^ <w1> <w2>? <w3>? $ }
    token w1 { \w+ }
    token w2 { \w+ }
    token w3 { \w+ }
}

my @tests =
    'one two three',
    'one two',
    ;

for @tests -> $line {
    my $match = G.parse($line);
    say ($match, $match<w1>, $match<w2>, $match<w3>).map({"[$_]"}).join(', ');
}


$ nom --version
This is perl6 version 2011.12-10-ga9bead6 built on parrot 3.11.0
revision RELEASE_3_11_0
$ nom t2.pl
[one two three], [one], [two], [three]
[one two], [one]


Notice in the second line it is missing the final ", [two]" in the
output. This is because the w2 capture is missing in the Match object.

This works in rakudo-ng:

$ perl6 --version

This is Rakudo Perl 6, version 2011.07-2-g1b7dd12 built on parrot
3.6.0 RELEASE_3_6_0

Copyright 2008-2011, The Perl Foundation

$ perl6 t2.pl
[one two three], [one], [two], [three]
[one two], [one], [two], []
$


Tim

Reply via email to