# HG changeset patch # User Vincent Tondellier # Date 1431116751 -7200 # Node ID d1288f69bfed8b433541e6e99703baa0da583187 # Parent f66d935647bca5be13ac6e6f6c9b877ddd4cd5e1 Fix function shortening with complex templates (boost::asio) by using Text::Balanced instead of broken regex diff -r f66d935647bc -r d1288f69bfed dist.ini --- a/dist.ini Fri May 08 20:46:42 2015 +0200 +++ b/dist.ini Fri May 08 22:25:51 2015 +0200 @@ -21,9 +21,10 @@ format = %-9v %{yyyy-MM-dd}d [Prereqs] -Mojolicious = 5.48 +Mojolicious = 5.48 Mojolicious::Plugin::BootstrapPagination = 0.12 UUID = 0.0.3 +Text::Balanced = 0 [Prereqs / RuntimeRecommends] ; Gearman Queue (also contains the Worker class) Gearman::Client = 1.10 diff -r f66d935647bc -r d1288f69bfed lib/CrashTest/StackFilters/HideArgs.pm --- a/lib/CrashTest/StackFilters/HideArgs.pm Fri May 08 20:46:42 2015 +0200 +++ b/lib/CrashTest/StackFilters/HideArgs.pm Fri May 08 22:25:51 2015 +0200 @@ -13,6 +13,7 @@ package CrashTest::StackFilters::HideArgs; use Mojo::Base -base; +use Text::Balanced qw/extract_bracketed/; sub priority { return 50; } @@ -36,14 +37,18 @@ return "" if(!defined($signature) || $signature eq ""); - my $short_signature = $signature; - if($signature =~ qr{([^<]+)<.+>::([^()]+)\(.*\)(.*)}) { - # c++ with template - $short_signature = "$1<>::$2()$3"; - } elsif($signature =~ qr{([^()]+)\(.*\)(.*)}) { - # c/c++ - $short_signature = "$1()$2"; - } + my $short_signature = ""; + my $text = $signature; + do { + my ($str, $next, $prefix) = extract_bracketed($text, '<(', '[^<(]*'); + if($str) { + $short_signature .= $prefix . substr($str, 0, 1) . substr($str, -1, 1); + $text = $next; + } else { + $short_signature .= $next; + $text = undef; + } + } while($text); return $self->app->t(code => (title => $signature, class => "shortened-signature prettyprint lang-cpp") => sub { return $short_signature }); }