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


In the attached code, the only difference between the Grammars G0 and G1
is the defination of token 'type' it is defined as <alpha> in one case
and as <alnum> in another.

Since the string being matched is 'sc_in' both the alpha and alnum
tokens should have captured it. But we see the following result on
execution

=========== <alnum> Example==============
Nil
=========== <alpha> Example==============
「sc_in<foo> bar」
ruport => 「sc_in」
type => 「sc_in」
alpha => 「s」
alpha => 「c」
alpha => 「_」
alpha => 「i」
alpha => 「n」


Perl Version is 

This is Rakudo Star version 2018.06 built on MoarVM version 2018.06
implementing Perl 6.c.



-- 
Vijayvithal
Dyumnin Semiconductors
grammar G0 {
        token TOP {<rport>|<ruport>.*}
        regex rport { <type>}
        rule ruport { <type>}
        #token type {<alpha>+}
        token type {<alnum>+}
}

grammar G1 {
        token TOP {<rport>|<ruport>.*}
        regex rport { <type>}
        rule ruport { <type>}
        token type {<alpha>+}
        #token type {<alnum>+}
}
my $str="sc_in<foo> bar";
say "=========== <alnum> Example==============";
say G0.parse($str);
say "=========== <alpha> Example==============";
say G1.parse($str);

Attachment: signature.asc
Description: PGP signature

Reply via email to