Skip Menu |

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

Report information
The Basics
Id: 75817
Status: open
Priority: 0/
Queue: Regexp-Grammars

People
Owner: Nobody in particular
Requestors: ingosch [...] gmx.at
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.016
Fixed in: (no value)



Hi, I need to recursively match pairs of { }. In the process I encountered a bug when trying to forget the inverse using the <./ ...> syntax. my $gb=do { use Regexp::Grammars; qr{<debug: on> <[brb]> <rule: brb> <.br> (<[sc=([^{}]*)]>? <[brb]>?)* <./br> <token: br> \{ }xms; }; does not work. <./RULE> is not matching, neither is </.RULE>. Ingo PS: On a general note, the documentation would greatly benefit when the examples were more eloquent with input->code->result. At the moment it is really hard to get started, at least it was for me.
Subject: Re: [rt.cpan.org #75817]
Date: Sat, 17 Mar 2012 07:45:38 +1100
To: bug-Regexp-Grammars [...] rt.cpan.org
From: Damian Conway <damian [...] conway.org>
Hi Ingo, The problem is, what you asked RG to do was: <rule: brb> <.br> # Match <br> but DON'T remember it ( <[sc=([^{}]*)]>? # Optional optional non-curlies <[brb]>? # Optional nested match )* # ...zero-or more times <./br> # Balance what <br> remembered (i.e. nothing!) You actually want: <rule: brb> <_tag=br> # Match <br> and *temporarily* remember it (as _tag) ( <[sc=([^{}]+)]>? # Optional non-curlies <[brb]>? # Optional nested match )* # ...zero-or more times </_tag> # Balance what <_tag> remembered Show quoted text
> PS: On a general note, the documentation would greatly benefit when the > examples were more eloquent with input->code->result. At the moment it > is really hard to get started, at least it was for me.
I appreciate this feedback and have added a ToDo item to revisit and improve the documentation examples. Damian