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


perl6-debug-m -e 'grammar G { regex TOP {^^ "#" \s* "line" \s+
$<line>=(\d+) \s* [ \s (<[,:]>?) $<filename>=(<-[,:]>+) $0 ]? \s* $$} };
say G.parse("#line 2 ,foo.bar,")'
Nil

It matched up through the 'foo.bar', but then backs off back to the space
and gives Nil.

perl6-m -e 'grammar G { regex TOP {^^ "#" \s* "line" \s+ $<line>=(\d+) \s*
[ \s (<[,:]>?) $<filename>=(<-[,:]>+) $0 ]? \s* $$} }; say G.parse("#line 2
,foo.bar,")'
「#line 2 foo.bar」
 line => 「2」
 0 => 「」
 filename => 「foo.bar」


However, simpler example works in both.

perl6-debug-m -e 'grammar G { regex TOP {^^ "#" \s* "line" \s+
$<line>=(\d+) $$} }; say G.parse("#line 2")'
「#line 2」
 0 => 「2」
 line => 「2」

perl6-m -e 'grammar G { regex TOP {^^ "#" \s* "line" \s+ $<line>=(\d+) $$}
}; say G.parse("#line 2")'
「#line 2」
 0 => 「2」
 line => 「2」


perl6 --version
This is Rakudo version 2016.10-144-ga1347ca built on MoarVM version
2016.10-35-gec45ae2

Reply via email to