develooper Front page | perl.perl6.compiler | Postings from January 2012

[perl #107746] [BUG] captures are not made properly around '||' if previous capture was quantified

From:
Carl Mäsak
Date:
January 8, 2012 09:18
Subject:
[perl #107746] [BUG] captures are not made properly around '||' if previous capture was quantified
Message ID:
rt-3.6.HEAD-14510-1326043075-1604.107746-82-0@perl.org
# New Ticket Created by  "Carl Mäsak" 
# Please include the string:  [perl #107746]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=107746 >


<jnthn> nom: grammar a { token x { a }; token y { z }; rule TOP {
[<x>]? [b <y> || c] } }; say a.parse('a b z')
<p6eval> nom 327fc9: OUTPUT«=> <a b z>␤ x => <a>␤ y => <z>␤␤»
<jnthn> nom: grammar a { token x { a }; token y { z }; rule TOP {
[<x>]? [c || b <y>] } }; say a.parse('a b z')
<p6eval> nom 327fc9: OUTPUT«=> <a b z>␤ y => <z>␤␤»
<jnthn> ah, there it is :(
<masak> jnthn: o.O
<jnthn> nom: grammar a { token x { a }; token y { z }; rule TOP { <x>
[c || b <y>] } }; say a.parse('a b z')
<p6eval> nom 327fc9: OUTPUT«=> <a b z>␤ x => <a>␤ y => <z>␤␤»
<jnthn> nom: grammar a { token x { a }; token y { z }; rule TOP {
[<x>]? [c || b <y>] } }; say a.parse('a b z')
<p6eval> nom 327fc9: OUTPUT«=> <a b z>␤ y => <z>␤␤»
<jnthn> masak: You spot the issue?
<jnthn> Seems it needs an alternation that fails and a previously
quantified match.
<jnthn> masak: Feel free to RT that
* masak submits rakudobug
<masak> jnthn: I think I spot it. the order of rhs and lhs around '||'
affects captures.
<jnthn> yeah but only if the previous capture was quantified.
<masak> ah, right.
<masak> insidious.
<jnthn> masak: yeah, no fun to find



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About