+ my ($r, $l) = $self->inspect($op);
+ if (name($op) ne 'const') {
+ my $c = 1 - count $r;
+ $l = $c ? { list => $c } : 0;
+ }
+ return $r, $l;
+}
+
+sub pp_aassign {
+ my ($self, $op) = @_;
+
+ $op = $op->first;
+
+ # Can't assign to return
+ my $l = ($self->inspect($op->sibling))[1];
+ return undef, $l if not exists $l->{list};
+
+ $self->inspect($op);
+}
+
+sub pp_leaveloop {
+ my ($self, $op) = @_;
+
+ diag "* leaveloop" if $DEBUG;
+
+ $op = $op->first;
+ my ($r1, $l1);
+ if (name($op) eq 'enteriter') {
+ ($r1, $l1) = $self->inspect($op);
+ return $r1, $l1 if $r1 and zero $l1;
+ }
+
+ $op = $op->sibling;
+ my $r = (name($op->first) eq 'and') ? ($self->inspect($op->first->first->sibling))[0]
+ : ($self->inspect($op))[0];
+ my $c = 1 - count $r;
+ diag "& leaveloop" if $DEBUG;
+ return $r, $c ? { 0 => $c } : undef;
+}
+
+sub pp_flip {
+ my ($self, $op) = @_;
+
+ $op = $op->first;
+ return $self->inspect($op) if name($op) ne 'range';
+
+ my ($r, $l);
+ my $begin = $op->first;
+ if (name($begin) eq 'const') {
+ my $end = $begin->sibling;
+ if (name($end) eq 'const') {
+ $begin = $self->const_sv($begin);
+ $end = $self->const_sv($end);
+ {
+ no warnings 'numeric';
+ $begin = int ${$begin->object_2svref};
+ $end = int ${$end->object_2svref};
+ }
+ return undef, $end - $begin + 1;
+ } else {
+ ($r, $l) = $self->inspect($end);
+ }
+ } else {
+ ($r, $l) = $self->inspect($begin);
+ }
+
+ my $c = 1 - count $r;
+ return $r, ($l && $c) ? { 'list' => $c } : undef
+}
+
+sub pp_grepwhile {
+ my ($self, $op) = @_;
+
+ $op = $op->first;
+ return $self->inspect($op) if name($op) ne 'grepstart';
+ $op = $op->first->sibling;
+
+ my ($r2, $l2) = $self->inspect($op->sibling);
+ return $r2, $l2 if $r2 and zero $l2;
+ diag Dumper [ $r2, $l2 ] if $DEBUG;
+ my $c = count $l2; # First one to happen
+
+ my ($r1, $l1) = $self->inspect($op);
+ diag Dumper [ $r1, $l1 ] if $DEBUG;
+ return (add $r2, scale $c, $r1), undef if $r1 and zero $l1 and not zero $l2;
+ return { 'list' => 1 }, undef if list $l2;
+
+ $l2 = { $l2 => 1 } unless ref $l2;
+ my $r = add $r2, scale $c,
+ normalize
+ add map { power $r1, $_, $l2->{$_} } keys %$l2;
+ $c = 1 - count $r;
+ return $r, $c ? { ((zero $l2) ? 0 : 'list') => $c } : undef;