Your assumptions have been right on. I actually figured out my problem just before checking back here. My productions (i think that is the proper term) for Line were not prioritized properly with the greediest first. I also had to modify my regex for Text. My grammar definition now looks like this:
my $grammar = q{ {my $re_type = qr /.::/ } Document : Element(s) Element : Header Body Header : Element_Type Options(?) Element_Type: /$re_type/ Options : '(' Arg(s) ')' Arg : /\b(\w+)\s*=\s*(\w+)\s*/xms Body : '{' Line(s) '}' <commit> Line : Element | Text Line | Text Text :/[^\{\}]*\n/xms };
My only concern now is that my current definition for Text is still not exactly right. Instead of matching everything but the braces, I would rather include everything up to, but not including the closing brace or up or a nested Q:: element. I'm sure there's a way to do this, but I'm still working on mastering regex as well. All in good time eh? Anyway, thanks for the advice Philcrow, and also everyone else that offered the helpful tips directly or inderectly related to the problem :)

In reply to Re^2: nested parsing with Parse::RecDescent by loomis53
in thread nested parsing with Parse::RecDescent by loomis53

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.