Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Symbol definitions don't work properly in a grammar when defined with french angle quotes in Rakudo #2787

Closed
p6rt opened this issue Jun 12, 2012 · 5 comments

Comments

@p6rt
Copy link

p6rt commented Jun 12, 2012

Migrated from rt.perl.org#113590 (status was 'resolved')

Searchable as RT113590$

@p6rt
Copy link
Author

p6rt commented Jun 12, 2012

From @masak

<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

@p6rt
Copy link
Author

p6rt commented Jun 21, 2012

From @jnthn

On Mon Jun 11 23​:00​:32 2012, masak wrote​:

<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

Fixed now. This​:

my grammar binop {
  rule TOP { <rel_op> }
  proto token rel_op {*}
  token rel_op​:sym«<=» { <sym> }
}
say binop.parse('<=');

Gives​:

q[<=]
rel_op => q[<=]
  sym => q[<=]

Tagging testneeded.

/jnthn

@p6rt
Copy link
Author

p6rt commented Jun 21, 2012

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Jun 25, 2012

From @pmichaud

Tests added in ea70649, resolving ticket.

Pm

@p6rt
Copy link
Author

p6rt commented Jun 25, 2012

@pmichaud - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant