in reply to Re: nested parsing with Parse::RecDescent
in thread nested parsing with Parse::RecDescent
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 :)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 };
|
|---|