#!/usr/bin/perl -w use strict; my $bareword = qr/(\w+)/; my $quotelike = qr/((['"]).+?\2)/; my $subscript = qr/([\[{]\w+[\]\}])/; my $variable = qr/(\$\w+($subscript)*)/; my $sub_arg = qr/($quotelike|$variable|$bareword)/; my $sub_args = qr/($sub_arg,)*($sub_arg)/; my $subroutine = qr/((\w+::)*\w+\($sub_args)/; while (<>) { my @args = (); my @labels = (); my ($spacer, $obj, $method) = m/^(\s+)(\$\w+->)(\w+)\(/gc; LOOP: { push(@args, $1), redo LOOP if m/\G$quotelike,?\s*/gc; push(@args, $1), redo LOOP if m/\G$variable,?\s*/gc; push(@args, $1), redo LOOP if m/\G$subroutine,?\s*/gc; push(@args, $1), redo LOOP if m/\G$bareword,?\s*/gc; } @labels = ($method eq "hidden") ? qw(name value) : ##integer, text qw(name label value maxlength extras subtext size uiLevel defaultValue hoverHelp) ; print join '', $spacer, $obj, $method, "(\n"; for(my $index=0; $index < @args; ++$index) { print join '', "\t\t-", $labels[$index], ' => ', $args[$index], ",\n"; } print join '', $spacer, ");\n"; }