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


This is golfed from a File::Ignore regression. This reproduces it:

grammar Parser {
    token TOP { <matcher>+ }
    proto token matcher { * }
    token matcher:sym<[]> { '[' <( <-[\]]>+ )> ']' }
    token matcher:sym<lit> { <-[/*?[]>+ }
}
class RuleCompiler {
    # Simply commenting out this causes the matcher:sym<lit> to get the
.txt it should. With
    # this, it gets ].txt instead.
    method matcher:sym<[]>($/) { }
}
say Parser.parse('[AB].txt', :actions(RuleCompiler));

Commenting out the action method makes the final match tree correct.
Without it, the match tree ends up with the second matcher wrongly
capturing the ].

I've had trouble bisecting it due to unbuildable commits; the log is here:

https://gist.github.com/Whateverable/119eb26d8ca245bf59ec05bc014c9fc2

It was fine in 2017.03 and broken in 2017.04, perhaps around the time of
the uncurse merge. I'm somewhat suspecting that, since it unified Match and
Cursor. This code may be a tricky edge case for the unification since it
uses the <( and )> constructs, which make the captured text and the text
matched by the cursor differ.

Reply via email to