I appreciate everyone's advice and suggestions on improving speeds and with using gettimeofday(), but the real problem is that the 'funct2a' and 'funct2b' functions which are embedded deep in if statements (brace_statement) are being returned as an array... and I'd like the output to either concatenate the array elements into a comma-separated string so that in the output, 2: would look like (funct2a,funct2b) rather than the (ARRAY(0x25ec9bc))...

One way I could do this is by flattening this multi-dimensional array that gets returned into one array - or by doing it in the grammar (which is probably more efficient)? If someone knows how to do either (both would be great for learning) that would be awesome.

I've changed the output code to do this

foreach my $parsedValue (@$refParsedValues) { print Dumper($parsedValue) if ($parsedValue); }
which produces these results on the array structure that is returned to me.
Compile Time: 0.3 seconds ---------------------------------------------------------------------- +-- $VAR1 = [ '', '' ]; $VAR1 = [ '', '' ]; $VAR1 = [ 'funct1', '', '' ]; $VAR1 = [ '', '' ]; $VAR1 = [ '', [ '', [ 'funct2a', 'funct2b', '' ], '' ], '' ]; $VAR1 = 'funct3'; $VAR1 = 'funct4'; $VAR1 = 'funct5'; $VAR1 = 'funct6'; $VAR1 = 'funct7'; ---------------------------------------------------------------------- +-- Parse Time: 1.1 seconds Total Time: 1.4 seconds
What we really wanted was an array that printed like this:
$VAR1 = 'funct1'; $VAR1 = 'funct2a'; $VAR1 = 'funct2b'; $VAR1 = 'funct3'; $VAR1 = 'funct4'; $VAR1 = 'funct5'; $VAR1 = 'funct6'; $VAR1 = 'funct7';

In reply to Re: Simple Parsing of JavaScript function names using Parse-RecDescent by Incognito
in thread Simple Parsing of JavaScript function names using Parse-RecDescent by Incognito

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.