Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
setting $/ is in the noise level, so do it
The .simplematch method is still considered a temporary experiment,
but setting $/ makes it likely that the parser could select it when it
knows there are no external options like :g.  (Internal options like :i
are okay.)
  • Loading branch information
TimToady committed Oct 8, 2015
1 parent 472ea02 commit e54ea07
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/core/Str.pm
Expand Up @@ -367,18 +367,19 @@ my class Str does Stringy { # declared in BOOTSTRAP
}

# A temporary routine for differential testing of .match overhead.
# This can only be used for a single non-multi match, and does not
# set $/.
# This can only be used for a single non-multi match.
method simplematch($pat) {
my $caller_dollar_slash := nqp::getlexcaller('$/');
my %opts;
%opts<c> = 0;
my $patrx := nqp::istype($pat,Code) ?? $pat !! / "$pat": /;
my $cur := $patrx(Cursor.'!cursor_init'(self, |%opts));

$cur.pos >= 0
my \result = $cur.pos >= 0
?? $cur.MATCH_SAVE
!! Nil;
$caller_dollar_slash = result;
result;
}

method match($pat,
Expand Down

0 comments on commit e54ea07

Please sign in to comment.