| … | |
… | |
| 231 | |
231 | |
| 232 | package Value::String; |
232 | package Value::String; |
| 233 | |
233 | |
| 234 | sub cmp_defaults {( |
234 | sub cmp_defaults {( |
| 235 | Value::Real->cmp_defaults, |
235 | Value::Real->cmp_defaults, |
| 236 | typeMatch => Value::Real->new(1), |
236 | typeMatch => undef, |
| 237 | )}; |
237 | )}; |
| 238 | |
238 | |
| 239 | sub cmp_class { |
239 | sub cmp_class { |
| 240 | my $self = shift; my $ans = shift; |
240 | my $self = shift; my $ans = shift; |
| 241 | my $typeMatch = $ans->{typeMatch}; |
241 | my $typeMatch = $ans->{typeMatch}; |
|
|
242 | my $typeMatch = $ans->{typeMatch} = Value::Real->new(1) unless defined($typeMatch); |
| 242 | return 'a Word' if $typeMatch->class eq 'String'; |
243 | return 'a Word' if !Value::isValue($typeMatch) || $typeMatch->class eq 'String'; |
| 243 | return $typeMatch->cmp_class; |
244 | return $typeMatch->cmp_class; |
| 244 | }; |
245 | }; |
| 245 | |
246 | |
| 246 | sub typeMatch { |
247 | sub typeMatch { |
| 247 | my $self = shift; my $other = shift; my $ans = shift; |
248 | my $self = shift; my $other = shift; my $ans = shift; |
|
|
249 | my $typeMatch = $ans->{typeMatch}; |
|
|
250 | my $typeMatch = $ans->{typeMatch} = Value::Real->new(1) unless defined($typeMatch); |
| 248 | return 1 if $self->type eq $other->type || $ans->{typeMatch}->class eq 'String'; |
251 | return 1 if $self->type eq $other->type || !Value::isValue($typeMatch) || $typeMatch->class eq 'String'; |
| 249 | return $ans->{typeMatch}->typeMatch($other,$ans); |
252 | return $typeMatch->typeMatch($other,$ans); |
| 250 | } |
253 | } |
| 251 | |
254 | |
| 252 | ############################################################# |
255 | ############################################################# |
| 253 | |
256 | |
| 254 | package Value::Point; |
257 | package Value::Point; |