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


The <.rule> non-capturing subrule match does not work outside grammars
even though one would expect it to. Compare:

    > my regex a { a };
    regex a { a }

    > "aaa" ~~ /<a>/
    「a」
     a => 「a」

    > "aaa" ~~ /<.a>/
    No such method 'a' for invocant of type 'Cursor'
      in block <unit> at <unknown file> line 1

In a grammar, this works as expected:

    > grammar G { regex a { a }; regex TOP { <.a> }; }
    (G)

    > G.parse("a")
    「a」

    > "a" ~~ /<G::TOP>/
    「a」
     G::TOP => 「a」

The difference is really the grammar, not the fact that the referring
regex is also named. Because this does not work:


    > my regex a { a };
    regex a { a }

    > my regex as { <.a> };
    regex as { <.a> }

    > "a" ~~ /<as>/
    No such method 'a' for invocant of type 'Cursor'
      in regex as at <unknown file> line 1
      in block <unit> at <unknown file> line 1

Also, surprisingly enough, no problems arise with non-capturing calls
to built-in rules:

    > " " ~~ /<.ws>/
    「 」

I might try to fix this if someone confirms this is indeed a bug.

Tested with current released Rakudo version:

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

Reply via email to