Skip Menu |
Report information
Id: 130083
Status: new
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: ddgreen [at] gmail.com
Cc:
AdminCc:

Severity: (no value)
Tag: Bug
Platform: (no value)
Patch Status: (no value)
VM: (no value)



Subject: [BUG] a grammar doesn't match when using perl6-debug-m and does when using perl6-m
Date: Sun, 13 Nov 2016 08:09:06 -0500
To: rakudobug [...] perl.org
From: Daniel Green <ddgreen [...] gmail.com>
Download (untitled) / with headers
text/plain 958b
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


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

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org