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

View of /trunk/pg/lib/Parser/UOP/plus.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2607 - (download) (as text) (annotate)
Sat Aug 14 11:26:49 2004 UTC (15 years, 3 months ago) by dpvc
File size: 641 byte(s)
Allow unary + and - to work on infinities.

    1 #########################################################################
    2 #
    3 #  Implements unary plus
    4 #
    5 package Parser::UOP::plus;
    6 use strict; use vars qw(@ISA);
    7 @ISA = qw(Parser::UOP);
    8 
    9 #
   10 #  Check that the operand is OK
   11 #
   12 sub _check {
   13   my $self = shift;
   14   return if ($self->checkInfinite);
   15   return if ($self->checkString);
   16   return if ($self->checkList);
   17   return if ($self->checkNumber);
   18   $self->{type} = {%{$self->{op}->typeRef}};
   19 }
   20 
   21 #
   22 #  Plus doesn't change the value
   23 #
   24 sub _eval {$_[1]}
   25 
   26 #
   27 #  Remove the redundant plus sign
   28 #
   29 sub _reduce {(shift)->{op}}
   30 
   31 #########################################################################
   32 
   33 1;
   34 

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9