# New Ticket Created by Ron Schmidt # Please include the string: [perl #130612] # in the subject line of all future correspondence about this issue. # <URL: https://rt.perl.org/Ticket/Display.html?id=130612 >
# https://design.perl6.org/S05.html#Longest-token_matching says: # For matches of same length ... If the alternatives are in the same # grammar file, the textually earlier alternative takes precedence. use Test; grammar text-order { token alt-na_1 { <n> | <na_1> }; token alt-na_2 { <n> | <na_2> }; token n { <digit>+ } token na_1 { <+alpha +digit> + } token na_2 { <+alpha +[0..9]> + } } is text-order.parse('1', :rule<alt-na_1>).keys[0], 'n', 'Match first textual rule OK'; is text-order.parse('1', :rule<alt-na_2>).keys[0], 'n', 'Match second textual rule fail'; result: ok 1 - Match first textual rule OK not ok 2 - Match second textual rule fail # Failed test 'Match second textual rule fail' # at <tmp> line 17 # expected: 'n # got: 'na_2' Posted on IRC, https://irclog.perlgeek.de/perl6/2017-01-20#i_13960886 The IRC discussion notes that the tests should be expected to pass and the S05 rule is intended for implementation in current Perl 6 / Rakudo. See also roast issue: https://github.com/perl6/roast/issues/224