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

Diff of /trunk/pg/lib/Value.pm

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

Revision 2624 Revision 2625
74 '/' => 'div', 74 '/' => 'div',
75 '**' => 'power', 75 '**' => 'power',
76 '.' => '_dot', # see _dot below 76 '.' => '_dot', # see _dot below
77 'x' => 'cross', 77 'x' => 'cross',
78 '<=>' => 'compare', 78 '<=>' => 'compare',
79 'cmp' => 'cmp',
79}; 80};
80 81
81$$context->{pattern}{infinite} = '[-+]?inf(?:inity)?'; 82$$context->{pattern}{infinite} = '[-+]?inf(?:inity)?';
82$$context->{pattern}{infinity} = '\+?inf(?:inity)?'; 83$$context->{pattern}{infinity} = '\+?inf(?:inity)?';
83$$context->{pattern}{-infinity} = '-inf(?:inity)?'; 84$$context->{pattern}{-infinity} = '-inf(?:inity)?';
393 if ($l->promotePrecedence($r)) {return $r->compare($l,!$flag)} 394 if ($l->promotePrecedence($r)) {return $r->compare($l,!$flag)}
394 return $l->value <=> $r->value; 395 return $l->value <=> $r->value;
395} 396}
396 397
397# 398#
399# Compare the values as strings
400#
401sub cmp {
402 my ($l,$r,$flag) = @_;
403 if ($l->promotePrecedence($r)) {return $r->compare($l,!$flag)}
404 $l = $l->stringify; $r = $r->stringify if Value::isValue($r);
405 if ($flag) {my $tmp = $l; $l = $r; $r = $tmp}
406 return $l cmp $r;
407}
408
409#
398# Generate the various output formats 410# Generate the various output formats
399# (can be replaced by sub-classes) 411# (can be replaced by sub-classes)
400# 412#
401sub stringify { 413sub stringify {
402 my $self = shift; 414 my $self = shift;

Legend:
Removed from v.2624  
changed lines
  Added in v.2625

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9