This queue is for tickets about the Regexp-Grammars CPAN distribution.

Report information
The Basics

Nobody in particular
felix [...]

(no value)
Broken in:
(no value)
Fixed in:
(no value)

Subject: Fwd: Errors using <MATCH=[rule]>+ construct
Date: Mon, 5 Sep 2016 13:15:21 +0200
From: Felix Kuehnl <>
Hi, I am getting error messages and parsing errors using the <MATCH=[Rule]>+ syntax within my grammar rules. I just started using this really cool module, so I might just use it in a wrong way, but since it fails on a documented example, I think I encountered a bug. Under section "Defining a named grammar", a grammar for a list is given like this (slightly modified to leave out the inheritance feature): use v5.12; use warnings; my $test_grammar = do { use Regexp::Grammars; qr{ <List> <rule: List> <MATCH=[Item]>+ % <Separator> <rule: Item> \S++ <token: Separator> \s* , \s* }xms; }; die "Parsing error" unless "asd" =~ $test_grammar; Executing the code above with Regexp::Grammars 1.045 gives the following output: warn | Repeated subrule <MATCH=[Item]>+ | at /homes/brauerei2/felix/bin/regexp_grammar line 73 | will only capture its final match | (Did you mean <[MATCH=[Item]]>+ instead?) | warn | Possible failed attempt to specify a subrule call: | <MATCH=[Item]> | near /homes/brauerei2/felix/bin/regexp_grammar line 72 | (If you meant to match literally, use: \<MATCH=[Item]>) | and the program dies with error "Parsing error". The problem is the construct <MATCH=[Item]>+ of the List rule. Changing it into: <rule: List> # <MATCH=[Item]>+ % <Separator> # does not work <[Item]>+ % <Separator> <MATCH=(?{ $MATCH{Item} })> . . . fixes the issue and does what I think the original example is supposed to do: directly return the list of matched Items instead of a result hash containing this list under key 'Item'. Now it would be really nice to have the <MATCH=[Item]>+ shortcut, and since it is also officially documented, I wondered why it isn't working? Thanks for your help! Regards, Felix
Subject: Re: [ #117520] Fwd: Errors using <MATCH=[rule]>+ construct
Date: Tue, 6 Sep 2016 07:33:29 +1000
From: Damian Conway <>
Hi Felix,

The problem is a documentation bug.

The rule:

          <rule: List>
              <MATCH=[Item]>+ % <Separator>

should be:

          <rule: List>
              <[MATCH=Item]>+ % <Separator>

That is: the [...] goes around the entire subrule invocation
(including any relabelling). Or, to look at it another way,
there are scalar subrule calls <...> and list subrule calls <[...]>

Sorry for the confusion. I've corrected the example in the
documentation for the next release.

Very much appreciated!


This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

Please report any issues with to