This bug is still present in

    Rakudo version 2017.08-104-g76f1d8970
    built on MoarVM version 2017.08.1-148-g1059eed1
    implementing Perl 6.c.

---

However, there's also a design question to be answered here:

On Sat, 21 Jan 2017 10:32:39 -0800, ronaldxs wrote:
> 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.

This S05 paragraph was clearly written with LTM of `proto` regexes in mind.

What does it mean for LTM of `|` alternations?

I.e., should the test-case above match 'n'...

a) because `token n { ... }` is declared above `token na_2 { ... }`?
b) because in `<n> | <na_1>`, `<n> ` is to the left of ` <na_1>`?

The test-case at hand does not distinguish between those two interpretations 
(Rakudo is currently wrong either way), but it's an important distinction that 
needs to be clarified if the bug is to be fixed.

http://design.perl6.org/S05.html#Overview has a sentence on this tie-breaker 
which actually mentions alternations:

> Within a given compilation unit, the earlier alternative or multi wins

I'd interpret that as option (b), but am not 100% sure.

Reply via email to