[system] / trunk / pg / lib / Parser / List.pm Repository:
ViewVC logotype

Diff of /trunk/pg/lib/Parser/List.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 3465 Revision 3466
25 my $constant = shift; my $paren = shift; 25 my $constant = shift; my $paren = shift;
26 my $entryType = shift || $Value::Type{unknown}; 26 my $entryType = shift || $Value::Type{unknown};
27 my $open = shift || ''; my $close = shift || ''; 27 my $open = shift || ''; my $close = shift || '';
28 my $context = $equation->{context}; 28 my $context = $equation->{context};
29 my $parens = $context->{parens}; my $list; 29 my $parens = $context->{parens}; my $list;
30 30
31 if ($paren && $close && $paren->{formInterval}) { 31 if ($paren && $close && $paren->{formInterval}) {
32 $paren = $parens->{interval} 32 $paren = $parens->{interval}
33 if ($paren->{close} ne $close || (scalar(@{$coords}) == 2 && 33 if ($paren->{close} ne $close || (scalar(@{$coords}) == 2 &&
34 ($coords->[0]->{isInfinite} || $coords->[1]->{isInfinite})) || 34 ($coords->[0]->{isInfinite} || $coords->[1]->{isInfinite})) ||
35 (scalar(@{$coords}) == 1 && $coords->[0]->{isInfinite})); 35 (scalar(@{$coords}) == 1 && $coords->[0]->{isInfinite}));
36 } 36 }
37 my $type = Value::Type($paren->{type},scalar(@{$coords}),$entryType, 37 my $type = Value::Type($paren->{type},scalar(@{$coords}),$entryType,
38 list => 1, formMatrix => $paren->{formMatrix}); 38 list => 1, formMatrix => $paren->{formMatrix});
39 if ($type->{name} ne 'Interval') { 39 if ($type->{name} ne 'Interval' && ($type->{name} ne 'Set' || $type->{length} != 0)) {
40 if ($paren->{formMatrix} && $entryType->{formMatrix}) {$type->{name} = 'Matrix'} 40 if ($paren->{formMatrix} && $entryType->{formMatrix}) {$type->{name} = 'Matrix'}
41 elsif ($entryType->{name} eq 'unknown') { 41 elsif ($entryType->{name} eq 'unknown') {
42 if ($paren->{formList}) {$type->{name} = 'List'} 42 if ($paren->{formList}) {$type->{name} = 'List'}
43 elsif ($type->{name} eq 'Point') { 43 elsif ($type->{name} eq 'Point') {
44 $equation->Error("Entries in a Matrix must be of the same type and length")} 44 $equation->Error("Entries in a Matrix must be of the same type and length")}
226sub perl { 226sub perl {
227 my $self = shift; my $parens = shift; my $matrix = shift; 227 my $self = shift; my $parens = shift; my $matrix = shift;
228 my $perl; my @p = (); 228 my $perl; my @p = ();
229 foreach my $x (@{$self->{coords}}) {push(@p,$x->perl)} 229 foreach my $x (@{$self->{coords}}) {push(@p,$x->perl)}
230 $perl = 'new Value::'.$self->type.'('.join(',',@p).')'; 230 $perl = 'new Value::'.$self->type.'('.join(',',@p).')';
231 $perl = 'Closed('.$perl.')' 231 $perl = "${perl}->with(open=>'$self->{open}',close=>'$self->{close}')"
232 if $self->{canBeInterval} && $self->{open}.$self->{close} eq '[]'; 232 if $self->{canBeInterval} && $self->{open}.$self->{close} eq '[]';
233 $perl = '('.$perl.')' if $parens; 233 $perl = '('.$perl.')' if $parens;
234 return $perl; 234 return $perl;
235} 235}
236 236
242use Parser::List::Point; 242use Parser::List::Point;
243use Parser::List::Vector; 243use Parser::List::Vector;
244use Parser::List::Matrix; 244use Parser::List::Matrix;
245use Parser::List::List; 245use Parser::List::List;
246use Parser::List::Interval; 246use Parser::List::Interval;
247use Parser::List::Set;
247use Parser::List::AbsoluteValue; 248use Parser::List::AbsoluteValue;
248 249
249######################################################################### 250#########################################################################
250 251
2511; 2521;

Legend:
Removed from v.3465  
changed lines
  Added in v.3466

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9