Changeset 21648 for perl5

Show
Ignore:
Timestamp:
07/31/08 13:05:17 (4 months ago)
Author:
fglock
Message:

[v6.pm] complex

Location:
perl5/Pugs-Compiler-Perl6/lib
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • perl5/Pugs-Compiler-Perl6/lib/Pugs/Emitter/Perl6/Perl5.pm

    r21647 r21648  
    248248} 
    249249 
     250sub _emit_complex { 
     251    my $n = shift; 
     252    $n =~ s/i/*i/; 
     253    "($n)"; 
     254} 
     255 
    250256sub _emit { 
    251257    my $n = $_[0]; 
     
    292298    return $n->{num} 
    293299        if exists $n->{num}; 
     300 
     301    return _emit_complex( $n->{complex} ) 
     302        if exists $n->{complex}; 
    294303 
    295304    return _emit_pair( $n->{pair} ) 
     
    12811290                bool->import();  # True, False 
    12821291                use Quantum::Superpositions; 
     1292                use Math::Complex; 
    12831293                $attributes "; 
    12841294 
  • perl5/Pugs-Compiler-Perl6/lib/Pugs/Grammar/Term.pm

    r21640 r21648  
    675675            ^ ), 
    676676        q() => Pugs::Compiler::Token->compile( q^ 
    677                 ### num/int 
     677                ### num/int/complex 
    678678                \d+  
    679679                [ 
    680680                    \.\d+ 
    681681                    [ <[Ee]> <[+-]>? \d+ ]? 
    682                     { return { num => $() ,} }  
     682                    [  i  { return { complex => $() ,} }  
     683                    |     { return { num     => $() ,} }  
     684                    ] 
    683685                | 
    684686                    <[Ee]> <[+-]>? \d+  
    685                     { return { num => $() ,} }  
     687                    [  i  { return { complex => $() ,} }  
     688                    |     { return { num     => $() ,} }  
     689                    ] 
    686690                | 
    687                     { return { int => $() ,} }  
     691                    [  i  { return { complex => $() ,} }  
     692                    |     { return { int     => $() ,} }  
     693                    ] 
    688694                ] 
    689695            | 
  • perl5/Pugs-Compiler-Perl6/lib/v6.pm

    r21639 r21648  
    9494        "use Scalar::Util; 
    9595         use Quantum::Superpositions; 
     96         use Math::Complex; 
    9697         use Pugs::Runtime::Perl6; 
    9798         use Pugs::Runtime::Perl6Prelude;