sub parse_foo {
my ($text) = @_;
my $name;
{
last if $text =~ /\G \s* \Z/gcmsx;
if ($text =~ /\G \s* ^ \s* begfoo \s+ (\S+?) \s* \( \s* (.*?) \s* \) \s* ;/gcmsx) { $name = $1 }
elsif ($text =~ /\G \s* ^ \s* endfoo /gcmsx) { }
elsif ($text =~ /\G \s* ^ \s* \S+ \s+ .*? \s* ;/gcmsx) { }
else { die "ERROR: unknown syntax\n" }
redo;
}
print "LAST FOO: $name\n";
}
####
last if $text =~ /\G \s* \Z/gcmsx;
# spent 181ms making 866465 calls to main::CORE:match, avg 208ns/call
if ($text =~ /\G \s* ^ \s* begfoo \s+ (\S+?) \s* \( \s* (.*?) \s* \) \s* ;/gcmsx) { $name = $1 }
# spent 3.74s making 2547279 calls to main::CORE:match, avg 1µs/call
####
last if $text =~ /\G \s* \Z/gcmsx;
# spent 289ms making 866465 calls to main::CORE:match, avg 334ns/call
if ($text =~ /\G \s* ^ \s* begfoo \s+ (\S+?) \s* \( \s* (.*?) \s* \) \s* ;/gcmsx) { $name = $1 }
# spent 103s making 2547279 calls to main::CORE:match, avg 41µs/call