aboutsummaryrefslogtreecommitdiffstats
path: root/incdec.pm
diff options
context:
space:
mode:
authorTeddy Wing2021-08-19 21:49:21 +0200
committerTeddy Wing2021-08-19 21:50:46 +0200
commit463490a1857274ebf5b488c38e1a280a4d9b7669 (patch)
treefc549d7541b0e460222f83ee0ed9270281ff1cf4 /incdec.pm
parentf676809de186ffd7bda7492f912c607a3aaa0c86 (diff)
downloadreadline-incdec-463490a1857274ebf5b488c38e1a280a4d9b7669.tar.bz2
incdec: Clean up code from backwards incrementing development
Diffstat (limited to 'incdec.pm')
-rw-r--r--incdec.pm19
1 files changed, 6 insertions, 13 deletions
diff --git a/incdec.pm b/incdec.pm
index a473e30..f13209b 100644
--- a/incdec.pm
+++ b/incdec.pm
@@ -10,19 +10,12 @@ sub incdec {
$is_backward ||= 0;
my $start_position = 0;
- my @points = ();
my $previous_match_start = 0;
my $previous_match_end = 0;
- print "$line\n";
while ($line =~ /(\d+)/g) {
if ($is_backward) {
- print "pos[$point_position] -[$-[0]]- +[$+[0]]+\n";
- print "pos[$point_position] -[$previous_match_start]- +[$previous_match_end]+\n";
- # if $point_position < $-[0]
- # && previous $+[0] <= $point_position
- if ($previous_match_end - 1 <= $point_position && $point_position < $-[0]) {
- # if ($-[0] <= $point_position && $point_position < $+[0]) {
- print "matched at $-[0];$previous_match_end\n";
+ if ($previous_match_end - 1 <= $point_position
+ && $point_position < $-[0]) {
$start_position = $previous_match_start;
last;
@@ -32,11 +25,11 @@ sub incdec {
$previous_match_end = $+[0];
}
else {
- if ($point_position < $+[0]) {
- $start_position = $-[0];
+ if ($point_position < $+[0]) {
+ $start_position = $-[0];
- last;
- }
+ last;
+ }
}
}