Skip Menu |
Report information
Id: 130612
Status: new
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: ronaldxs <ronaldxs [at]>

Severity: (no value)
Tag: Bug
Platform: (no value)
Patch Status: (no value)
VM: (no value)

From: Ronald Schmidt <ronaldxs [...]>
Date: Sat, 21 Jan 2017 19:32:15 +0100
To: rakudobug [...]
Subject: [BUG] LTM doesn't use text order for tie break as expected

# says:
Show quoted text

# 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';


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,

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:


This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at