… | |
… | |
14 | sub _check { |
14 | sub _check { |
15 | my $self = shift; |
15 | my $self = shift; |
16 | return if ($self->checkStrings()); |
16 | return if ($self->checkStrings()); |
17 | if ($self->{lop}->{canBeInterval} && $self->{rop}->{canBeInterval}) { |
17 | if ($self->{lop}->{canBeInterval} && $self->{rop}->{canBeInterval}) { |
18 | $self->{type} = Value::Type('Union',2,$Value::Type{number}); |
18 | $self->{type} = Value::Type('Union',2,$Value::Type{number}); |
|
|
19 | $self->{canBeInterval} = 1; |
|
|
20 | foreach my $op ('lop','rop') { |
|
|
21 | if ($self->{$op}->type !~ m/^(Interval|Union)$/) { |
|
|
22 | $self->{$op} = bless $self->{$op}, 'Parser::List::Interval'; |
|
|
23 | $self->{$op}->typeRef->{name} = $self->{equation}{context}{parens}{interval}{type}; |
|
|
24 | } |
|
|
25 | } |
19 | } else {$self->Error("Operands of '$self->{bop}' must be intervals")} |
26 | } else {$self->Error("Operands of '$self->{bop}' must be intervals")} |
20 | } |
27 | } |
21 | |
28 | |
22 | |
29 | |
23 | # |
30 | # |
… | |
… | |
39 | # |
46 | # |
40 | # Turn a union into a list of the intervals in the union. |
47 | # Turn a union into a list of the intervals in the union. |
41 | # |
48 | # |
42 | sub makeUnion { |
49 | sub makeUnion { |
43 | my $self = shift; |
50 | my $self = shift; |
44 | return $self unless ($self->{def}{isUnion}); |
51 | return ( |
45 | return ($self->{lop}->makeUnion,$self->{rop}->makeUnion); |
52 | $self->{lop}{def}{isUnion}? $self->{lop}->makeUnion : $self->{lop}, |
|
|
53 | $self->{rop}{def}{isUnion}? $self->{rop}->makeUnion : $self->{rop}, |
|
|
54 | ); |
46 | } |
55 | } |
47 | |
56 | |
48 | ######################################################################### |
57 | ######################################################################### |
49 | |
58 | |
50 | 1; |
59 | 1; |