I'm messing with Parse::RecDescent and stumble upon a problem with nesting. Say I have this code for example:
use strict; use Parse::RecDescent; my $parser = Parse::RecDescent->new(q( start: part(s) part : tag { print ">>> $item[1] <<<\n" } | raw tag : stag raw etag { $return = "$item{stag} $item{raw} $item +{etag}" } raw : m{([^<]+)} stag : m{<open>} etag : m{<close>} )); $parser->start(<DATA>); __DATA__ <open> Some content <close> <open> some <open> more content <close> <c +lose>
The result will be that the first (non nested) content is matched, but the other one (nested example) is not.
How to parse such nesting? I can see why it doesn't work, but I can't see the solution. The documentation unfortunately is not clear on this to me :(
In reply to Parse::RecDescent and nesting by b10m
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |