Should you wish to take the Parse::RecDescent leap, here is some code you can play around with. The first major limitation i see with this code is that it only grabs the first two args from a function. That means if you have some functions that have more than two args, those functions first two args will be processed too. There may be more limitations that i did not think of during my limited testing of this code, but hey ... it's a start. ;)
use strict; use warnings; use Parse::RecDescent; use vars qw( %item @item $return @pair @store ); my $data = do {local $/;<DATA>}; my $parser = Parse::RecDescent->new($data); my @code = ( q/concat(int2string(counter, 1),result)/, q/concat("hello","world")/, q/concat(foo,bar)/, ); $parser->startrule($_) for @code; for (0..$#code) { print "$code[$_]\n"; print "\targ 1 => ", $store[$_][0], "\n"; print "\targ 2 => ", $store[$_][1], "\n"; } __DATA__ startrule: function function: label open_p arg comma arg close_p arg: nested_function | quoted_literal | literal nested_function: label open_p arg comma arg close_p { push @main::pair, join('', @item[1..$#item]); pop @main::store; if (@main::pair == 2) { push @main::store,[@main::pair]; @main::pair = (); } $return = join('', @item[1..$#item]); print STDERR "nested function: $return\n"; } quoted_literal: quote /[^"]+/ quote { push @main::pair, $item[2]; if (@main::pair == 2) { push @main::store,[@main::pair]; @main::pair = (); } print STDERR "quoted literal: $item[2]\n"; $return = $item[2]; } literal: /\w+/i { push @main::pair, $item[1]; if (@main::pair == 2) { push @main::store,[@main::pair]; @main::pair = (); } print STDERR "literal: $item[1]\n"; $return = $item[1]; } label: /[a-zA-Z]\w*/ open_p: /\(/ close_p: /\)/ comma: /,/ quote: /"/

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)

In reply to (jeffa) Re: Need a regex to match C-style function arg list by jeffa
in thread Need a regex to match C-style function arg list by Anonymous Monk

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.