| … | |
… | |
| 34 | sub _reduce { |
34 | sub _reduce { |
| 35 | my $self = shift; |
35 | my $self = shift; |
| 36 | my $equation = $self->{equation}; |
36 | my $equation = $self->{equation}; |
| 37 | my $reduce = $equation->{context}{reduction}; |
37 | my $reduce = $equation->{context}{reduction}; |
| 38 | if ($self->{lop}->isNeg && $self->{rop}->isNeg && $reduce->{'-x=-y'}) { |
38 | if ($self->{lop}->isNeg && $self->{rop}->isNeg && $reduce->{'-x=-y'}) { |
| 39 | $self = $equation->{context}{parser}{BOP}->new($equation,'=',$self->{lop}{op},$self->{rop}{op}); |
39 | $self = $self->Item("BOP")->new($equation,'=',$self->{lop}{op},$self->{rop}{op}); |
| 40 | $self = $self->reduce; |
40 | $self = $self->reduce; |
| 41 | } |
41 | } |
| 42 | if ($self->{lop}->isNeg && $self->{rop}{isConstant} && |
42 | if ($self->{lop}->isNeg && $self->{rop}{isConstant} && |
| 43 | $self->{rop}->isNumber && $reduce->{'-x=n'}) { |
43 | $self->{rop}->isNumber && $reduce->{'-x=n'}) { |
| 44 | $self = $equation->{context}{parser}{BOP}->new |
|
|
| 45 | ($equation,"=",$self->{lop}{op},Parser::UOP::Neg($self->{rop})); |
44 | $self = $self->Item("BOP")->new($equation,"=",$self->{lop}{op},Parser::UOP::Neg($self->{rop})); |
| 46 | $self = $self->reduce; |
45 | $self = $self->reduce; |
| 47 | } |
46 | } |
| 48 | return $self; |
47 | return $self; |
| 49 | } |
48 | } |
| 50 | |
49 | |