… | |
… | |
24 | sub undefine { |
24 | sub undefine { |
25 | my $self = shift; |
25 | my $self = shift; |
26 | my @data = (); |
26 | my @data = (); |
27 | foreach my $x (@_) { |
27 | foreach my $x (@_) { |
28 | if ($self->{context}{operators}{$x}{type} eq 'unary') { |
28 | if ($self->{context}{operators}{$x}{type} eq 'unary') { |
29 | push(@data,$x => {class => 'Parser::UOP::undefined'}); |
29 | push(@data,$x => { |
|
|
30 | class => 'Parser::UOP::undefined', |
|
|
31 | oldClass => $self->get($x)->{class}, |
|
|
32 | }); |
30 | } else { |
33 | } else { |
31 | push(@data,$x => {class => 'Parser::BOP::undefined'}); |
34 | push(@data,$x => { |
|
|
35 | class => 'Parser::BOP::undefined', |
|
|
36 | oldClass => $self->get($x)->{class}, |
|
|
37 | }); |
32 | } |
38 | } |
|
|
39 | } |
|
|
40 | $self->set(@data); |
|
|
41 | } |
|
|
42 | |
|
|
43 | sub redefine { |
|
|
44 | my $self = shift; my $X = shift; |
|
|
45 | return $self->SUPER::redefine($X,@_) if scalar(@_) > 0; |
|
|
46 | $X = [$X] unless ref($X) eq 'ARRAY'; |
|
|
47 | my @data = (); |
|
|
48 | foreach my $x (@{$X}) { |
|
|
49 | my $oldClass = $self->get($x)->{oldClass}; |
|
|
50 | push(@data,$x => {class => $oldClass, oldClass => undef}) |
|
|
51 | if $oldClass; |
33 | } |
52 | } |
34 | $self->set(@data); |
53 | $self->set(@data); |
35 | } |
54 | } |
36 | |
55 | |
37 | ######################################################################### |
56 | ######################################################################### |