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

[perl #113590] [BUG] Symbol definitions don't work properly in a grammar when defined with french angle quotes in Rakudo

From:
Carl Mäsak
Date:
June 11, 2012 23:00
Subject:
[perl #113590] [BUG] Symbol definitions don't work properly in a grammar when defined with french angle quotes in Rakudo
Message ID:
rt-3.6.HEAD-5009-1339480832-369.113590-82-0@perl.org
# New Ticket Created by  "Carl Mäsak" 
# Please include the string:  [perl #113590]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=113590 >


<adu> I can't track this bug
<adu> omg, I think I found the bug
<adu> rel_op:sym«<=» is not matching '<='
<adu> why?
<adu> rel_op:sym<!=> matches '!=' fine
<pmichaud> adu: gist?
<adu> http://pastebin.com/raw.php?i=FcAiMAU2
<adu> pmichaud: masak: yes
<adu> r: my grammar binop { rule TOP { <rel_op> }; proto token rel_op
{*}; token rel_op:sym<!=> { <sym> }; }; say binop.parse('!=')
<p6eval> rakudo b12854: OUTPUT«q[!=]␤ rel_op => q[!=]␤  sym => q[!=]␤␤»
<adu> (showing success)
<adu> r: my grammar binop { rule TOP { <rel_op> }; proto token rel_op
{*}; token rel_op:sym«<=» { <sym> }; }; say binop.parse('<=')
<p6eval> rakudo b12854: OUTPUT«#<failed match>␤»
<pmichaud> r: my grammar binop { proto token rel_op {*}; my $x = token
rel_op:sym«!=» { <sym> };  say $x; }
<p6eval> rakudo b12854: OUTPUT«rel_op:sym«!=»␤»
<pmichaud> ...that's the problem.  The regex engine expects those «'s
to be converted to single angles.
* masak submits rakudobug
<pmichaud> in Actions.pm
<pmichaud>           { if $<deflongname> { %*RX<name> :=
$<deflongname>[0].Str } }
<pmichaud> is likely the culprit.
<pmichaud> It needs to normalize the name of protoregex candidates.
<adu> hmm
<pmichaud> adu: in the meantime, you can do
<pmichaud> r: my grammar binop { rule TOP { <rel_op> }; proto token
rel_op {*}; token rel_op:sym<le> { '<=' }; }; say binop.parse('<=');
<p6eval> rakudo b12854: OUTPUT«q[<=]␤ rel_op => q[<=]␤␤»
<adu> oh ok, that works



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