Re: Help with a grammar problem

[email protected] (Damian Conway) Thu, 3 Sep 2009 17:50:58 +1000
Newsgroups perl.recdescent
Message-ID <[email protected]>
Hi Mike,


> What I've tried amounts to this:
>
> chunk: /.*?/ delimiter_start command(s) delimiter_end /.*?/

Unfortunately that won't work, because every regex in a PRD grammar is
independent of the rest of the grammar, so even a minimal-matching .*?
eats everything.

Is there some reason you can't use something like:

    my $parser = Parse::RecDescent->new($grammar);

    $text =~ s{<DELIMITER> (.*?) </DELIMITER>}
            { $parser->parse($1); q{} }gexs;

???

Damian