Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Perlito version 4.1 - floating point numbers; while loop

  • Loading branch information...
commit 24371e24658f19d4efb84e670a19cf4d6405ce4a 1 parent 40868e5
@fglock authored
View
5 ChangeLog
@@ -1,5 +1,6 @@
-5.0 (plan)
-- these features are now enabled: while loop, floating point numbers
+4.1 2010-03-24
+- floating point numbers
+- while loop
4.0 2010-03-20
- Go backend bootstrap.
View
4 TODO
@@ -34,7 +34,7 @@ MiniPerl6 in Lisp
MiniPerl6 in Go
-(no issues at the moment)
+- the floating point implementation seemed to slow down the bootstrapped compiler
MiniPerl6 in Perl5
@@ -81,7 +81,7 @@ Nice to Have
- replace := with = everywhere. Alternately, impl both := and = in all backends
-- impl 'while', 'elsif'
+- impl 'elsif'
- 'mp6-format' script (see gofmt and perltidy)
View
4 lib/MiniPerl6/Go/Emitter.pm
@@ -802,6 +802,10 @@ class Apply {
~ (@.arguments.>>emit_go).join(', ') ~ ')' }
if $code eq 'infix:<->' { return 'f_sub( '
~ (@.arguments.>>emit_go).join(', ') ~ ')' }
+ if $code eq 'infix:<*>' { return 'f_mul( '
+ ~ (@.arguments.>>emit_go).join(', ') ~ ')' }
+ if $code eq 'infix:</>' { return 'f_div( '
+ ~ (@.arguments.>>emit_go).join(', ') ~ ')' }
if $code eq 'infix:<>>' { return 'f_greater( '
~ (@.arguments.>>emit_go).join(', ') ~ ')' }
if $code eq 'infix:<<>' { return 'f_smaller( '
View
42 lib/MiniPerl6/Go/Runtime.go
@@ -629,6 +629,48 @@ func f_sub(v1, v2 *Any) *Any {
}
return i_0
}
+func f_mul(v1, v2 *Any) *Any {
+ n1 := f_numify(v1);
+ n2 := f_numify(v2);
+ switch i := (*n1).(type) {
+ case Int:
+ switch j := (*n2).(type) {
+ case Int:
+ return toInt( int((*n1).(Int)) * int((*n2).(Int)) )
+ case Num:
+ return toNum( float((*n1).(Int)) * float((*n2).(Num)) )
+ }
+ case Num:
+ switch j := (*n2).(type) {
+ case Int:
+ return toNum( float((*n1).(Num)) * float((*n2).(Int)) )
+ case Num:
+ return toNum( float((*n1).(Num)) * float((*n2).(Num)) )
+ }
+ }
+ return i_0
+}
+func f_div(v1, v2 *Any) *Any {
+ n1 := f_numify(v1);
+ n2 := f_numify(v2);
+ switch i := (*n1).(type) {
+ case Int:
+ switch j := (*n2).(type) {
+ case Int:
+ return toInt( int((*n1).(Int)) / int((*n2).(Int)) )
+ case Num:
+ return toNum( float((*n1).(Int)) / float((*n2).(Num)) )
+ }
+ case Num:
+ switch j := (*n2).(type) {
+ case Int:
+ return toNum( float((*n1).(Num)) / float((*n2).(Int)) )
+ case Num:
+ return toNum( float((*n1).(Num)) / float((*n2).(Num)) )
+ }
+ }
+ return i_0
+}
func f_greater(v1, v2 *Any) *Any {
n1 := f_numify(v1);
n2 := f_numify(v2);
View
24 lib/MiniPerl6/Javascript/Emitter.pm
@@ -562,26 +562,24 @@ class Apply {
if $code eq 'infix:<~>' { return '( f_string(' ~ (@.arguments[0]).emit_javascript ~ ')'
~ ' + f_string(' ~ (@.arguments[1]).emit_javascript ~ ') )' };
if $code eq 'infix:<+>' { return 'f_add(' ~ (@.arguments.>>emit_javascript).join(', ') ~ ')' };
- if $code eq 'infix:<->' { return '(' ~ (@.arguments.>>emit_javascript).join(' - ') ~ ')' };
- if $code eq 'infix:<>>' { return '(' ~ (@.arguments.>>emit_javascript).join(' > ') ~ ')' };
- if $code eq 'infix:<<>' { return '(' ~ (@.arguments.>>emit_javascript).join(' < ') ~ ')' };
- if $code eq 'infix:<>=>' { return '(' ~ (@.arguments.>>emit_javascript).join(' >= ') ~ ')' };
- if $code eq 'infix:<<=>' { return '(' ~ (@.arguments.>>emit_javascript).join(' <= ') ~ ')' };
+ if $code eq 'infix:<->' { return '(' ~ (@.arguments.>>emit_javascript).join(' - ') ~ ')' };
+ if $code eq 'infix:<*>' { return '(' ~ (@.arguments.>>emit_javascript).join(' * ') ~ ')' };
+ if $code eq 'infix:</>' { return '(' ~ (@.arguments.>>emit_javascript).join(' / ') ~ ')' };
+ if $code eq 'infix:<>>' { return '(' ~ (@.arguments.>>emit_javascript).join(' > ') ~ ')' };
+ if $code eq 'infix:<<>' { return '(' ~ (@.arguments.>>emit_javascript).join(' < ') ~ ')' };
+ if $code eq 'infix:<>=>' { return '(' ~ (@.arguments.>>emit_javascript).join(' >= ') ~ ')' };
+ if $code eq 'infix:<<=>' { return '(' ~ (@.arguments.>>emit_javascript).join(' <= ') ~ ')' };
- #if $code eq 'infix:<&&>' { return '(' ~ (@.arguments.>>emit_javascript).join(' && ') ~ ')' };
- #if $code eq 'infix:<||>' { return '(' ~ (@.arguments.>>emit_javascript).join(' || ') ~ ')' };
-
if $code eq 'infix:<&&>' { return '( f_bool(' ~ (@.arguments[0]).emit_javascript ~ ')'
~ ' && f_bool(' ~ (@.arguments[1]).emit_javascript ~ ') )' };
if $code eq 'infix:<||>' { return '( f_bool(' ~ (@.arguments[0]).emit_javascript ~ ')'
~ ' || f_bool(' ~ (@.arguments[1]).emit_javascript ~ ') )' };
-
- if $code eq 'infix:<eq>' { return '(' ~ (@.arguments.>>emit_javascript).join(' == ') ~ ')' };
- if $code eq 'infix:<ne>' { return '(' ~ (@.arguments.>>emit_javascript).join(' != ') ~ ')' };
+ if $code eq 'infix:<eq>' { return '(' ~ (@.arguments.>>emit_javascript).join(' == ') ~ ')' };
+ if $code eq 'infix:<ne>' { return '(' ~ (@.arguments.>>emit_javascript).join(' != ') ~ ')' };
- if $code eq 'infix:<==>' { return '(' ~ (@.arguments.>>emit_javascript).join(' == ') ~ ')' };
- if $code eq 'infix:<!=>' { return '(' ~ (@.arguments.>>emit_javascript).join(' != ') ~ ')' };
+ if $code eq 'infix:<==>' { return '(' ~ (@.arguments.>>emit_javascript).join(' == ') ~ ')' };
+ if $code eq 'infix:<!=>' { return '(' ~ (@.arguments.>>emit_javascript).join(' != ') ~ ')' };
if $code eq 'exists' {
my $arg := @.arguments[0];
View
55 lib/MiniPerl6/Perl5/Emitter.pm
@@ -367,38 +367,40 @@ class Apply {
if $code eq 'print' { return 'Main::print(' ~ (@.arguments.>>emit).join(', ') ~ ')' };
if $code eq 'warn' { return 'warn(' ~ (@.arguments.>>emit).join(', ') ~ ')' };
- if $code eq 'array' { return '@{' ~ (@.arguments.>>emit).join(' ') ~ '}' };
- if $code eq 'pop' { return 'pop( @{' ~ (@.arguments.>>emit).join(' ') ~ '} )' };
- if $code eq 'push' { return 'push( @{' ~ (@.arguments[0]).emit ~ '}, '~ (@.arguments[1]).emit ~ ' )' };
+ if $code eq 'array' { return '@{' ~ (@.arguments.>>emit).join(' ') ~ '}' };
+ if $code eq 'pop' { return 'pop( @{' ~ (@.arguments.>>emit).join(' ') ~ '} )' };
+ if $code eq 'push' { return 'push( @{' ~ (@.arguments[0]).emit ~ '}, ' ~ (@.arguments[1]).emit ~ ' )' };
if $code eq 'shift' { return 'shift( @{' ~ (@.arguments.>>emit).join(' ') ~ '} )' };
- if $code eq 'Int' { return '(0+' ~ (@.arguments[0]).emit ~ ')' };
- if $code eq 'Num' { return '(0+' ~ (@.arguments[0]).emit ~ ')' };
+ if $code eq 'Int' { return '(0+' ~ (@.arguments[0]).emit ~ ')' };
+ if $code eq 'Num' { return '(0+' ~ (@.arguments[0]).emit ~ ')' };
if $code eq 'prefix:<~>' { return '("" . ' ~ (@.arguments.>>emit).join(' ') ~ ')' };
- if $code eq 'prefix:<!>' { return '(' ~ (@.arguments.>>emit).join(' ') ~ ' ? 0 : 1)' };
- if $code eq 'prefix:<?>' { return '(' ~ (@.arguments.>>emit).join(' ') ~ ' ? 1 : 0)' };
-
- if $code eq 'prefix:<$>' { return '${' ~ (@.arguments.>>emit).join(' ') ~ '}' };
- if $code eq 'prefix:<@>' { return '@{' ~ (@.arguments.>>emit).join(' ') ~ '}' };
- if $code eq 'prefix:<%>' { return '%{' ~ (@.arguments.>>emit).join(' ') ~ '}' };
-
- if $code eq 'infix:<~>' { return '' ~ (@.arguments.>>emit).join(' . ') ~ '' };
- if $code eq 'infix:<+>' { return '(' ~ (@.arguments.>>emit).join(' + ') ~ ')' };
- if $code eq 'infix:<->' { return '(' ~ (@.arguments.>>emit).join(' - ') ~ ')' };
- if $code eq 'infix:<>>' { return '(' ~ (@.arguments.>>emit).join(' > ') ~ ')' };
- if $code eq 'infix:<<>' { return '(' ~ (@.arguments.>>emit).join(' < ') ~ ')' };
- if $code eq 'infix:<x>' { return '(' ~ (@.arguments.>>emit).join(' x ') ~ ')' };
- if $code eq 'infix:<>=>' { return '(' ~ (@.arguments.>>emit).join(' >= ') ~ ')' };
- if $code eq 'infix:<<=>' { return '(' ~ (@.arguments.>>emit).join(' <= ') ~ ')' };
+ if $code eq 'prefix:<!>' { return '(' ~ (@.arguments.>>emit).join(' ') ~ ' ? 0 : 1)' };
+ if $code eq 'prefix:<?>' { return '(' ~ (@.arguments.>>emit).join(' ') ~ ' ? 1 : 0)' };
+
+ if $code eq 'prefix:<$>' { return '${' ~ (@.arguments.>>emit).join(' ') ~ '}' };
+ if $code eq 'prefix:<@>' { return '@{' ~ (@.arguments.>>emit).join(' ') ~ '}' };
+ if $code eq 'prefix:<%>' { return '%{' ~ (@.arguments.>>emit).join(' ') ~ '}' };
+
+ if $code eq 'infix:<~>' { return '' ~ (@.arguments.>>emit).join(' . ') ~ '' };
+ if $code eq 'infix:<+>' { return '(' ~ (@.arguments.>>emit).join(' + ') ~ ')' };
+ if $code eq 'infix:<->' { return '(' ~ (@.arguments.>>emit).join(' - ') ~ ')' };
+ if $code eq 'infix:<*>' { return '(' ~ (@.arguments.>>emit).join(' * ') ~ ')' };
+ if $code eq 'infix:</>' { return '(' ~ (@.arguments.>>emit).join(' / ') ~ ')' };
+ if $code eq 'infix:<>>' { return '(' ~ (@.arguments.>>emit).join(' > ') ~ ')' };
+ if $code eq 'infix:<<>' { return '(' ~ (@.arguments.>>emit).join(' < ') ~ ')' };
+ if $code eq 'infix:<>=>' { return '(' ~ (@.arguments.>>emit).join(' >= ') ~ ')' };
+ if $code eq 'infix:<<=>' { return '(' ~ (@.arguments.>>emit).join(' <= ') ~ ')' };
+ if $code eq 'infix:<x>' { return '(' ~ (@.arguments.>>emit).join(' x ') ~ ')' };
- if $code eq 'infix:<&&>' { return '(' ~ (@.arguments.>>emit).join(' && ') ~ ')' };
- if $code eq 'infix:<||>' { return '(' ~ (@.arguments.>>emit).join(' || ') ~ ')' };
- if $code eq 'infix:<eq>' { return '(' ~ (@.arguments.>>emit).join(' eq ') ~ ')' };
- if $code eq 'infix:<ne>' { return '(' ~ (@.arguments.>>emit).join(' ne ') ~ ')' };
+ if $code eq 'infix:<&&>' { return '(' ~ (@.arguments.>>emit).join(' && ') ~ ')' };
+ if $code eq 'infix:<||>' { return '(' ~ (@.arguments.>>emit).join(' || ') ~ ')' };
+ if $code eq 'infix:<eq>' { return '(' ~ (@.arguments.>>emit).join(' eq ') ~ ')' };
+ if $code eq 'infix:<ne>' { return '(' ~ (@.arguments.>>emit).join(' ne ') ~ ')' };
- if $code eq 'infix:<==>' { return '(' ~ (@.arguments.>>emit).join(' == ') ~ ')' };
- if $code eq 'infix:<!=>' { return '(' ~ (@.arguments.>>emit).join(' != ') ~ ')' };
+ if $code eq 'infix:<==>' { return '(' ~ (@.arguments.>>emit).join(' == ') ~ ')' };
+ if $code eq 'infix:<!=>' { return '(' ~ (@.arguments.>>emit).join(' != ') ~ ')' };
if $code eq 'ternary:<?? !!>' {
return '(' ~ (@.arguments[0]).emit ~
@@ -407,7 +409,6 @@ class Apply {
')' };
$code ~ '(' ~ (@.arguments.>>emit).join(', ') ~ ')';
- # '(' ~ $.code.emit ~ ')->(' ~ @.arguments.>>emit.join(', ') ~ ')';
}
}
View
2  lib5/MiniPerl6/Go/Emitter.pm
@@ -249,7 +249,7 @@ sub new { shift; bless { @_ }, "Apply" }
sub code { $_[0]->{code} };
sub arguments { $_[0]->{arguments} };
sub namespace { $_[0]->{namespace} };
-sub emit_go { my $self = $_[0]; (my $code = $self->{code}); if (Main::isa($code, 'Str')) { } else { return('(' . $self->{code}->emit_go() . ')->(' . Main::join([ map { $_->emit() } @{ $self->{arguments} } ], ', ') . ')') }; if (($code eq 'self')) { return('v_self') } else { }; if (($code eq 'false')) { return('b_false()') } else { }; if (($code eq 'make')) { return('func () *Any { ' . 'tmp := ' . Main::join([ map { $_->emit_go() } @{ $self->{arguments} } ], ', ') . '; ' . '*(*v_MATCH).(capture_er).f_capture(Capture{}) = *tmp; ' . 'return tmp; ' . '}()') } else { }; if (($code eq 'say')) { return('f_print( Capture{ p : []*Any{ ' . Main::join([ map { $_->emit_go() } @{ $self->{arguments} } ], ', ') . ', toStr("\\n") } } )') } else { }; if (($code eq 'print')) { return('f_print( Capture{ p : []*Any{ ' . Main::join([ map { $_->emit_go() } @{ $self->{arguments} } ], ', ') . ' } } )') } else { }; if (($code eq 'warn')) { return('f_print_stderr( Capture{ p : []*Any{ ' . Main::join([ map { $_->emit_go() } @{ $self->{arguments} } ], ', ') . ', toStr("\\n") } } )') } else { }; if (($code eq 'die')) { return('f_die( Capture{ p : []*Any{ ' . Main::join([ map { $_->emit_go() } @{ $self->{arguments} } ], ', ') . ' } } )') } else { }; if (($code eq 'defined')) { return('f_defined( Capture{ p : []*Any{ ' . Main::join([ map { $_->emit_go() } @{ $self->{arguments} } ], ', ') . ' } } )') } else { }; if (($code eq 'pop')) { return('f_pop( Capture{ p : []*Any{ ' . Main::join([ map { $_->emit_go() } @{ $self->{arguments} } ], ', ') . ' } } )') } else { }; if (($code eq 'push')) { return('f_push( Capture{ p : []*Any{ ' . Main::join([ map { $_->emit_go() } @{ $self->{arguments} } ], ', ') . ' } } )') } else { }; if (($code eq 'shift')) { return('f_shift( Capture{ p : []*Any{ ' . Main::join([ map { $_->emit_go() } @{ $self->{arguments} } ], ', ') . ' } } )') } else { }; if (($code eq 'index')) { return('f_index( Capture{ p : []*Any{ ' . Main::join([ map { $_->emit_go() } @{ $self->{arguments} } ], ', ') . ' } } )') } else { }; if (($code eq 'substr')) { return('f_substr( Capture{ p : []*Any{ ' . Main::join([ map { $_->emit_go() } @{ $self->{arguments} } ], ', ') . ' } } )') } else { }; if (($code eq 'scalar')) { return('f_scalar( Capture{ p : []*Any{ ' . Main::join([ map { $_->emit_go() } @{ $self->{arguments} } ], ', ') . ' } } )') } else { }; if (($code eq 'Int')) { return('toInt(' . 'toint(' . $self->{arguments}->[0]->emit_go() . ')' . ')') } else { }; if (($code eq 'Num')) { return('toNum(' . 'tonum(' . $self->{arguments}->[0]->emit_go() . ')' . ')') } else { }; if (($code eq 'exists')) { (my $arg = $self->{arguments}->[0]);if (Main::isa($arg, 'Lookup')) { return('(*' . $arg->obj()->emit_go() . ')' . '.(exists_er).f_exists(Capture{ p : []*Any{ ' . $arg->index_exp()->emit_go() . ' } } )') } else { } } else { }; if (($code eq 'prefix:<~>')) { return(Call::emit_go_call($self->{arguments}->[0], 'Str')) } else { }; if (($code eq 'prefix:<!>')) { return('toBool(!tobool(' . $self->{arguments}->[0]->emit_go() . '))') } else { }; if (($code eq 'prefix:<?>')) { return(Call::emit_go_call($self->{arguments}->[0], 'Bool')) } else { }; if (($code eq 'prefix:<$>')) { return('f_scalar( Capture{ p : []*Any{ ' . Main::join([ map { $_->emit_go() } @{ $self->{arguments} } ], ', ') . ' } } )') } else { }; if (($code eq 'prefix:<@>')) { return(Call::emit_go_call($self->{arguments}->[0], 'array')) } else { }; if (($code eq 'prefix:<%>')) { return(Call::emit_go_call($self->{arguments}->[0], 'hash')) } else { }; if (($code eq 'infix:<~>')) { return('toStr( ' . 'tostr(' . $self->{arguments}->[0]->emit_go() . ') + ' . 'tostr(' . $self->{arguments}->[1]->emit_go() . ') ' . ')') } else { }; if (($code eq 'infix:<+>')) { return('f_add( ' . Main::join([ map { $_->emit_go() } @{ $self->{arguments} } ], ', ') . ')') } else { }; if (($code eq 'infix:<->')) { return('f_sub( ' . Main::join([ map { $_->emit_go() } @{ $self->{arguments} } ], ', ') . ')') } else { }; if (($code eq 'infix:<>>')) { return('f_greater( ' . Main::join([ map { $_->emit_go() } @{ $self->{arguments} } ], ', ') . ')') } else { }; if (($code eq 'infix:<<>')) { return('f_smaller( ' . Main::join([ map { $_->emit_go() } @{ $self->{arguments} } ], ', ') . ')') } else { }; if (($code eq 'infix:<>=>')) { return('toBool( ' . 'toint(' . $self->{arguments}->[0]->emit_go() . ') >= ' . 'toint(' . $self->{arguments}->[1]->emit_go() . ') ' . ')') } else { }; if (($code eq 'infix:<<=>')) { return('toBool( ' . 'toint(' . $self->{arguments}->[0]->emit_go() . ') <= ' . 'toint(' . $self->{arguments}->[1]->emit_go() . ') ' . ')') } else { }; if (($code eq 'infix:<&&>')) { return('f_and( ' . 'func () *Any { return ' . $self->{arguments}->[0]->emit_go() . ' }, ' . 'func () *Any { return ' . $self->{arguments}->[1]->emit_go() . ' } ' . ')') } else { }; if (($code eq 'infix:<||>')) { return('f_or( ' . 'func () *Any { return ' . $self->{arguments}->[0]->emit_go() . ' }, ' . 'func () *Any { return ' . $self->{arguments}->[1]->emit_go() . ' } ' . ')') } else { }; if (($code eq 'infix:<eq>')) { return('toBool(' . 'tostr(' . $self->{arguments}->[0]->emit_go() . ') == ' . 'tostr(' . $self->{arguments}->[1]->emit_go() . ')' . ')') } else { }; if (($code eq 'infix:<ne>')) { return('toBool(' . 'tostr(' . $self->{arguments}->[0]->emit_go() . ') != ' . 'tostr(' . $self->{arguments}->[1]->emit_go() . ')' . ')') } else { }; if (($code eq 'infix:<==>')) { return('toBool(' . 'toint(' . $self->{arguments}->[0]->emit_go() . ') == ' . 'toint(' . $self->{arguments}->[1]->emit_go() . ') ' . ')') } else { }; if (($code eq 'infix:<!=>')) { return('toBool(' . 'toint(' . $self->{arguments}->[0]->emit_go() . ') != ' . 'toint(' . $self->{arguments}->[1]->emit_go() . ') ' . ')') } else { }; if (($code eq 'ternary:<?? !!>')) { return('func () *Any { ' . 'if tobool( ' . Call::emit_go_call($self->{arguments}->[0], 'Bool') . ' ) ' . '{ return ' . $self->{arguments}->[1]->emit_go() . ' }; ' . 'return ' . $self->{arguments}->[2]->emit_go() . ' ' . '}()') } else { }; ($code = 'f_' . $self->{code}); if ($self->{namespace}) { ($code = 'Namespace_' . Main::to_go_namespace($self->{namespace}) . '.' . $code) } else { ($code = 'this_namespace.' . $code) }; $code . '( Capture{ p : []*Any{ ' . Main::join([ map { $_->emit_go() } @{ $self->{arguments} } ], ', ') . ' } } )' }
+sub emit_go { my $self = $_[0]; (my $code = $self->{code}); if (Main::isa($code, 'Str')) { } else { return('(' . $self->{code}->emit_go() . ')->(' . Main::join([ map { $_->emit() } @{ $self->{arguments} } ], ', ') . ')') }; if (($code eq 'self')) { return('v_self') } else { }; if (($code eq 'false')) { return('b_false()') } else { }; if (($code eq 'make')) { return('func () *Any { ' . 'tmp := ' . Main::join([ map { $_->emit_go() } @{ $self->{arguments} } ], ', ') . '; ' . '*(*v_MATCH).(capture_er).f_capture(Capture{}) = *tmp; ' . 'return tmp; ' . '}()') } else { }; if (($code eq 'say')) { return('f_print( Capture{ p : []*Any{ ' . Main::join([ map { $_->emit_go() } @{ $self->{arguments} } ], ', ') . ', toStr("\\n") } } )') } else { }; if (($code eq 'print')) { return('f_print( Capture{ p : []*Any{ ' . Main::join([ map { $_->emit_go() } @{ $self->{arguments} } ], ', ') . ' } } )') } else { }; if (($code eq 'warn')) { return('f_print_stderr( Capture{ p : []*Any{ ' . Main::join([ map { $_->emit_go() } @{ $self->{arguments} } ], ', ') . ', toStr("\\n") } } )') } else { }; if (($code eq 'die')) { return('f_die( Capture{ p : []*Any{ ' . Main::join([ map { $_->emit_go() } @{ $self->{arguments} } ], ', ') . ' } } )') } else { }; if (($code eq 'defined')) { return('f_defined( Capture{ p : []*Any{ ' . Main::join([ map { $_->emit_go() } @{ $self->{arguments} } ], ', ') . ' } } )') } else { }; if (($code eq 'pop')) { return('f_pop( Capture{ p : []*Any{ ' . Main::join([ map { $_->emit_go() } @{ $self->{arguments} } ], ', ') . ' } } )') } else { }; if (($code eq 'push')) { return('f_push( Capture{ p : []*Any{ ' . Main::join([ map { $_->emit_go() } @{ $self->{arguments} } ], ', ') . ' } } )') } else { }; if (($code eq 'shift')) { return('f_shift( Capture{ p : []*Any{ ' . Main::join([ map { $_->emit_go() } @{ $self->{arguments} } ], ', ') . ' } } )') } else { }; if (($code eq 'index')) { return('f_index( Capture{ p : []*Any{ ' . Main::join([ map { $_->emit_go() } @{ $self->{arguments} } ], ', ') . ' } } )') } else { }; if (($code eq 'substr')) { return('f_substr( Capture{ p : []*Any{ ' . Main::join([ map { $_->emit_go() } @{ $self->{arguments} } ], ', ') . ' } } )') } else { }; if (($code eq 'scalar')) { return('f_scalar( Capture{ p : []*Any{ ' . Main::join([ map { $_->emit_go() } @{ $self->{arguments} } ], ', ') . ' } } )') } else { }; if (($code eq 'Int')) { return('toInt(' . 'toint(' . $self->{arguments}->[0]->emit_go() . ')' . ')') } else { }; if (($code eq 'Num')) { return('toNum(' . 'tonum(' . $self->{arguments}->[0]->emit_go() . ')' . ')') } else { }; if (($code eq 'exists')) { (my $arg = $self->{arguments}->[0]);if (Main::isa($arg, 'Lookup')) { return('(*' . $arg->obj()->emit_go() . ')' . '.(exists_er).f_exists(Capture{ p : []*Any{ ' . $arg->index_exp()->emit_go() . ' } } )') } else { } } else { }; if (($code eq 'prefix:<~>')) { return(Call::emit_go_call($self->{arguments}->[0], 'Str')) } else { }; if (($code eq 'prefix:<!>')) { return('toBool(!tobool(' . $self->{arguments}->[0]->emit_go() . '))') } else { }; if (($code eq 'prefix:<?>')) { return(Call::emit_go_call($self->{arguments}->[0], 'Bool')) } else { }; if (($code eq 'prefix:<$>')) { return('f_scalar( Capture{ p : []*Any{ ' . Main::join([ map { $_->emit_go() } @{ $self->{arguments} } ], ', ') . ' } } )') } else { }; if (($code eq 'prefix:<@>')) { return(Call::emit_go_call($self->{arguments}->[0], 'array')) } else { }; if (($code eq 'prefix:<%>')) { return(Call::emit_go_call($self->{arguments}->[0], 'hash')) } else { }; if (($code eq 'infix:<~>')) { return('toStr( ' . 'tostr(' . $self->{arguments}->[0]->emit_go() . ') + ' . 'tostr(' . $self->{arguments}->[1]->emit_go() . ') ' . ')') } else { }; if (($code eq 'infix:<+>')) { return('f_add( ' . Main::join([ map { $_->emit_go() } @{ $self->{arguments} } ], ', ') . ')') } else { }; if (($code eq 'infix:<->')) { return('f_sub( ' . Main::join([ map { $_->emit_go() } @{ $self->{arguments} } ], ', ') . ')') } else { }; if (($code eq 'infix:<*>')) { return('f_mul( ' . Main::join([ map { $_->emit_go() } @{ $self->{arguments} } ], ', ') . ')') } else { }; if (($code eq 'infix:</>')) { return('f_div( ' . Main::join([ map { $_->emit_go() } @{ $self->{arguments} } ], ', ') . ')') } else { }; if (($code eq 'infix:<>>')) { return('f_greater( ' . Main::join([ map { $_->emit_go() } @{ $self->{arguments} } ], ', ') . ')') } else { }; if (($code eq 'infix:<<>')) { return('f_smaller( ' . Main::join([ map { $_->emit_go() } @{ $self->{arguments} } ], ', ') . ')') } else { }; if (($code eq 'infix:<>=>')) { return('toBool( ' . 'toint(' . $self->{arguments}->[0]->emit_go() . ') >= ' . 'toint(' . $self->{arguments}->[1]->emit_go() . ') ' . ')') } else { }; if (($code eq 'infix:<<=>')) { return('toBool( ' . 'toint(' . $self->{arguments}->[0]->emit_go() . ') <= ' . 'toint(' . $self->{arguments}->[1]->emit_go() . ') ' . ')') } else { }; if (($code eq 'infix:<&&>')) { return('f_and( ' . 'func () *Any { return ' . $self->{arguments}->[0]->emit_go() . ' }, ' . 'func () *Any { return ' . $self->{arguments}->[1]->emit_go() . ' } ' . ')') } else { }; if (($code eq 'infix:<||>')) { return('f_or( ' . 'func () *Any { return ' . $self->{arguments}->[0]->emit_go() . ' }, ' . 'func () *Any { return ' . $self->{arguments}->[1]->emit_go() . ' } ' . ')') } else { }; if (($code eq 'infix:<eq>')) { return('toBool(' . 'tostr(' . $self->{arguments}->[0]->emit_go() . ') == ' . 'tostr(' . $self->{arguments}->[1]->emit_go() . ')' . ')') } else { }; if (($code eq 'infix:<ne>')) { return('toBool(' . 'tostr(' . $self->{arguments}->[0]->emit_go() . ') != ' . 'tostr(' . $self->{arguments}->[1]->emit_go() . ')' . ')') } else { }; if (($code eq 'infix:<==>')) { return('toBool(' . 'toint(' . $self->{arguments}->[0]->emit_go() . ') == ' . 'toint(' . $self->{arguments}->[1]->emit_go() . ') ' . ')') } else { }; if (($code eq 'infix:<!=>')) { return('toBool(' . 'toint(' . $self->{arguments}->[0]->emit_go() . ') != ' . 'toint(' . $self->{arguments}->[1]->emit_go() . ') ' . ')') } else { }; if (($code eq 'ternary:<?? !!>')) { return('func () *Any { ' . 'if tobool( ' . Call::emit_go_call($self->{arguments}->[0], 'Bool') . ' ) ' . '{ return ' . $self->{arguments}->[1]->emit_go() . ' }; ' . 'return ' . $self->{arguments}->[2]->emit_go() . ' ' . '}()') } else { }; ($code = 'f_' . $self->{code}); if ($self->{namespace}) { ($code = 'Namespace_' . Main::to_go_namespace($self->{namespace}) . '.' . $code) } else { ($code = 'this_namespace.' . $code) }; $code . '( Capture{ p : []*Any{ ' . Main::join([ map { $_->emit_go() } @{ $self->{arguments} } ], ', ') . ' } } )' }
}
{
View
42 lib5/MiniPerl6/Go/Runtime.go
@@ -629,6 +629,48 @@ func f_sub(v1, v2 *Any) *Any {
}
return i_0
}
+func f_mul(v1, v2 *Any) *Any {
+ n1 := f_numify(v1);
+ n2 := f_numify(v2);
+ switch i := (*n1).(type) {
+ case Int:
+ switch j := (*n2).(type) {
+ case Int:
+ return toInt( int((*n1).(Int)) * int((*n2).(Int)) )
+ case Num:
+ return toNum( float((*n1).(Int)) * float((*n2).(Num)) )
+ }
+ case Num:
+ switch j := (*n2).(type) {
+ case Int:
+ return toNum( float((*n1).(Num)) * float((*n2).(Int)) )
+ case Num:
+ return toNum( float((*n1).(Num)) * float((*n2).(Num)) )
+ }
+ }
+ return i_0
+}
+func f_div(v1, v2 *Any) *Any {
+ n1 := f_numify(v1);
+ n2 := f_numify(v2);
+ switch i := (*n1).(type) {
+ case Int:
+ switch j := (*n2).(type) {
+ case Int:
+ return toInt( int((*n1).(Int)) / int((*n2).(Int)) )
+ case Num:
+ return toNum( float((*n1).(Int)) / float((*n2).(Num)) )
+ }
+ case Num:
+ switch j := (*n2).(type) {
+ case Int:
+ return toNum( float((*n1).(Num)) / float((*n2).(Int)) )
+ case Num:
+ return toNum( float((*n1).(Num)) / float((*n2).(Num)) )
+ }
+ }
+ return i_0
+}
func f_greater(v1, v2 *Any) *Any {
n1 := f_numify(v1);
n2 := f_numify(v2);
View
2  lib5/MiniPerl6/Javascript/Emitter.pm
@@ -158,7 +158,7 @@ sub new { shift; bless { @_ }, "Apply" }
sub code { $_[0]->{code} };
sub arguments { $_[0]->{arguments} };
sub namespace { $_[0]->{namespace} };
-sub emit_javascript { my $self = $_[0]; (my $code = $self->{code}); if (Main::isa($code, 'Str')) { } else { return('(' . $self->{code}->emit_javascript() . ')->(' . Main::join([ map { $_->emit() } @{ $self->{arguments} } ], ', ') . ')') }; if (($code eq 'self')) { return('v_self') } else { }; if (($code eq 'false')) { return('0') } else { }; if (($code eq 'make')) { return('(v_MATCH.v_capture = ' . Main::join([ map { $_->emit_javascript() } @{ $self->{arguments} } ], ', ') . ')') } else { }; if (($code eq 'say')) { return('say(' . Main::join([ map { $_->emit_javascript() } @{ $self->{arguments} } ], ' + ') . ')') } else { }; if (($code eq 'print')) { return('f_print(' . Main::join([ map { $_->emit_javascript() } @{ $self->{arguments} } ], ' + ') . ')') } else { }; if (($code eq 'warn')) { return('f_warn(' . Main::join([ map { $_->emit_javascript() } @{ $self->{arguments} } ], ' + ') . ')') } else { }; if (($code eq 'defined')) { return('(' . Main::join([ map { $_->emit_javascript() } @{ $self->{arguments} } ], ' ') . ' != null)') } else { }; if (($code eq 'substr')) { return('(' . $self->{arguments}->[0]->emit_javascript() . ' || "").substr(' . $self->{arguments}->[1]->emit_javascript() . ', ' . $self->{arguments}->[2]->emit_javascript() . ')') } else { }; if (($code eq 'Int')) { return('parseInt(' . $self->{arguments}->[0]->emit_javascript() . ')') } else { }; if (($code eq 'Num')) { return('parseFloat(' . $self->{arguments}->[0]->emit_javascript() . ')') } else { }; if (($code eq 'prefix:<~>')) { return('(' . Main::join([ map { $_->emit_javascript() } @{ $self->{arguments} } ], ' ') . ').f_string()') } else { }; if (($code eq 'prefix:<!>')) { return('( f_bool(' . Main::join([ map { $_->emit_javascript() } @{ $self->{arguments} } ], ' ') . ') ? false : true)') } else { }; if (($code eq 'prefix:<?>')) { return('( f_bool(' . Main::join([ map { $_->emit_javascript() } @{ $self->{arguments} } ], ' ') . ') ? true : false)') } else { }; if (($code eq 'prefix:<$>')) { return('f_scalar(' . Main::join([ map { $_->emit_javascript() } @{ $self->{arguments} } ], ' ') . ')') } else { }; if (($code eq 'prefix:<@>')) { return('(' . Main::join([ map { $_->emit_javascript() } @{ $self->{arguments} } ], ' ') . ')') } else { }; if (($code eq 'prefix:<%>')) { return('(' . Main::join([ map { $_->emit_javascript() } @{ $self->{arguments} } ], ' ') . ').f_hash()') } else { }; if (($code eq 'infix:<~>')) { return('( f_string(' . $self->{arguments}->[0]->emit_javascript() . ')' . ' + f_string(' . $self->{arguments}->[1]->emit_javascript() . ') )') } else { }; if (($code eq 'infix:<+>')) { return('f_add(' . Main::join([ map { $_->emit_javascript() } @{ $self->{arguments} } ], ', ') . ')') } else { }; if (($code eq 'infix:<->')) { return('(' . Main::join([ map { $_->emit_javascript() } @{ $self->{arguments} } ], ' - ') . ')') } else { }; if (($code eq 'infix:<>>')) { return('(' . Main::join([ map { $_->emit_javascript() } @{ $self->{arguments} } ], ' > ') . ')') } else { }; if (($code eq 'infix:<<>')) { return('(' . Main::join([ map { $_->emit_javascript() } @{ $self->{arguments} } ], ' < ') . ')') } else { }; if (($code eq 'infix:<>=>')) { return('(' . Main::join([ map { $_->emit_javascript() } @{ $self->{arguments} } ], ' >= ') . ')') } else { }; if (($code eq 'infix:<<=>')) { return('(' . Main::join([ map { $_->emit_javascript() } @{ $self->{arguments} } ], ' <= ') . ')') } else { }; if (($code eq 'infix:<&&>')) { return('( f_bool(' . $self->{arguments}->[0]->emit_javascript() . ')' . ' && f_bool(' . $self->{arguments}->[1]->emit_javascript() . ') )') } else { }; if (($code eq 'infix:<||>')) { return('( f_bool(' . $self->{arguments}->[0]->emit_javascript() . ')' . ' || f_bool(' . $self->{arguments}->[1]->emit_javascript() . ') )') } else { }; if (($code eq 'infix:<eq>')) { return('(' . Main::join([ map { $_->emit_javascript() } @{ $self->{arguments} } ], ' == ') . ')') } else { }; if (($code eq 'infix:<ne>')) { return('(' . Main::join([ map { $_->emit_javascript() } @{ $self->{arguments} } ], ' != ') . ')') } else { }; if (($code eq 'infix:<==>')) { return('(' . Main::join([ map { $_->emit_javascript() } @{ $self->{arguments} } ], ' == ') . ')') } else { }; if (($code eq 'infix:<!=>')) { return('(' . Main::join([ map { $_->emit_javascript() } @{ $self->{arguments} } ], ' != ') . ')') } else { }; if (($code eq 'exists')) { (my $arg = $self->{arguments}->[0]);if (Main::isa($arg, 'Lookup')) { return('(' . $arg->obj()->emit_javascript() . ').hasOwnProperty(' . $arg->index_exp()->emit_javascript() . ')') } else { } } else { }; if (($code eq 'ternary:<?? !!>')) { return('( f_bool(' . $self->{arguments}->[0]->emit_javascript() . ')' . ' ? ' . $self->{arguments}->[1]->emit_javascript() . ' : ' . $self->{arguments}->[2]->emit_javascript() . ')') } else { }; ($code = 'f_' . $self->{code}); if ($self->{namespace}) { ($code = Main::to_javascript_namespace($self->{namespace}) . '.' . $code) } else { if ((($code ne 'f_index') && (($code ne 'f_die') && (($code ne 'f_pop') && (($code ne 'f_shift') && ($code ne 'f_push')))))) { ($code = 'v__NAMESPACE.' . $code) } else { } }; $code . '(' . Main::join([ map { $_->emit_javascript() } @{ $self->{arguments} } ], ', ') . ')' }
+sub emit_javascript { my $self = $_[0]; (my $code = $self->{code}); if (Main::isa($code, 'Str')) { } else { return('(' . $self->{code}->emit_javascript() . ')->(' . Main::join([ map { $_->emit() } @{ $self->{arguments} } ], ', ') . ')') }; if (($code eq 'self')) { return('v_self') } else { }; if (($code eq 'false')) { return('0') } else { }; if (($code eq 'make')) { return('(v_MATCH.v_capture = ' . Main::join([ map { $_->emit_javascript() } @{ $self->{arguments} } ], ', ') . ')') } else { }; if (($code eq 'say')) { return('say(' . Main::join([ map { $_->emit_javascript() } @{ $self->{arguments} } ], ' + ') . ')') } else { }; if (($code eq 'print')) { return('f_print(' . Main::join([ map { $_->emit_javascript() } @{ $self->{arguments} } ], ' + ') . ')') } else { }; if (($code eq 'warn')) { return('f_warn(' . Main::join([ map { $_->emit_javascript() } @{ $self->{arguments} } ], ' + ') . ')') } else { }; if (($code eq 'defined')) { return('(' . Main::join([ map { $_->emit_javascript() } @{ $self->{arguments} } ], ' ') . ' != null)') } else { }; if (($code eq 'substr')) { return('(' . $self->{arguments}->[0]->emit_javascript() . ' || "").substr(' . $self->{arguments}->[1]->emit_javascript() . ', ' . $self->{arguments}->[2]->emit_javascript() . ')') } else { }; if (($code eq 'Int')) { return('parseInt(' . $self->{arguments}->[0]->emit_javascript() . ')') } else { }; if (($code eq 'Num')) { return('parseFloat(' . $self->{arguments}->[0]->emit_javascript() . ')') } else { }; if (($code eq 'prefix:<~>')) { return('(' . Main::join([ map { $_->emit_javascript() } @{ $self->{arguments} } ], ' ') . ').f_string()') } else { }; if (($code eq 'prefix:<!>')) { return('( f_bool(' . Main::join([ map { $_->emit_javascript() } @{ $self->{arguments} } ], ' ') . ') ? false : true)') } else { }; if (($code eq 'prefix:<?>')) { return('( f_bool(' . Main::join([ map { $_->emit_javascript() } @{ $self->{arguments} } ], ' ') . ') ? true : false)') } else { }; if (($code eq 'prefix:<$>')) { return('f_scalar(' . Main::join([ map { $_->emit_javascript() } @{ $self->{arguments} } ], ' ') . ')') } else { }; if (($code eq 'prefix:<@>')) { return('(' . Main::join([ map { $_->emit_javascript() } @{ $self->{arguments} } ], ' ') . ')') } else { }; if (($code eq 'prefix:<%>')) { return('(' . Main::join([ map { $_->emit_javascript() } @{ $self->{arguments} } ], ' ') . ').f_hash()') } else { }; if (($code eq 'infix:<~>')) { return('( f_string(' . $self->{arguments}->[0]->emit_javascript() . ')' . ' + f_string(' . $self->{arguments}->[1]->emit_javascript() . ') )') } else { }; if (($code eq 'infix:<+>')) { return('f_add(' . Main::join([ map { $_->emit_javascript() } @{ $self->{arguments} } ], ', ') . ')') } else { }; if (($code eq 'infix:<->')) { return('(' . Main::join([ map { $_->emit_javascript() } @{ $self->{arguments} } ], ' - ') . ')') } else { }; if (($code eq 'infix:<*>')) { return('(' . Main::join([ map { $_->emit_javascript() } @{ $self->{arguments} } ], ' * ') . ')') } else { }; if (($code eq 'infix:</>')) { return('(' . Main::join([ map { $_->emit_javascript() } @{ $self->{arguments} } ], ' / ') . ')') } else { }; if (($code eq 'infix:<>>')) { return('(' . Main::join([ map { $_->emit_javascript() } @{ $self->{arguments} } ], ' > ') . ')') } else { }; if (($code eq 'infix:<<>')) { return('(' . Main::join([ map { $_->emit_javascript() } @{ $self->{arguments} } ], ' < ') . ')') } else { }; if (($code eq 'infix:<>=>')) { return('(' . Main::join([ map { $_->emit_javascript() } @{ $self->{arguments} } ], ' >= ') . ')') } else { }; if (($code eq 'infix:<<=>')) { return('(' . Main::join([ map { $_->emit_javascript() } @{ $self->{arguments} } ], ' <= ') . ')') } else { }; if (($code eq 'infix:<&&>')) { return('( f_bool(' . $self->{arguments}->[0]->emit_javascript() . ')' . ' && f_bool(' . $self->{arguments}->[1]->emit_javascript() . ') )') } else { }; if (($code eq 'infix:<||>')) { return('( f_bool(' . $self->{arguments}->[0]->emit_javascript() . ')' . ' || f_bool(' . $self->{arguments}->[1]->emit_javascript() . ') )') } else { }; if (($code eq 'infix:<eq>')) { return('(' . Main::join([ map { $_->emit_javascript() } @{ $self->{arguments} } ], ' == ') . ')') } else { }; if (($code eq 'infix:<ne>')) { return('(' . Main::join([ map { $_->emit_javascript() } @{ $self->{arguments} } ], ' != ') . ')') } else { }; if (($code eq 'infix:<==>')) { return('(' . Main::join([ map { $_->emit_javascript() } @{ $self->{arguments} } ], ' == ') . ')') } else { }; if (($code eq 'infix:<!=>')) { return('(' . Main::join([ map { $_->emit_javascript() } @{ $self->{arguments} } ], ' != ') . ')') } else { }; if (($code eq 'exists')) { (my $arg = $self->{arguments}->[0]);if (Main::isa($arg, 'Lookup')) { return('(' . $arg->obj()->emit_javascript() . ').hasOwnProperty(' . $arg->index_exp()->emit_javascript() . ')') } else { } } else { }; if (($code eq 'ternary:<?? !!>')) { return('( f_bool(' . $self->{arguments}->[0]->emit_javascript() . ')' . ' ? ' . $self->{arguments}->[1]->emit_javascript() . ' : ' . $self->{arguments}->[2]->emit_javascript() . ')') } else { }; ($code = 'f_' . $self->{code}); if ($self->{namespace}) { ($code = Main::to_javascript_namespace($self->{namespace}) . '.' . $code) } else { if ((($code ne 'f_index') && (($code ne 'f_die') && (($code ne 'f_pop') && (($code ne 'f_shift') && ($code ne 'f_push')))))) { ($code = 'v__NAMESPACE.' . $code) } else { } }; $code . '(' . Main::join([ map { $_->emit_javascript() } @{ $self->{arguments} } ], ', ') . ')' }
}
{
View
2  lib5/MiniPerl6/Perl5/Emitter.pm
@@ -156,7 +156,7 @@ sub new { shift; bless { @_ }, "Apply" }
sub code { $_[0]->{code} };
sub arguments { $_[0]->{arguments} };
sub namespace { $_[0]->{namespace} };
-sub emit { my $self = $_[0]; (my $ns = ''); if ($self->{namespace}) { ($ns = $self->{namespace} . '::') } else { }; (my $code = $ns . $self->{code}); if (Main::isa($code, 'Str')) { } else { return('(' . $self->{code}->emit() . ')->(' . Main::join([ map { $_->emit() } @{ $self->{arguments} } ], ', ') . ')') }; if (($code eq 'self')) { return('$self') } else { }; if (($code eq 'false')) { return('0') } else { }; if (($code eq 'make')) { return('($MATCH->{capture} = (' . Main::join([ map { $_->emit() } @{ $self->{arguments} } ], ', ') . '))') } else { }; if (($code eq 'say')) { return('Main::say(' . Main::join([ map { $_->emit() } @{ $self->{arguments} } ], ', ') . ')') } else { }; if (($code eq 'print')) { return('Main::print(' . Main::join([ map { $_->emit() } @{ $self->{arguments} } ], ', ') . ')') } else { }; if (($code eq 'warn')) { return('warn(' . Main::join([ map { $_->emit() } @{ $self->{arguments} } ], ', ') . ')') } else { }; if (($code eq 'array')) { return('@{' . Main::join([ map { $_->emit() } @{ $self->{arguments} } ], ' ') . '}') } else { }; if (($code eq 'pop')) { return('pop( @{' . Main::join([ map { $_->emit() } @{ $self->{arguments} } ], ' ') . '} )') } else { }; if (($code eq 'push')) { return('push( @{' . $self->{arguments}->[0]->emit() . '}, ' . $self->{arguments}->[1]->emit() . ' )') } else { }; if (($code eq 'shift')) { return('shift( @{' . Main::join([ map { $_->emit() } @{ $self->{arguments} } ], ' ') . '} )') } else { }; if (($code eq 'Int')) { return('(0+' . $self->{arguments}->[0]->emit() . ')') } else { }; if (($code eq 'Num')) { return('(0+' . $self->{arguments}->[0]->emit() . ')') } else { }; if (($code eq 'prefix:<~>')) { return('("" . ' . Main::join([ map { $_->emit() } @{ $self->{arguments} } ], ' ') . ')') } else { }; if (($code eq 'prefix:<!>')) { return('(' . Main::join([ map { $_->emit() } @{ $self->{arguments} } ], ' ') . ' ? 0 : 1)') } else { }; if (($code eq 'prefix:<?>')) { return('(' . Main::join([ map { $_->emit() } @{ $self->{arguments} } ], ' ') . ' ? 1 : 0)') } else { }; if (($code eq 'prefix:<$>')) { return('${' . Main::join([ map { $_->emit() } @{ $self->{arguments} } ], ' ') . '}') } else { }; if (($code eq 'prefix:<@>')) { return('@{' . Main::join([ map { $_->emit() } @{ $self->{arguments} } ], ' ') . '}') } else { }; if (($code eq 'prefix:<%>')) { return('%{' . Main::join([ map { $_->emit() } @{ $self->{arguments} } ], ' ') . '}') } else { }; if (($code eq 'infix:<~>')) { return('' . Main::join([ map { $_->emit() } @{ $self->{arguments} } ], ' . ') . '') } else { }; if (($code eq 'infix:<+>')) { return('(' . Main::join([ map { $_->emit() } @{ $self->{arguments} } ], ' + ') . ')') } else { }; if (($code eq 'infix:<->')) { return('(' . Main::join([ map { $_->emit() } @{ $self->{arguments} } ], ' - ') . ')') } else { }; if (($code eq 'infix:<>>')) { return('(' . Main::join([ map { $_->emit() } @{ $self->{arguments} } ], ' > ') . ')') } else { }; if (($code eq 'infix:<<>')) { return('(' . Main::join([ map { $_->emit() } @{ $self->{arguments} } ], ' < ') . ')') } else { }; if (($code eq 'infix:<x>')) { return('(' . Main::join([ map { $_->emit() } @{ $self->{arguments} } ], ' x ') . ')') } else { }; if (($code eq 'infix:<>=>')) { return('(' . Main::join([ map { $_->emit() } @{ $self->{arguments} } ], ' >= ') . ')') } else { }; if (($code eq 'infix:<<=>')) { return('(' . Main::join([ map { $_->emit() } @{ $self->{arguments} } ], ' <= ') . ')') } else { }; if (($code eq 'infix:<&&>')) { return('(' . Main::join([ map { $_->emit() } @{ $self->{arguments} } ], ' && ') . ')') } else { }; if (($code eq 'infix:<||>')) { return('(' . Main::join([ map { $_->emit() } @{ $self->{arguments} } ], ' || ') . ')') } else { }; if (($code eq 'infix:<eq>')) { return('(' . Main::join([ map { $_->emit() } @{ $self->{arguments} } ], ' eq ') . ')') } else { }; if (($code eq 'infix:<ne>')) { return('(' . Main::join([ map { $_->emit() } @{ $self->{arguments} } ], ' ne ') . ')') } else { }; if (($code eq 'infix:<==>')) { return('(' . Main::join([ map { $_->emit() } @{ $self->{arguments} } ], ' == ') . ')') } else { }; if (($code eq 'infix:<!=>')) { return('(' . Main::join([ map { $_->emit() } @{ $self->{arguments} } ], ' != ') . ')') } else { }; if (($code eq 'ternary:<?? !!>')) { return('(' . $self->{arguments}->[0]->emit() . ' ? ' . $self->{arguments}->[1]->emit() . ' : ' . $self->{arguments}->[2]->emit() . ')') } else { }; $code . '(' . Main::join([ map { $_->emit() } @{ $self->{arguments} } ], ', ') . ')' }
+sub emit { my $self = $_[0]; (my $ns = ''); if ($self->{namespace}) { ($ns = $self->{namespace} . '::') } else { }; (my $code = $ns . $self->{code}); if (Main::isa($code, 'Str')) { } else { return('(' . $self->{code}->emit() . ')->(' . Main::join([ map { $_->emit() } @{ $self->{arguments} } ], ', ') . ')') }; if (($code eq 'self')) { return('$self') } else { }; if (($code eq 'false')) { return('0') } else { }; if (($code eq 'make')) { return('($MATCH->{capture} = (' . Main::join([ map { $_->emit() } @{ $self->{arguments} } ], ', ') . '))') } else { }; if (($code eq 'say')) { return('Main::say(' . Main::join([ map { $_->emit() } @{ $self->{arguments} } ], ', ') . ')') } else { }; if (($code eq 'print')) { return('Main::print(' . Main::join([ map { $_->emit() } @{ $self->{arguments} } ], ', ') . ')') } else { }; if (($code eq 'warn')) { return('warn(' . Main::join([ map { $_->emit() } @{ $self->{arguments} } ], ', ') . ')') } else { }; if (($code eq 'array')) { return('@{' . Main::join([ map { $_->emit() } @{ $self->{arguments} } ], ' ') . '}') } else { }; if (($code eq 'pop')) { return('pop( @{' . Main::join([ map { $_->emit() } @{ $self->{arguments} } ], ' ') . '} )') } else { }; if (($code eq 'push')) { return('push( @{' . $self->{arguments}->[0]->emit() . '}, ' . $self->{arguments}->[1]->emit() . ' )') } else { }; if (($code eq 'shift')) { return('shift( @{' . Main::join([ map { $_->emit() } @{ $self->{arguments} } ], ' ') . '} )') } else { }; if (($code eq 'Int')) { return('(0+' . $self->{arguments}->[0]->emit() . ')') } else { }; if (($code eq 'Num')) { return('(0+' . $self->{arguments}->[0]->emit() . ')') } else { }; if (($code eq 'prefix:<~>')) { return('("" . ' . Main::join([ map { $_->emit() } @{ $self->{arguments} } ], ' ') . ')') } else { }; if (($code eq 'prefix:<!>')) { return('(' . Main::join([ map { $_->emit() } @{ $self->{arguments} } ], ' ') . ' ? 0 : 1)') } else { }; if (($code eq 'prefix:<?>')) { return('(' . Main::join([ map { $_->emit() } @{ $self->{arguments} } ], ' ') . ' ? 1 : 0)') } else { }; if (($code eq 'prefix:<$>')) { return('${' . Main::join([ map { $_->emit() } @{ $self->{arguments} } ], ' ') . '}') } else { }; if (($code eq 'prefix:<@>')) { return('@{' . Main::join([ map { $_->emit() } @{ $self->{arguments} } ], ' ') . '}') } else { }; if (($code eq 'prefix:<%>')) { return('%{' . Main::join([ map { $_->emit() } @{ $self->{arguments} } ], ' ') . '}') } else { }; if (($code eq 'infix:<~>')) { return('' . Main::join([ map { $_->emit() } @{ $self->{arguments} } ], ' . ') . '') } else { }; if (($code eq 'infix:<+>')) { return('(' . Main::join([ map { $_->emit() } @{ $self->{arguments} } ], ' + ') . ')') } else { }; if (($code eq 'infix:<->')) { return('(' . Main::join([ map { $_->emit() } @{ $self->{arguments} } ], ' - ') . ')') } else { }; if (($code eq 'infix:<*>')) { return('(' . Main::join([ map { $_->emit() } @{ $self->{arguments} } ], ' * ') . ')') } else { }; if (($code eq 'infix:</>')) { return('(' . Main::join([ map { $_->emit() } @{ $self->{arguments} } ], ' / ') . ')') } else { }; if (($code eq 'infix:<>>')) { return('(' . Main::join([ map { $_->emit() } @{ $self->{arguments} } ], ' > ') . ')') } else { }; if (($code eq 'infix:<<>')) { return('(' . Main::join([ map { $_->emit() } @{ $self->{arguments} } ], ' < ') . ')') } else { }; if (($code eq 'infix:<>=>')) { return('(' . Main::join([ map { $_->emit() } @{ $self->{arguments} } ], ' >= ') . ')') } else { }; if (($code eq 'infix:<<=>')) { return('(' . Main::join([ map { $_->emit() } @{ $self->{arguments} } ], ' <= ') . ')') } else { }; if (($code eq 'infix:<x>')) { return('(' . Main::join([ map { $_->emit() } @{ $self->{arguments} } ], ' x ') . ')') } else { }; if (($code eq 'infix:<&&>')) { return('(' . Main::join([ map { $_->emit() } @{ $self->{arguments} } ], ' && ') . ')') } else { }; if (($code eq 'infix:<||>')) { return('(' . Main::join([ map { $_->emit() } @{ $self->{arguments} } ], ' || ') . ')') } else { }; if (($code eq 'infix:<eq>')) { return('(' . Main::join([ map { $_->emit() } @{ $self->{arguments} } ], ' eq ') . ')') } else { }; if (($code eq 'infix:<ne>')) { return('(' . Main::join([ map { $_->emit() } @{ $self->{arguments} } ], ' ne ') . ')') } else { }; if (($code eq 'infix:<==>')) { return('(' . Main::join([ map { $_->emit() } @{ $self->{arguments} } ], ' == ') . ')') } else { }; if (($code eq 'infix:<!=>')) { return('(' . Main::join([ map { $_->emit() } @{ $self->{arguments} } ], ' != ') . ')') } else { }; if (($code eq 'ternary:<?? !!>')) { return('(' . $self->{arguments}->[0]->emit() . ' ? ' . $self->{arguments}->[1]->emit() . ' : ' . $self->{arguments}->[2]->emit() . ')') } else { }; $code . '(' . Main::join([ map { $_->emit() } @{ $self->{arguments} } ], ', ') . ')' }
}
{
View
2  libjs/MiniPerl6/Javascript/Emitter.js
@@ -445,7 +445,7 @@ if (typeof Apply != 'object') {
// method emit_javascript
Apply.f_emit_javascript = function () {
var v_self = this;
- try { var v_code;(v_code = v_self.v_code);if ( f_bool(f_isa(v_code, "Str")) ) { (function () { null })() } else { (function () { throw(( f_string("(") + f_string(( f_string(v_self.v_code.f_emit_javascript()) + f_string(( f_string(")->(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit() ) } return out; })(v_self.v_arguments).join(", ")) + f_string(")") )) )) )) )); })() };if ( f_bool((v_code == "self")) ) { (function () { throw("v_self"); })() } else { (function () { null })() };if ( f_bool((v_code == "false")) ) { (function () { throw("0"); })() } else { (function () { null })() };if ( f_bool((v_code == "make")) ) { (function () { throw(( f_string("(v_MATCH.v_capture = ") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(", ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "say")) ) { (function () { throw(( f_string("say(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" + ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "print")) ) { (function () { throw(( f_string("f_print(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" + ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "warn")) ) { (function () { throw(( f_string("f_warn(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" + ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "defined")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" ")) + f_string(" != null)") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "substr")) ) { (function () { throw(( f_string("(") + f_string(( f_string(v_self.v_arguments[0].f_emit_javascript()) + f_string(( f_string(" || \"\").substr(") + f_string(( f_string(v_self.v_arguments[1].f_emit_javascript()) + f_string(( f_string(", ") + f_string(( f_string(v_self.v_arguments[2].f_emit_javascript()) + f_string(")") )) )) )) )) )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "Int")) ) { (function () { throw(( f_string("parseInt(") + f_string(( f_string(v_self.v_arguments[0].f_emit_javascript()) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "Num")) ) { (function () { throw(( f_string("parseFloat(") + f_string(( f_string(v_self.v_arguments[0].f_emit_javascript()) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "prefix:<~>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" ")) + f_string(").f_string()") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "prefix:<!>")) ) { (function () { throw(( f_string("( f_bool(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" ")) + f_string(") ? false : true)") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "prefix:<?>")) ) { (function () { throw(( f_string("( f_bool(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" ")) + f_string(") ? true : false)") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "prefix:<$>")) ) { (function () { throw(( f_string("f_scalar(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "prefix:<@>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "prefix:<%>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" ")) + f_string(").f_hash()") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<~>")) ) { (function () { throw(( f_string("( f_string(") + f_string(( f_string(v_self.v_arguments[0].f_emit_javascript()) + f_string(( f_string(")") + f_string(( f_string(" + f_string(") + f_string(( f_string(v_self.v_arguments[1].f_emit_javascript()) + f_string(") )") )) )) )) )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<+>")) ) { (function () { throw(( f_string("f_add(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(", ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<->")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" - ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<>>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" > ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<<>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" < ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<>=>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" >= ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<<=>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" <= ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<&&>")) ) { (function () { throw(( f_string("( f_bool(") + f_string(( f_string(v_self.v_arguments[0].f_emit_javascript()) + f_string(( f_string(")") + f_string(( f_string(" && f_bool(") + f_string(( f_string(v_self.v_arguments[1].f_emit_javascript()) + f_string(") )") )) )) )) )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<||>")) ) { (function () { throw(( f_string("( f_bool(") + f_string(( f_string(v_self.v_arguments[0].f_emit_javascript()) + f_string(( f_string(")") + f_string(( f_string(" || f_bool(") + f_string(( f_string(v_self.v_arguments[1].f_emit_javascript()) + f_string(") )") )) )) )) )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<eq>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" == ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<ne>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" != ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<==>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" == ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<!=>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" != ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "exists")) ) { (function () { var v_arg;(v_arg = v_self.v_arguments[0]);if ( f_bool(f_isa(v_arg, "Lookup")) ) { (function () { throw(( f_string("(") + f_string(( f_string(v_arg.f_obj().f_emit_javascript()) + f_string(( f_string(").hasOwnProperty(") + f_string(( f_string(v_arg.f_index_exp().f_emit_javascript()) + f_string(")") )) )) )) )); })() } else { (function () { null })() }; })() } else { (function () { null })() };if ( f_bool((v_code == "ternary:<?? !!>")) ) { (function () { throw(( f_string("( f_bool(") + f_string(( f_string(v_self.v_arguments[0].f_emit_javascript()) + f_string(( f_string(")") + f_string(( f_string(" ? ") + f_string(( f_string(v_self.v_arguments[1].f_emit_javascript()) + f_string(( f_string(" : ") + f_string(( f_string(v_self.v_arguments[2].f_emit_javascript()) + f_string(")") )) )) )) )) )) )) )); })() } else { (function () { null })() };(v_code = ( f_string("f_") + f_string(v_self.v_code) ));if ( f_bool(v_self.v_namespace) ) { (function () { (v_code = ( f_string(Main.f_to_javascript_namespace(v_self.v_namespace)) + f_string(( f_string(".") + f_string(v_code) )) )); })() } else { (function () { if ( f_bool(( f_bool((v_code != "f_index")) && f_bool(( f_bool((v_code != "f_die")) && f_bool(( f_bool((v_code != "f_pop")) && f_bool(( f_bool((v_code != "f_shift")) && f_bool((v_code != "f_push")) )) )) )) )) ) { (function () { (v_code = ( f_string("v__NAMESPACE.") + f_string(v_code) )); })() } else { (function () { null })() }; })() };return(( f_string(v_code) + f_string(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(", ")) + f_string(")") )) )) )) } catch(err) { if ( err instanceof Error ) { throw(err) } else { return(err) } }
+ try { var v_code;(v_code = v_self.v_code);if ( f_bool(f_isa(v_code, "Str")) ) { (function () { null })() } else { (function () { throw(( f_string("(") + f_string(( f_string(v_self.v_code.f_emit_javascript()) + f_string(( f_string(")->(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit() ) } return out; })(v_self.v_arguments).join(", ")) + f_string(")") )) )) )) )); })() };if ( f_bool((v_code == "self")) ) { (function () { throw("v_self"); })() } else { (function () { null })() };if ( f_bool((v_code == "false")) ) { (function () { throw("0"); })() } else { (function () { null })() };if ( f_bool((v_code == "make")) ) { (function () { throw(( f_string("(v_MATCH.v_capture = ") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(", ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "say")) ) { (function () { throw(( f_string("say(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" + ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "print")) ) { (function () { throw(( f_string("f_print(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" + ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "warn")) ) { (function () { throw(( f_string("f_warn(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" + ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "defined")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" ")) + f_string(" != null)") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "substr")) ) { (function () { throw(( f_string("(") + f_string(( f_string(v_self.v_arguments[0].f_emit_javascript()) + f_string(( f_string(" || \"\").substr(") + f_string(( f_string(v_self.v_arguments[1].f_emit_javascript()) + f_string(( f_string(", ") + f_string(( f_string(v_self.v_arguments[2].f_emit_javascript()) + f_string(")") )) )) )) )) )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "Int")) ) { (function () { throw(( f_string("parseInt(") + f_string(( f_string(v_self.v_arguments[0].f_emit_javascript()) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "Num")) ) { (function () { throw(( f_string("parseFloat(") + f_string(( f_string(v_self.v_arguments[0].f_emit_javascript()) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "prefix:<~>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" ")) + f_string(").f_string()") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "prefix:<!>")) ) { (function () { throw(( f_string("( f_bool(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" ")) + f_string(") ? false : true)") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "prefix:<?>")) ) { (function () { throw(( f_string("( f_bool(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" ")) + f_string(") ? true : false)") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "prefix:<$>")) ) { (function () { throw(( f_string("f_scalar(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "prefix:<@>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "prefix:<%>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" ")) + f_string(").f_hash()") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<~>")) ) { (function () { throw(( f_string("( f_string(") + f_string(( f_string(v_self.v_arguments[0].f_emit_javascript()) + f_string(( f_string(")") + f_string(( f_string(" + f_string(") + f_string(( f_string(v_self.v_arguments[1].f_emit_javascript()) + f_string(") )") )) )) )) )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<+>")) ) { (function () { throw(( f_string("f_add(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(", ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<->")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" - ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<*>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" * ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:</>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" / ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<>>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" > ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<<>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" < ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<>=>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" >= ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<<=>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" <= ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<&&>")) ) { (function () { throw(( f_string("( f_bool(") + f_string(( f_string(v_self.v_arguments[0].f_emit_javascript()) + f_string(( f_string(")") + f_string(( f_string(" && f_bool(") + f_string(( f_string(v_self.v_arguments[1].f_emit_javascript()) + f_string(") )") )) )) )) )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<||>")) ) { (function () { throw(( f_string("( f_bool(") + f_string(( f_string(v_self.v_arguments[0].f_emit_javascript()) + f_string(( f_string(")") + f_string(( f_string(" || f_bool(") + f_string(( f_string(v_self.v_arguments[1].f_emit_javascript()) + f_string(") )") )) )) )) )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<eq>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" == ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<ne>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" != ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<==>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" == ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<!=>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" != ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "exists")) ) { (function () { var v_arg;(v_arg = v_self.v_arguments[0]);if ( f_bool(f_isa(v_arg, "Lookup")) ) { (function () { throw(( f_string("(") + f_string(( f_string(v_arg.f_obj().f_emit_javascript()) + f_string(( f_string(").hasOwnProperty(") + f_string(( f_string(v_arg.f_index_exp().f_emit_javascript()) + f_string(")") )) )) )) )); })() } else { (function () { null })() }; })() } else { (function () { null })() };if ( f_bool((v_code == "ternary:<?? !!>")) ) { (function () { throw(( f_string("( f_bool(") + f_string(( f_string(v_self.v_arguments[0].f_emit_javascript()) + f_string(( f_string(")") + f_string(( f_string(" ? ") + f_string(( f_string(v_self.v_arguments[1].f_emit_javascript()) + f_string(( f_string(" : ") + f_string(( f_string(v_self.v_arguments[2].f_emit_javascript()) + f_string(")") )) )) )) )) )) )) )); })() } else { (function () { null })() };(v_code = ( f_string("f_") + f_string(v_self.v_code) ));if ( f_bool(v_self.v_namespace) ) { (function () { (v_code = ( f_string(Main.f_to_javascript_namespace(v_self.v_namespace)) + f_string(( f_string(".") + f_string(v_code) )) )); })() } else { (function () { if ( f_bool(( f_bool((v_code != "f_index")) && f_bool(( f_bool((v_code != "f_die")) && f_bool(( f_bool((v_code != "f_pop")) && f_bool(( f_bool((v_code != "f_shift")) && f_bool((v_code != "f_push")) )) )) )) )) ) { (function () { (v_code = ( f_string("v__NAMESPACE.") + f_string(v_code) )); })() } else { (function () { null })() }; })() };return(( f_string(v_code) + f_string(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(", ")) + f_string(")") )) )) )) } catch(err) { if ( err instanceof Error ) { throw(err) } else { return(err) } }
}
Apply.f_emit_javascript; // v8 bug workaround
})();
View
2  libjs/MiniPerl6/Perl5/Emitter.js
@@ -423,7 +423,7 @@ if (typeof Apply != 'object') {
// method emit
Apply.f_emit = function () {
var v_self = this;
- try { var v_ns;var v_code;(v_ns = "");if ( f_bool(v_self.v_namespace) ) { (function () { (v_ns = ( f_string(v_self.v_namespace) + f_string("::") )); })() } else { (function () { null })() };(v_code = ( f_string(v_ns) + f_string(v_self.v_code) ));if ( f_bool(f_isa(v_code, "Str")) ) { (function () { null })() } else { (function () { throw(( f_string("(") + f_string(( f_string(v_self.v_code.f_emit()) + f_string(( f_string(")->(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit() ) } return out; })(v_self.v_arguments).join(", ")) + f_string(")") )) )) )) )); })() };if ( f_bool((v_code == "self")) ) { (function () { throw("$self"); })() } else { (function () { null })() };if ( f_bool((v_code == "false")) ) { (function () { throw("0"); })() } else { (function () { null })() };if ( f_bool((v_code == "make")) ) { (function () { throw(( f_string("($MATCH->{capture} = (") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit() ) } return out; })(v_self.v_arguments).join(", ")) + f_string("))") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "say")) ) { (function () { throw(( f_string("Main::say(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit() ) } return out; })(v_self.v_arguments).join(", ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "print")) ) { (function () { throw(( f_string("Main::print(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit() ) } return out; })(v_self.v_arguments).join(", ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "warn")) ) { (function () { throw(( f_string("warn(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit() ) } return out; })(v_self.v_arguments).join(", ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "array")) ) { (function () { throw(( f_string("@{") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit() ) } return out; })(v_self.v_arguments).join(" ")) + f_string("}") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "pop")) ) { (function () { throw(( f_string("pop( @{") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit() ) } return out; })(v_self.v_arguments).join(" ")) + f_string("} )") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "push")) ) { (function () { throw(( f_string("push( @{") + f_string(( f_string(v_self.v_arguments[0].f_emit()) + f_string(( f_string("}, ") + f_string(( f_string(v_self.v_arguments[1].f_emit()) + f_string(" )") )) )) )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "shift")) ) { (function () { throw(( f_string("shift( @{") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit() ) } return out; })(v_self.v_arguments).join(" ")) + f_string("} )") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "Int")) ) { (function () { throw(( f_string("(0+") + f_string(( f_string(v_self.v_arguments[0].f_emit()) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "Num")) ) { (function () { throw(( f_string("(0+") + f_string(( f_string(v_self.v_arguments[0].f_emit()) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "prefix:<~>")) ) { (function () { throw(( f_string("(\"\" . ") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit() ) } return out; })(v_self.v_arguments).join(" ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "prefix:<!>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit() ) } return out; })(v_self.v_arguments).join(" ")) + f_string(" ? 0 : 1)") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "prefix:<?>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit() ) } return out; })(v_self.v_arguments).join(" ")) + f_string(" ? 1 : 0)") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "prefix:<$>")) ) { (function () { throw(( f_string("${") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit() ) } return out; })(v_self.v_arguments).join(" ")) + f_string("}") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "prefix:<@>")) ) { (function () { throw(( f_string("@{") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit() ) } return out; })(v_self.v_arguments).join(" ")) + f_string("}") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "prefix:<%>")) ) { (function () { throw(( f_string("%{") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit() ) } return out; })(v_self.v_arguments).join(" ")) + f_string("}") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<~>")) ) { (function () { throw(( f_string("") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit() ) } return out; })(v_self.v_arguments).join(" . ")) + f_string("") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<+>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit() ) } return out; })(v_self.v_arguments).join(" + ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<->")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit() ) } return out; })(v_self.v_arguments).join(" - ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<>>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit() ) } return out; })(v_self.v_arguments).join(" > ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<<>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit() ) } return out; })(v_self.v_arguments).join(" < ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<x>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit() ) } return out; })(v_self.v_arguments).join(" x ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<>=>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit() ) } return out; })(v_self.v_arguments).join(" >= ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<<=>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit() ) } return out; })(v_self.v_arguments).join(" <= ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<&&>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit() ) } return out; })(v_self.v_arguments).join(" && ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<||>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit() ) } return out; })(v_self.v_arguments).join(" || ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<eq>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit() ) } return out; })(v_self.v_arguments).join(" eq ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<ne>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit() ) } return out; })(v_self.v_arguments).join(" ne ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<==>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit() ) } return out; })(v_self.v_arguments).join(" == ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<!=>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit() ) } return out; })(v_self.v_arguments).join(" != ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "ternary:<?? !!>")) ) { (function () { throw(( f_string("(") + f_string(( f_string(v_self.v_arguments[0].f_emit()) + f_string(( f_string(" ? ") + f_string(( f_string(v_self.v_arguments[1].f_emit()) + f_string(( f_string(" : ") + f_string(( f_string(v_self.v_arguments[2].f_emit()) + f_string(")") )) )) )) )) )) )); })() } else { (function () { null })() };return(( f_string(v_code) + f_string(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit() ) } return out; })(v_self.v_arguments).join(", ")) + f_string(")") )) )) )) } catch(err) { if ( err instanceof Error ) { throw(err) } else { return(err) } }
+ try { var v_ns;var v_code;(v_ns = "");if ( f_bool(v_self.v_namespace) ) { (function () { (v_ns = ( f_string(v_self.v_namespace) + f_string("::") )); })() } else { (function () { null })() };(v_code = ( f_string(v_ns) + f_string(v_self.v_code) ));if ( f_bool(f_isa(v_code, "Str")) ) { (function () { null })() } else { (function () { throw(( f_string("(") + f_string(( f_string(v_self.v_code.f_emit()) + f_string(( f_string(")->(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit() ) } return out; })(v_self.v_arguments).join(", ")) + f_string(")") )) )) )) )); })() };if ( f_bool((v_code == "self")) ) { (function () { throw("$self"); })() } else { (function () { null })() };if ( f_bool((v_code == "false")) ) { (function () { throw("0"); })() } else { (function () { null })() };if ( f_bool((v_code == "make")) ) { (function () { throw(( f_string("($MATCH->{capture} = (") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit() ) } return out; })(v_self.v_arguments).join(", ")) + f_string("))") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "say")) ) { (function () { throw(( f_string("Main::say(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit() ) } return out; })(v_self.v_arguments).join(", ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "print")) ) { (function () { throw(( f_string("Main::print(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit() ) } return out; })(v_self.v_arguments).join(", ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "warn")) ) { (function () { throw(( f_string("warn(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit() ) } return out; })(v_self.v_arguments).join(", ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "array")) ) { (function () { throw(( f_string("@{") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit() ) } return out; })(v_self.v_arguments).join(" ")) + f_string("}") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "pop")) ) { (function () { throw(( f_string("pop( @{") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit() ) } return out; })(v_self.v_arguments).join(" ")) + f_string("} )") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "push")) ) { (function () { throw(( f_string("push( @{") + f_string(( f_string(v_self.v_arguments[0].f_emit()) + f_string(( f_string("}, ") + f_string(( f_string(v_self.v_arguments[1].f_emit()) + f_string(" )") )) )) )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "shift")) ) { (function () { throw(( f_string("shift( @{") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit() ) } return out; })(v_self.v_arguments).join(" ")) + f_string("} )") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "Int")) ) { (function () { throw(( f_string("(0+") + f_string(( f_string(v_self.v_arguments[0].f_emit()) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "Num")) ) { (function () { throw(( f_string("(0+") + f_string(( f_string(v_self.v_arguments[0].f_emit()) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "prefix:<~>")) ) { (function () { throw(( f_string("(\"\" . ") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit() ) } return out; })(v_self.v_arguments).join(" ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "prefix:<!>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit() ) } return out; })(v_self.v_arguments).join(" ")) + f_string(" ? 0 : 1)") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "prefix:<?>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit() ) } return out; })(v_self.v_arguments).join(" ")) + f_string(" ? 1 : 0)") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "prefix:<$>")) ) { (function () { throw(( f_string("${") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit() ) } return out; })(v_self.v_arguments).join(" ")) + f_string("}") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "prefix:<@>")) ) { (function () { throw(( f_string("@{") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit() ) } return out; })(v_self.v_arguments).join(" ")) + f_string("}") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "prefix:<%>")) ) { (function () { throw(( f_string("%{") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit() ) } return out; })(v_self.v_arguments).join(" ")) + f_string("}") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<~>")) ) { (function () { throw(( f_string("") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit() ) } return out; })(v_self.v_arguments).join(" . ")) + f_string("") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<+>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit() ) } return out; })(v_self.v_arguments).join(" + ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<->")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit() ) } return out; })(v_self.v_arguments).join(" - ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<*>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit() ) } return out; })(v_self.v_arguments).join(" * ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:</>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit() ) } return out; })(v_self.v_arguments).join(" / ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<>>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit() ) } return out; })(v_self.v_arguments).join(" > ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<<>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit() ) } return out; })(v_self.v_arguments).join(" < ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<>=>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit() ) } return out; })(v_self.v_arguments).join(" >= ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<<=>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit() ) } return out; })(v_self.v_arguments).join(" <= ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<x>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit() ) } return out; })(v_self.v_arguments).join(" x ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<&&>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit() ) } return out; })(v_self.v_arguments).join(" && ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<||>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit() ) } return out; })(v_self.v_arguments).join(" || ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<eq>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit() ) } return out; })(v_self.v_arguments).join(" eq ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<ne>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit() ) } return out; })(v_self.v_arguments).join(" ne ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<==>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit() ) } return out; })(v_self.v_arguments).join(" == ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<!=>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit() ) } return out; })(v_self.v_arguments).join(" != ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "ternary:<?? !!>")) ) { (function () { throw(( f_string("(") + f_string(( f_string(v_self.v_arguments[0].f_emit()) + f_string(( f_string(" ? ") + f_string(( f_string(v_self.v_arguments[1].f_emit()) + f_string(( f_string(" : ") + f_string(( f_string(v_self.v_arguments[2].f_emit()) + f_string(")") )) )) )) )) )) )); })() } else { (function () { null })() };return(( f_string(v_code) + f_string(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit() ) } return out; })(v_self.v_arguments).join(", ")) + f_string(")") )) )) )) } catch(err) { if ( err instanceof Error ) { throw(err) } else { return(err) } }
}
Apply.f_emit; // v8 bug workaround
})();
View
2  liblisp/MiniPerl6/Go/Emitter.lisp
@@ -1117,7 +1117,7 @@ new-slots))
(:documentation "a method")))
(defmethod sv-emit_go ((sv-self mp-Apply))
(block mp6-function
- (let ((sv-code (sv-undef))) (setf sv-code (sv-code sv-self))(if (sv-bool (typep sv-code 'string)) nil (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-emit_go (sv-code sv-self) )) (sv-string (concatenate 'string (sv-string ")->(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit c)) (sv-arguments sv-self)) ", ")) (sv-string ")")))))))))))(if (sv-bool (sv-eq sv-code "self")) (progn (return-from mp6-function "v_self")) nil)(if (sv-bool (sv-eq sv-code "false")) (progn (return-from mp6-function "b_false()")) nil)(if (sv-bool (sv-eq sv-code "make")) (progn (return-from mp6-function (concatenate 'string (sv-string "func () *Any { ") (sv-string (concatenate 'string (sv-string "tmp := ") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_go c)) (sv-arguments sv-self)) ", ")) (sv-string (concatenate 'string (sv-string "; ") (sv-string (concatenate 'string (sv-string "*(*v_MATCH).(capture_er).f_capture(Capture{}) = *tmp; ") (sv-string (concatenate 'string (sv-string "return tmp; ") (sv-string "}()")))))))))))))) nil)(if (sv-bool (sv-eq sv-code "say")) (progn (return-from mp6-function (concatenate 'string (sv-string "f_print( Capture{ p : []*Any{ ") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_go c)) (sv-arguments sv-self)) ", ")) (sv-string ", toStr(\"\\n\") } } )")))))) nil)(if (sv-bool (sv-eq sv-code "print")) (progn (return-from mp6-function (concatenate 'string (sv-string "f_print( Capture{ p : []*Any{ ") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_go c)) (sv-arguments sv-self)) ", ")) (sv-string " } } )")))))) nil)(if (sv-bool (sv-eq sv-code "warn")) (progn (return-from mp6-function (concatenate 'string (sv-string "f_print_stderr( Capture{ p : []*Any{ ") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_go c)) (sv-arguments sv-self)) ", ")) (sv-string ", toStr(\"\\n\") } } )")))))) nil)(if (sv-bool (sv-eq sv-code "die")) (progn (return-from mp6-function (concatenate 'string (sv-string "f_die( Capture{ p : []*Any{ ") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_go c)) (sv-arguments sv-self)) ", ")) (sv-string " } } )")))))) nil)(if (sv-bool (sv-eq sv-code "defined")) (progn (return-from mp6-function (concatenate 'string (sv-string "f_defined( Capture{ p : []*Any{ ") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_go c)) (sv-arguments sv-self)) ", ")) (sv-string " } } )")))))) nil)(if (sv-bool (sv-eq sv-code "pop")) (progn (return-from mp6-function (concatenate 'string (sv-string "f_pop( Capture{ p : []*Any{ ") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_go c)) (sv-arguments sv-self)) ", ")) (sv-string " } } )")))))) nil)(if (sv-bool (sv-eq sv-code "push")) (progn (return-from mp6-function (concatenate 'string (sv-string "f_push( Capture{ p : []*Any{ ") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_go c)) (sv-arguments sv-self)) ", ")) (sv-string " } } )")))))) nil)(if (sv-bool (sv-eq sv-code "shift")) (progn (return-from mp6-function (concatenate 'string (sv-string "f_shift( Capture{ p : []*Any{ ") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_go c)) (sv-arguments sv-self)) ", ")) (sv-string " } } )")))))) nil)(if (sv-bool (sv-eq sv-code "index")) (progn (return-from mp6-function (concatenate 'string (sv-string "f_index( Capture{ p : []*Any{ ") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_go c)) (sv-arguments sv-self)) ", ")) (sv-string " } } )")))))) nil)(if (sv-bool (sv-eq sv-code "substr")) (progn (return-from mp6-function (concatenate 'string (sv-string "f_substr( Capture{ p : []*Any{ ") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_go c)) (sv-arguments sv-self)) ", ")) (sv-string " } } )")))))) nil)(if (sv-bool (sv-eq sv-code "scalar")) (progn (return-from mp6-function (concatenate 'string (sv-string "f_scalar( Capture{ p : []*Any{ ") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_go c)) (sv-arguments sv-self)) ", ")) (sv-string " } } )")))))) nil)(if (sv-bool (sv-eq sv-code "Int")) (progn (return-from mp6-function (concatenate 'string (sv-string "toInt(") (sv-string (concatenate 'string (sv-string "toint(") (sv-string (concatenate 'string (sv-string (sv-emit_go (mp-Main::sv-array-index (sv-arguments sv-self) 0) )) (sv-string (concatenate 'string (sv-string ")") (sv-string ")")))))))))) nil)(if (sv-bool (sv-eq sv-code "Num")) (progn (return-from mp6-function (concatenate 'string (sv-string "toNum(") (sv-string (concatenate 'string (sv-string "tonum(") (sv-string (concatenate 'string (sv-string (sv-emit_go (mp-Main::sv-array-index (sv-arguments sv-self) 0) )) (sv-string (concatenate 'string (sv-string ")") (sv-string ")")))))))))) nil)(if (sv-bool (sv-eq sv-code "exists")) (let ((sv-arg (sv-undef))) (setf sv-arg (mp-Main::sv-array-index (sv-arguments sv-self) 0))(if (sv-bool (typep sv-arg 'mp-Lookup)) (progn (return-from mp6-function (concatenate 'string (sv-string "(*") (sv-string (concatenate 'string (sv-string (sv-emit_go (sv-obj sv-arg ) )) (sv-string (concatenate 'string (sv-string ")") (sv-string (concatenate 'string (sv-string ".(exists_er).f_exists(Capture{ p : []*Any{ ") (sv-string (concatenate 'string (sv-string (sv-emit_go (sv-index_exp sv-arg ) )) (sv-string " } } )")))))))))))) nil)) nil)(if (sv-bool (sv-eq sv-code "prefix:<~>")) (progn (return-from mp6-function (mp-Call::sv-emit_go_call (mp-Main::sv-array-index (sv-arguments sv-self) 0) "Str"))) nil)(if (sv-bool (sv-eq sv-code "prefix:<!>")) (progn (return-from mp6-function (concatenate 'string (sv-string "toBool(!tobool(") (sv-string (concatenate 'string (sv-string (sv-emit_go (mp-Main::sv-array-index (sv-arguments sv-self) 0) )) (sv-string "))")))))) nil)(if (sv-bool (sv-eq sv-code "prefix:<?>")) (progn (return-from mp6-function (mp-Call::sv-emit_go_call (mp-Main::sv-array-index (sv-arguments sv-self) 0) "Bool"))) nil)(if (sv-bool (sv-eq sv-code "prefix:<$>")) (progn (return-from mp6-function (concatenate 'string (sv-string "f_scalar( Capture{ p : []*Any{ ") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_go c)) (sv-arguments sv-self)) ", ")) (sv-string " } } )")))))) nil)(if (sv-bool (sv-eq sv-code "prefix:<@>")) (progn (return-from mp6-function (mp-Call::sv-emit_go_call (mp-Main::sv-array-index (sv-arguments sv-self) 0) "array"))) nil)(if (sv-bool (sv-eq sv-code "prefix:<%>")) (progn (return-from mp6-function (mp-Call::sv-emit_go_call (mp-Main::sv-array-index (sv-arguments sv-self) 0) "hash"))) nil)(if (sv-bool (sv-eq sv-code "infix:<~>")) (progn (return-from mp6-function (concatenate 'string (sv-string "toStr( ") (sv-string (concatenate 'string (sv-string "tostr(") (sv-string (concatenate 'string (sv-string (sv-emit_go (mp-Main::sv-array-index (sv-arguments sv-self) 0) )) (sv-string (concatenate 'string (sv-string ") + ") (sv-string (concatenate 'string (sv-string "tostr(") (sv-string (concatenate 'string (sv-string (sv-emit_go (mp-Main::sv-array-index (sv-arguments sv-self) 1) )) (sv-string (concatenate 'string (sv-string ") ") (sv-string ")")))))))))))))))) nil)(if (sv-bool (sv-eq sv-code "infix:<+>")) (progn (return-from mp6-function (concatenate 'string (sv-string "f_add( ") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_go c)) (sv-arguments sv-self)) ", ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "infix:<->")) (progn (return-from mp6-function (concatenate 'string (sv-string "f_sub( ") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_go c)) (sv-arguments sv-self)) ", ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "infix:<>>")) (progn (return-from mp6-function (concatenate 'string (sv-string "f_greater( ") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_go c)) (sv-arguments sv-self)) ", ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "infix:<<>")) (progn (return-from mp6-function (concatenate 'string (sv-string "f_smaller( ") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_go c)) (sv-arguments sv-self)) ", ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "infix:<>=>")) (progn (return-from mp6-function (concatenate 'string (sv-string "toBool( ") (sv-string (concatenate 'string (sv-string "toint(") (sv-string (concatenate 'string (sv-string (sv-emit_go (mp-Main::sv-array-index (sv-arguments sv-self) 0) )) (sv-string (concatenate 'string (sv-string ") >= ") (sv-string (concatenate 'string (sv-string "toint(") (sv-string (concatenate 'string (sv-string (sv-emit_go (mp-Main::sv-array-index (sv-arguments sv-self) 1) )) (sv-string (concatenate 'string (sv-string ") ") (sv-string ")")))))))))))))))) nil)(if (sv-bool (sv-eq sv-code "infix:<<=>")) (progn (return-from mp6-function (concatenate 'string (sv-string "toBool( ") (sv-string (concatenate 'string (sv-string "toint(") (sv-string (concatenate 'string (sv-string (sv-emit_go (mp-Main::sv-array-index (sv-arguments sv-self) 0) )) (sv-string (concatenate 'string (sv-string ") <= ") (sv-string (concatenate 'string (sv-string "toint(") (sv-string (concatenate 'string (sv-string (sv-emit_go (mp-Main::sv-array-index (sv-arguments sv-self) 1) )) (sv-string (concatenate 'string (sv-string ") ") (sv-string ")")))))))))))))))) nil)(if (sv-bool (sv-eq sv-code "infix:<&&>")) (progn (return-from mp6-function (concatenate 'string (sv-string "f_and( ") (sv-string (concatenate 'string (sv-string "func () *Any { return ") (sv-string (concatenate 'string (sv-string (sv-emit_go (mp-Main::sv-array-index (sv-arguments sv-self) 0) )) (sv-string (concatenate 'string (sv-string " }, ") (sv-string (concatenate 'string (sv-string "func () *Any { return ") (sv-string (concatenate 'string (sv-string (sv-emit_go (mp-Main::sv-array-index (sv-arguments sv-self) 1) )) (sv-string (concatenate 'string (sv-string " } ") (sv-string ")")))))))))))))))) nil)(if (sv-bool (sv-eq sv-code "infix:<||>")) (progn (return-from mp6-function (concatenate 'string (sv-string "f_or( ") (sv-string (concatenate 'string (sv-string "func () *Any { return ") (sv-string (concatenate 'string (sv-string (sv-emit_go (mp-Main::sv-array-index (sv-arguments sv-self) 0) )) (sv-string (concatenate 'string (sv-string " }, ") (sv-string (concatenate 'string (sv-string "func () *Any { return ") (sv-string (concatenate 'string (sv-string (sv-emit_go (mp-Main::sv-array-index (sv-arguments sv-self) 1) )) (sv-string (concatenate 'string (sv-string " } ") (sv-string ")")))))))))))))))) nil)(if (sv-bool (sv-eq sv-code "infix:<eq>")) (progn (return-from mp6-function (concatenate 'string (sv-string "toBool(") (sv-string (concatenate 'string (sv-string "tostr(") (sv-string (concatenate 'string (sv-string (sv-emit_go (mp-Main::sv-array-index (sv-arguments sv-self) 0) )) (sv-string (concatenate 'string (sv-string ") == ") (sv-string (concatenate 'string (sv-string "tostr(") (sv-string (concatenate 'string (sv-string (sv-emit_go (mp-Main::sv-array-index (sv-arguments sv-self) 1) )) (sv-string (concatenate 'string (sv-string ")") (sv-string ")")))))))))))))))) nil)(if (sv-bool (sv-eq sv-code "infix:<ne>")) (progn (return-from mp6-function (concatenate 'string (sv-string "toBool(") (sv-string (concatenate 'string (sv-string "tostr(") (sv-string (concatenate 'string (sv-string (sv-emit_go (mp-Main::sv-array-index (sv-arguments sv-self) 0) )) (sv-string (concatenate 'string (sv-string ") != ") (sv-string (concatenate 'string (sv-string "tostr(") (sv-string (concatenate 'string (sv-string (sv-emit_go (mp-Main::sv-array-index (sv-arguments sv-self) 1) )) (sv-string (concatenate 'string (sv-string ")") (sv-string ")")))))))))))))))) nil)(if (sv-bool (sv-eq sv-code "infix:<==>")) (progn (return-from mp6-function (concatenate 'string (sv-string "toBool(") (sv-string (concatenate 'string (sv-string "toint(") (sv-string (concatenate 'string (sv-string (sv-emit_go (mp-Main::sv-array-index (sv-arguments sv-self) 0) )) (sv-string (concatenate 'string (sv-string ") == ") (sv-string (concatenate 'string (sv-string "toint(") (sv-string (concatenate 'string (sv-string (sv-emit_go (mp-Main::sv-array-index (sv-arguments sv-self) 1) )) (sv-string (concatenate 'string (sv-string ") ") (sv-string ")")))))))))))))))) nil)(if (sv-bool (sv-eq sv-code "infix:<!=>")) (progn (return-from mp6-function (concatenate 'string (sv-string "toBool(") (sv-string (concatenate 'string (sv-string "toint(") (sv-string (concatenate 'string (sv-string (sv-emit_go (mp-Main::sv-array-index (sv-arguments sv-self) 0) )) (sv-string (concatenate 'string (sv-string ") != ") (sv-string (concatenate 'string (sv-string "toint(") (sv-string (concatenate 'string (sv-string (sv-emit_go (mp-Main::sv-array-index (sv-arguments sv-self) 1) )) (sv-string (concatenate 'string (sv-string ") ") (sv-string ")")))))))))))))))) nil)(if (sv-bool (sv-eq sv-code "ternary:<?? !!>")) (progn (return-from mp6-function (concatenate 'string (sv-string "func () *Any { ") (sv-string (concatenate 'string (sv-string "if tobool( ") (sv-string (concatenate 'string (sv-string (mp-Call::sv-emit_go_call (mp-Main::sv-array-index (sv-arguments sv-self) 0) "Bool")) (sv-string (concatenate 'string (sv-string " ) ") (sv-string (concatenate 'string (sv-string "{ return ") (sv-string (concatenate 'string (sv-string (sv-emit_go (mp-Main::sv-array-index (sv-arguments sv-self) 1) )) (sv-string (concatenate 'string (sv-string " }; ") (sv-string (concatenate 'string (sv-string "return ") (sv-string (concatenate 'string (sv-string (sv-emit_go (mp-Main::sv-array-index (sv-arguments sv-self) 2) )) (sv-string (concatenate 'string (sv-string " ") (sv-string "}()")))))))))))))))))))))) nil)(setf sv-code (concatenate 'string (sv-string "f_") (sv-string (sv-code sv-self))))(if (sv-bool (sv-namespace sv-self)) (progn (setf sv-code (concatenate 'string (sv-string "Namespace_") (sv-string (concatenate 'string (sv-string (mp-Main::sv-to_go_namespace (sv-namespace sv-self))) (sv-string (concatenate 'string (sv-string ".") (sv-string sv-code)))))))) (progn (setf sv-code (concatenate 'string (sv-string "this_namespace.") (sv-string sv-code)))))(concatenate 'string (sv-string sv-code) (sv-string (concatenate 'string (sv-string "( Capture{ p : []*Any{ ") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_go c)) (sv-arguments sv-self)) ", ")) (sv-string " } } )")))))))))
+ (let ((sv-code (sv-undef))) (setf sv-code (sv-code sv-self))(if (sv-bool (typep sv-code 'string)) nil (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-emit_go (sv-code sv-self) )) (sv-string (concatenate 'string (sv-string ")->(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit c)) (sv-arguments sv-self)) ", ")) (sv-string ")")))))))))))(if (sv-bool (sv-eq sv-code "self")) (progn (return-from mp6-function "v_self")) nil)(if (sv-bool (sv-eq sv-code "false")) (progn (return-from mp6-function "b_false()")) nil)(if (sv-bool (sv-eq sv-code "make")) (progn (return-from mp6-function (concatenate 'string (sv-string "func () *Any { ") (sv-string (concatenate 'string (sv-string "tmp := ") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_go c)) (sv-arguments sv-self)) ", ")) (sv-string (concatenate 'string (sv-string "; ") (sv-string (concatenate 'string (sv-string "*(*v_MATCH).(capture_er).f_capture(Capture{}) = *tmp; ") (sv-string (concatenate 'string (sv-string "return tmp; ") (sv-string "}()")))))))))))))) nil)(if (sv-bool (sv-eq sv-code "say")) (progn (return-from mp6-function (concatenate 'string (sv-string "f_print( Capture{ p : []*Any{ ") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_go c)) (sv-arguments sv-self)) ", ")) (sv-string ", toStr(\"\\n\") } } )")))))) nil)(if (sv-bool (sv-eq sv-code "print")) (progn (return-from mp6-function (concatenate 'string (sv-string "f_print( Capture{ p : []*Any{ ") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_go c)) (sv-arguments sv-self)) ", ")) (sv-string " } } )")))))) nil)(if (sv-bool (sv-eq sv-code "warn")) (progn (return-from mp6-function (concatenate 'string (sv-string "f_print_stderr( Capture{ p : []*Any{ ") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_go c)) (sv-arguments sv-self)) ", ")) (sv-string ", toStr(\"\\n\") } } )")))))) nil)(if (sv-bool (sv-eq sv-code "die")) (progn (return-from mp6-function (concatenate 'string (sv-string "f_die( Capture{ p : []*Any{ ") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_go c)) (sv-arguments sv-self)) ", ")) (sv-string " } } )")))))) nil)(if (sv-bool (sv-eq sv-code "defined")) (progn (return-from mp6-function (concatenate 'string (sv-string "f_defined( Capture{ p : []*Any{ ") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_go c)) (sv-arguments sv-self)) ", ")) (sv-string " } } )")))))) nil)(if (sv-bool (sv-eq sv-code "pop")) (progn (return-from mp6-function (concatenate 'string (sv-string "f_pop( Capture{ p : []*Any{ ") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_go c)) (sv-arguments sv-self)) ", ")) (sv-string " } } )")))))) nil)(if (sv-bool (sv-eq sv-code "push")) (progn (return-from mp6-function (concatenate 'string (sv-string "f_push( Capture{ p : []*Any{ ") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_go c)) (sv-arguments sv-self)) ", ")) (sv-string " } } )")))))) nil)(if (sv-bool (sv-eq sv-code "shift")) (progn (return-from mp6-function (concatenate 'string (sv-string "f_shift( Capture{ p : []*Any{ ") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_go c)) (sv-arguments sv-self)) ", ")) (sv-string " } } )")))))) nil)(if (sv-bool (sv-eq sv-code "index")) (progn (return-from mp6-function (concatenate 'string (sv-string "f_index( Capture{ p : []*Any{ ") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_go c)) (sv-arguments sv-self)) ", ")) (sv-string " } } )")))))) nil)(if (sv-bool (sv-eq sv-code "substr")) (progn (return-from mp6-function (concatenate 'string (sv-string "f_substr( Capture{ p : []*Any{ ") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_go c)) (sv-arguments sv-self)) ", ")) (sv-string " } } )")))))) nil)(if (sv-bool (sv-eq sv-code "scalar")) (progn (return-from mp6-function (concatenate 'string (sv-string "f_scalar( Capture{ p : []*Any{ ") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_go c)) (sv-arguments sv-self)) ", ")) (sv-string " } } )")))))) nil)(if (sv-bool (sv-eq sv-code "Int")) (progn (return-from mp6-function (concatenate 'string (sv-string "toInt(") (sv-string (concatenate 'string (sv-string "toint(") (sv-string (concatenate 'string (sv-string (sv-emit_go (mp-Main::sv-array-index (sv-arguments sv-self) 0) )) (sv-string (concatenate 'string (sv-string ")") (sv-string ")")))))))))) nil)(if (sv-bool (sv-eq sv-code "Num")) (progn (return-from mp6-function (concatenate 'string (sv-string "toNum(") (sv-string (concatenate 'string (sv-string "tonum(") (sv-string (concatenate 'string (sv-string (sv-emit_go (mp-Main::sv-array-index (sv-arguments sv-self) 0) )) (sv-string (concatenate 'string (sv-string ")") (sv-string ")")))))))))) nil)(if (sv-bool (sv-eq sv-code "exists")) (let ((sv-arg (sv-undef))) (setf sv-arg (mp-Main::sv-array-index (sv-arguments sv-self) 0))(if (sv-bool (typep sv-arg 'mp-Lookup)) (progn (return-from mp6-function (concatenate 'string (sv-string "(*") (sv-string (concatenate 'string (sv-string (sv-emit_go (sv-obj sv-arg ) )) (sv-string (concatenate 'string (sv-string ")") (sv-string (concatenate 'string (sv-string ".(exists_er).f_exists(Capture{ p : []*Any{ ") (sv-string (concatenate 'string (sv-string (sv-emit_go (sv-index_exp sv-arg ) )) (sv-string " } } )")))))))))))) nil)) nil)(if (sv-bool (sv-eq sv-code "prefix:<~>")) (progn (return-from mp6-function (mp-Call::sv-emit_go_call (mp-Main::sv-array-index (sv-arguments sv-self) 0) "Str"))) nil)(if (sv-bool (sv-eq sv-code "prefix:<!>")) (progn (return-from mp6-function (concatenate 'string (sv-string "toBool(!tobool(") (sv-string (concatenate 'string (sv-string (sv-emit_go (mp-Main::sv-array-index (sv-arguments sv-self) 0) )) (sv-string "))")))))) nil)(if (sv-bool (sv-eq sv-code "prefix:<?>")) (progn (return-from mp6-function (mp-Call::sv-emit_go_call (mp-Main::sv-array-index (sv-arguments sv-self) 0) "Bool"))) nil)(if (sv-bool (sv-eq sv-code "prefix:<$>")) (progn (return-from mp6-function (concatenate 'string (sv-string "f_scalar( Capture{ p : []*Any{ ") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_go c)) (sv-arguments sv-self)) ", ")) (sv-string " } } )")))))) nil)(if (sv-bool (sv-eq sv-code "prefix:<@>")) (progn (return-from mp6-function (mp-Call::sv-emit_go_call (mp-Main::sv-array-index (sv-arguments sv-self) 0) "array"))) nil)(if (sv-bool (sv-eq sv-code "prefix:<%>")) (progn (return-from mp6-function (mp-Call::sv-emit_go_call (mp-Main::sv-array-index (sv-arguments sv-self) 0) "hash"))) nil)(if (sv-bool (sv-eq sv-code "infix:<~>")) (progn (return-from mp6-function (concatenate 'string (sv-string "toStr( ") (sv-string (concatenate 'string (sv-string "tostr(") (sv-string (concatenate 'string (sv-string (sv-emit_go (mp-Main::sv-array-index (sv-arguments sv-self) 0) )) (sv-string (concatenate 'string (sv-string ") + ") (sv-string (concatenate 'string (sv-string "tostr(") (sv-string (concatenate 'string (sv-string (sv-emit_go (mp-Main::sv-array-index (sv-arguments sv-self) 1) )) (sv-string (concatenate 'string (sv-string ") ") (sv-string ")")))))))))))))))) nil)(if (sv-bool (sv-eq sv-code "infix:<+>")) (progn (return-from mp6-function (concatenate 'string (sv-string "f_add( ") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_go c)) (sv-arguments sv-self)) ", ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "infix:<->")) (progn (return-from mp6-function (concatenate 'string (sv-string "f_sub( ") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_go c)) (sv-arguments sv-self)) ", ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "infix:<*>")) (progn (return-from mp6-function (concatenate 'string (sv-string "f_mul( ") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_go c)) (sv-arguments sv-self)) ", ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "infix:</>")) (progn (return-from mp6-function (concatenate 'string (sv-string "f_div( ") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_go c)) (sv-arguments sv-self)) ", ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "infix:<>>")) (progn (return-from mp6-function (concatenate 'string (sv-string "f_greater( ") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_go c)) (sv-arguments sv-self)) ", ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "infix:<<>")) (progn (return-from mp6-function (concatenate 'string (sv-string "f_smaller( ") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_go c)) (sv-arguments sv-self)) ", ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "infix:<>=>")) (progn (return-from mp6-function (concatenate 'string (sv-string "toBool( ") (sv-string (concatenate 'string (sv-string "toint(") (sv-string (concatenate 'string (sv-string (sv-emit_go (mp-Main::sv-array-index (sv-arguments sv-self) 0) )) (sv-string (concatenate 'string (sv-string ") >= ") (sv-string (concatenate 'string (sv-string "toint(") (sv-string (concatenate 'string (sv-string (sv-emit_go (mp-Main::sv-array-index (sv-arguments sv-self) 1) )) (sv-string (concatenate 'string (sv-string ") ") (sv-string ")")))))))))))))))) nil)(if (sv-bool (sv-eq sv-code "infix:<<=>")) (progn (return-from mp6-function (concatenate 'string (sv-string "toBool( ") (sv-string (concatenate 'string (sv-string "toint(") (sv-string (concatenate 'string (sv-string (sv-emit_go (mp-Main::sv-array-index (sv-arguments sv-self) 0) )) (sv-string (concatenate 'string (sv-string ") <= ") (sv-string (concatenate 'string (sv-string "toint(") (sv-string (concatenate 'string (sv-string (sv-emit_go (mp-Main::sv-array-index (sv-arguments sv-self) 1) )) (sv-string (concatenate 'string (sv-string ") ") (sv-string ")")))))))))))))))) nil)(if (sv-bool (sv-eq sv-code "infix:<&&>")) (progn (return-from mp6-function (concatenate 'string (sv-string "f_and( ") (sv-string (concatenate 'string (sv-string "func () *Any { return ") (sv-string (concatenate 'string (sv-string (sv-emit_go (mp-Main::sv-array-index (sv-arguments sv-self) 0) )) (sv-string (concatenate 'string (sv-string " }, ") (sv-string (concatenate 'string (sv-string "func () *Any { return ") (sv-string (concatenate 'string (sv-string (sv-emit_go (mp-Main::sv-array-index (sv-arguments sv-self) 1) )) (sv-string (concatenate 'string (sv-string " } ") (sv-string ")")))))))))))))))) nil)(if (sv-bool (sv-eq sv-code "infix:<||>")) (progn (return-from mp6-function (concatenate 'string (sv-string "f_or( ") (sv-string (concatenate 'string (sv-string "func () *Any { return ") (sv-string (concatenate 'string (sv-string (sv-emit_go (mp-Main::sv-array-index (sv-arguments sv-self) 0) )) (sv-string (concatenate 'string (sv-string " }, ") (sv-string (concatenate 'string (sv-string "func () *Any { return ") (sv-string (concatenate 'string (sv-string (sv-emit_go (mp-Main::sv-array-index (sv-arguments sv-self) 1) )) (sv-string (concatenate 'string (sv-string " } ") (sv-string ")")))))))))))))))) nil)(if (sv-bool (sv-eq sv-code "infix:<eq>")) (progn (return-from mp6-function (concatenate 'string (sv-string "toBool(") (sv-string (concatenate 'string (sv-string "tostr(") (sv-string (concatenate 'string (sv-string (sv-emit_go (mp-Main::sv-array-index (sv-arguments sv-self) 0) )) (sv-string (concatenate 'string (sv-string ") == ") (sv-string (concatenate 'string (sv-string "tostr(") (sv-string (concatenate 'string (sv-string (sv-emit_go (mp-Main::sv-array-index (sv-arguments sv-self) 1) )) (sv-string (concatenate 'string (sv-string ")") (sv-string ")")))))))))))))))) nil)(if (sv-bool (sv-eq sv-code "infix:<ne>")) (progn (return-from mp6-function (concatenate 'string (sv-string "toBool(") (sv-string (concatenate 'string (sv-string "tostr(") (sv-string (concatenate 'string (sv-string (sv-emit_go (mp-Main::sv-array-index (sv-arguments sv-self) 0) )) (sv-string (concatenate 'string (sv-string ") != ") (sv-string (concatenate 'string (sv-string "tostr(") (sv-string (concatenate 'string (sv-string (sv-emit_go (mp-Main::sv-array-index (sv-arguments sv-self) 1) )) (sv-string (concatenate 'string (sv-string ")") (sv-string ")")))))))))))))))) nil)(if (sv-bool (sv-eq sv-code "infix:<==>")) (progn (return-from mp6-function (concatenate 'string (sv-string "toBool(") (sv-string (concatenate 'string (sv-string "toint(") (sv-string (concatenate 'string (sv-string (sv-emit_go (mp-Main::sv-array-index (sv-arguments sv-self) 0) )) (sv-string (concatenate 'string (sv-string ") == ") (sv-string (concatenate 'string (sv-string "toint(") (sv-string (concatenate 'string (sv-string (sv-emit_go (mp-Main::sv-array-index (sv-arguments sv-self) 1) )) (sv-string (concatenate 'string (sv-string ") ") (sv-string ")")))))))))))))))) nil)(if (sv-bool (sv-eq sv-code "infix:<!=>")) (progn (return-from mp6-function (concatenate 'string (sv-string "toBool(") (sv-string (concatenate 'string (sv-string "toint(") (sv-string (concatenate 'string (sv-string (sv-emit_go (mp-Main::sv-array-index (sv-arguments sv-self) 0) )) (sv-string (concatenate 'string (sv-string ") != ") (sv-string (concatenate 'string (sv-string "toint(") (sv-string (concatenate 'string (sv-string (sv-emit_go (mp-Main::sv-array-index (sv-arguments sv-self) 1) )) (sv-string (concatenate 'string (sv-string ") ") (sv-string ")")))))))))))))))) nil)(if (sv-bool (sv-eq sv-code "ternary:<?? !!>")) (progn (return-from mp6-function (concatenate 'string (sv-string "func () *Any { ") (sv-string (concatenate 'string (sv-string "if tobool( ") (sv-string (concatenate 'string (sv-string (mp-Call::sv-emit_go_call (mp-Main::sv-array-index (sv-arguments sv-self) 0) "Bool")) (sv-string (concatenate 'string (sv-string " ) ") (sv-string (concatenate 'string (sv-string "{ return ") (sv-string (concatenate 'string (sv-string (sv-emit_go (mp-Main::sv-array-index (sv-arguments sv-self) 1) )) (sv-string (concatenate 'string (sv-string " }; ") (sv-string (concatenate 'string (sv-string "return ") (sv-string (concatenate 'string (sv-string (sv-emit_go (mp-Main::sv-array-index (sv-arguments sv-self) 2) )) (sv-string (concatenate 'string (sv-string " ") (sv-string "}()")))))))))))))))))))))) nil)(setf sv-code (concatenate 'string (sv-string "f_") (sv-string (sv-code sv-self))))(if (sv-bool (sv-namespace sv-self)) (progn (setf sv-code (concatenate 'string (sv-string "Namespace_") (sv-string (concatenate 'string (sv-string (mp-Main::sv-to_go_namespace (sv-namespace sv-self))) (sv-string (concatenate 'string (sv-string ".") (sv-string sv-code)))))))) (progn (setf sv-code (concatenate 'string (sv-string "this_namespace.") (sv-string sv-code)))))(concatenate 'string (sv-string sv-code) (sv-string (concatenate 'string (sv-string "( Capture{ p : []*Any{ ") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_go c)) (sv-arguments sv-self)) ", ")) (sv-string " } } )")))))))))
(defmethod sv-perl ((self mp-Apply))
(mp-Main::sv-lisp_dump_object "::Apply" (list (let ((m (make-instance 'mp-Pair))) (setf (sv-key m) "code") (setf (sv-value m) (sv-code self)) m) (let ((m (make-instance 'mp-Pair))) (setf (sv-key m) "arguments") (setf (sv-value m) (sv-arguments self)) m) (let ((m (make-instance 'mp-Pair))) (setf (sv-key m) "namespace") (setf (sv-value m) (sv-namespace self)) m) )))
View
2  liblisp/MiniPerl6/Javascript/Emitter.lisp
@@ -1012,7 +1012,7 @@ new-slots))
(:documentation "a method")))
(defmethod sv-emit_javascript ((sv-self mp-Apply))
(block mp6-function
- (let ((sv-code (sv-undef))) (setf sv-code (sv-code sv-self))(if (sv-bool (typep sv-code 'string)) nil (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-emit_javascript (sv-code sv-self) )) (sv-string (concatenate 'string (sv-string ")->(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit c)) (sv-arguments sv-self)) ", ")) (sv-string ")")))))))))))(if (sv-bool (sv-eq sv-code "self")) (progn (return-from mp6-function "v_self")) nil)(if (sv-bool (sv-eq sv-code "false")) (progn (return-from mp6-function "0")) nil)(if (sv-bool (sv-eq sv-code "make")) (progn (return-from mp6-function (concatenate 'string (sv-string "(v_MATCH.v_capture = ") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_javascript c)) (sv-arguments sv-self)) ", ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "say")) (progn (return-from mp6-function (concatenate 'string (sv-string "say(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_javascript c)) (sv-arguments sv-self)) " + ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "print")) (progn (return-from mp6-function (concatenate 'string (sv-string "f_print(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_javascript c)) (sv-arguments sv-self)) " + ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "warn")) (progn (return-from mp6-function (concatenate 'string (sv-string "f_warn(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_javascript c)) (sv-arguments sv-self)) " + ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "defined")) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_javascript c)) (sv-arguments sv-self)) " ")) (sv-string " != null)")))))) nil)(if (sv-bool (sv-eq sv-code "substr")) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-emit_javascript (mp-Main::sv-array-index (sv-arguments sv-self) 0) )) (sv-string (concatenate 'string (sv-string " || \"\").substr(") (sv-string (concatenate 'string (sv-string (sv-emit_javascript (mp-Main::sv-array-index (sv-arguments sv-self) 1) )) (sv-string (concatenate 'string (sv-string ", ") (sv-string (concatenate 'string (sv-string (sv-emit_javascript (mp-Main::sv-array-index (sv-arguments sv-self) 2) )) (sv-string ")")))))))))))))) nil)(if (sv-bool (sv-eq sv-code "Int")) (progn (return-from mp6-function (concatenate 'string (sv-string "parseInt(") (sv-string (concatenate 'string (sv-string (sv-emit_javascript (mp-Main::sv-array-index (sv-arguments sv-self) 0) )) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "Num")) (progn (return-from mp6-function (concatenate 'string (sv-string "parseFloat(") (sv-string (concatenate 'string (sv-string (sv-emit_javascript (mp-Main::sv-array-index (sv-arguments sv-self) 0) )) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "prefix:<~>")) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_javascript c)) (sv-arguments sv-self)) " ")) (sv-string ").f_string()")))))) nil)(if (sv-bool (sv-eq sv-code "prefix:<!>")) (progn (return-from mp6-function (concatenate 'string (sv-string "( f_bool(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_javascript c)) (sv-arguments sv-self)) " ")) (sv-string ") ? false : true)")))))) nil)(if (sv-bool (sv-eq sv-code "prefix:<?>")) (progn (return-from mp6-function (concatenate 'string (sv-string "( f_bool(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_javascript c)) (sv-arguments sv-self)) " ")) (sv-string ") ? true : false)")))))) nil)(if (sv-bool (sv-eq sv-code "prefix:<$>")) (progn (return-from mp6-function (concatenate 'string (sv-string "f_scalar(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_javascript c)) (sv-arguments sv-self)) " ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "prefix:<@>")) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_javascript c)) (sv-arguments sv-self)) " ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "prefix:<%>")) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_javascript c)) (sv-arguments sv-self)) " ")) (sv-string ").f_hash()")))))) nil)(if (sv-bool (sv-eq sv-code "infix:<~>")) (progn (return-from mp6-function (concatenate 'string (sv-string "( f_string(") (sv-string (concatenate 'string (sv-string (sv-emit_javascript (mp-Main::sv-array-index (sv-arguments sv-self) 0) )) (sv-string (concatenate 'string (sv-string ")") (sv-string (concatenate 'string (sv-string " + f_string(") (sv-string (concatenate 'string (sv-string (sv-emit_javascript (mp-Main::sv-array-index (sv-arguments sv-self) 1) )) (sv-string ") )")))))))))))) nil)(if (sv-bool (sv-eq sv-code "infix:<+>")) (progn (return-from mp6-function (concatenate 'string (sv-string "f_add(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_javascript c)) (sv-arguments sv-self)) ", ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "infix:<->")) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_javascript c)) (sv-arguments sv-self)) " - ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "infix:<>>")) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_javascript c)) (sv-arguments sv-self)) " > ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "infix:<<>")) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_javascript c)) (sv-arguments sv-self)) " < ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "infix:<>=>")) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_javascript c)) (sv-arguments sv-self)) " >= ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "infix:<<=>")) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_javascript c)) (sv-arguments sv-self)) " <= ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "infix:<&&>")) (progn (return-from mp6-function (concatenate 'string (sv-string "( f_bool(") (sv-string (concatenate 'string (sv-string (sv-emit_javascript (mp-Main::sv-array-index (sv-arguments sv-self) 0) )) (sv-string (concatenate 'string (sv-string ")") (sv-string (concatenate 'string (sv-string " && f_bool(") (sv-string (concatenate 'string (sv-string (sv-emit_javascript (mp-Main::sv-array-index (sv-arguments sv-self) 1) )) (sv-string ") )")))))))))))) nil)(if (sv-bool (sv-eq sv-code "infix:<||>")) (progn (return-from mp6-function (concatenate 'string (sv-string "( f_bool(") (sv-string (concatenate 'string (sv-string (sv-emit_javascript (mp-Main::sv-array-index (sv-arguments sv-self) 0) )) (sv-string (concatenate 'string (sv-string ")") (sv-string (concatenate 'string (sv-string " || f_bool(") (sv-string (concatenate 'string (sv-string (sv-emit_javascript (mp-Main::sv-array-index (sv-arguments sv-self) 1) )) (sv-string ") )")))))))))))) nil)(if (sv-bool (sv-eq sv-code "infix:<eq>")) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_javascript c)) (sv-arguments sv-self)) " == ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "infix:<ne>")) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_javascript c)) (sv-arguments sv-self)) " != ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "infix:<==>")) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_javascript c)) (sv-arguments sv-self)) " == ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "infix:<!=>")) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_javascript c)) (sv-arguments sv-self)) " != ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "exists")) (let ((sv-arg (sv-undef))) (setf sv-arg (mp-Main::sv-array-index (sv-arguments sv-self) 0))(if (sv-bool (typep sv-arg 'mp-Lookup)) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-emit_javascript (sv-obj sv-arg ) )) (sv-string (concatenate 'string (sv-string ").hasOwnProperty(") (sv-string (concatenate 'string (sv-string (sv-emit_javascript (sv-index_exp sv-arg ) )) (sv-string ")")))))))))) nil)) nil)(if (sv-bool (sv-eq sv-code "ternary:<?? !!>")) (progn (return-from mp6-function (concatenate 'string (sv-string "( f_bool(") (sv-string (concatenate 'string (sv-string (sv-emit_javascript (mp-Main::sv-array-index (sv-arguments sv-self) 0) )) (sv-string (concatenate 'string (sv-string ")") (sv-string (concatenate 'string (sv-string " ? ") (sv-string (concatenate 'string (sv-string (sv-emit_javascript (mp-Main::sv-array-index (sv-arguments sv-self) 1) )) (sv-string (concatenate 'string (sv-string " : ") (sv-string (concatenate 'string (sv-string (sv-emit_javascript (mp-Main::sv-array-index (sv-arguments sv-self) 2) )) (sv-string ")")))))))))))))))) nil)(setf sv-code (concatenate 'string (sv-string "f_") (sv-string (sv-code sv-self))))(if (sv-bool (sv-namespace sv-self)) (progn (setf sv-code (concatenate 'string (sv-string (mp-Main::sv-to_javascript_namespace (sv-namespace sv-self))) (sv-string (concatenate 'string (sv-string ".") (sv-string sv-code)))))) (progn (if (sv-bool (sv-and (not (sv-eq sv-code "f_index")) (sv-and (not (sv-eq sv-code "f_die")) (sv-and (not (sv-eq sv-code "f_pop")) (sv-and (not (sv-eq sv-code "f_shift")) (not (sv-eq sv-code "f_push"))))))) (progn (setf sv-code (concatenate 'string (sv-string "v__NAMESPACE.") (sv-string sv-code)))) nil)))(concatenate 'string (sv-string sv-code) (sv-string (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_javascript c)) (sv-arguments sv-self)) ", ")) (sv-string ")")))))))))
+ (let ((sv-code (sv-undef))) (setf sv-code (sv-code sv-self))(if (sv-bool (typep sv-code 'string)) nil (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-emit_javascript (sv-code sv-self) )) (sv-string (concatenate 'string (sv-string ")->(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit c)) (sv-arguments sv-self)) ", ")) (sv-string ")")))))))))))(if (sv-bool (sv-eq sv-code "self")) (progn (return-from mp6-function "v_self")) nil)(if (sv-bool (sv-eq sv-code "false")) (progn (return-from mp6-function "0")) nil)(if (sv-bool (sv-eq sv-code "make")) (progn (return-from mp6-function (concatenate 'string (sv-string "(v_MATCH.v_capture = ") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_javascript c)) (sv-arguments sv-self)) ", ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "say")) (progn (return-from mp6-function (concatenate 'string (sv-string "say(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_javascript c)) (sv-arguments sv-self)) " + ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "print")) (progn (return-from mp6-function (concatenate 'string (sv-string "f_print(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_javascript c)) (sv-arguments sv-self)) " + ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "warn")) (progn (return-from mp6-function (concatenate 'string (sv-string "f_warn(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_javascript c)) (sv-arguments sv-self)) " + ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "defined")) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_javascript c)) (sv-arguments sv-self)) " ")) (sv-string " != null)")))))) nil)(if (sv-bool (sv-eq sv-code "substr")) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-emit_javascript (mp-Main::sv-array-index (sv-arguments sv-self) 0) )) (sv-string (concatenate 'string (sv-string " || \"\").substr(") (sv-string (concatenate 'string (sv-string (sv-emit_javascript (mp-Main::sv-array-index (sv-arguments sv-self) 1) )) (sv-string (concatenate 'string (sv-string ", ") (sv-string (concatenate 'string (sv-string (sv-emit_javascript (mp-Main::sv-array-index (sv-arguments sv-self) 2) )) (sv-string ")")))))))))))))) nil)(if (sv-bool (sv-eq sv-code "Int")) (progn (return-from mp6-function (concatenate 'string (sv-string "parseInt(") (sv-string (concatenate 'string (sv-string (sv-emit_javascript (mp-Main::sv-array-index (sv-arguments sv-self) 0) )) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "Num")) (progn (return-from mp6-function (concatenate 'string (sv-string "parseFloat(") (sv-string (concatenate 'string (sv-string (sv-emit_javascript (mp-Main::sv-array-index (sv-arguments sv-self) 0) )) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "prefix:<~>")) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_javascript c)) (sv-arguments sv-self)) " ")) (sv-string ").f_string()")))))) nil)(if (sv-bool (sv-eq sv-code "prefix:<!>")) (progn (return-from mp6-function (concatenate 'string (sv-string "( f_bool(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_javascript c)) (sv-arguments sv-self)) " ")) (sv-string ") ? false : true)")))))) nil)(if (sv-bool (sv-eq sv-code "prefix:<?>")) (progn (return-from mp6-function (concatenate 'string (sv-string "( f_bool(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_javascript c)) (sv-arguments sv-self)) " ")) (sv-string ") ? true : false)")))))) nil)(if (sv-bool (sv-eq sv-code "prefix:<$>")) (progn (return-from mp6-function (concatenate 'string (sv-string "f_scalar(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_javascript c)) (sv-arguments sv-self)) " ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "prefix:<@>")) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_javascript c)) (sv-arguments sv-self)) " ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "prefix:<%>")) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_javascript c)) (sv-arguments sv-self)) " ")) (sv-string ").f_hash()")))))) nil)(if (sv-bool (sv-eq sv-code "infix:<~>")) (progn (return-from mp6-function (concatenate 'string (sv-string "( f_string(") (sv-string (concatenate 'string (sv-string (sv-emit_javascript (mp-Main::sv-array-index (sv-arguments sv-self) 0) )) (sv-string (concatenate 'string (sv-string ")") (sv-string (concatenate 'string (sv-string " + f_string(") (sv-string (concatenate 'string (sv-string (sv-emit_javascript (mp-Main::sv-array-index (sv-arguments sv-self) 1) )) (sv-string ") )")))))))))))) nil)(if (sv-bool (sv-eq sv-code "infix:<+>")) (progn (return-from mp6-function (concatenate 'string (sv-string "f_add(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_javascript c)) (sv-arguments sv-self)) ", ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "infix:<->")) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_javascript c)) (sv-arguments sv-self)) " - ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "infix:<*>")) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_javascript c)) (sv-arguments sv-self)) " * ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "infix:</>")) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_javascript c)) (sv-arguments sv-self)) " / ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "infix:<>>")) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_javascript c)) (sv-arguments sv-self)) " > ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "infix:<<>")) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_javascript c)) (sv-arguments sv-self)) " < ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "infix:<>=>")) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_javascript c)) (sv-arguments sv-self)) " >= ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "infix:<<=>")) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_javascript c)) (sv-arguments sv-self)) " <= ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "infix:<&&>")) (progn (return-from mp6-function (concatenate 'string (sv-string "( f_bool(") (sv-string (concatenate 'string (sv-string (sv-emit_javascript (mp-Main::sv-array-index (sv-arguments sv-self) 0) )) (sv-string (concatenate 'string (sv-string ")") (sv-string (concatenate 'string (sv-string " && f_bool(") (sv-string (concatenate 'string (sv-string (sv-emit_javascript (mp-Main::sv-array-index (sv-arguments sv-self) 1) )) (sv-string ") )")))))))))))) nil)(if (sv-bool (sv-eq sv-code "infix:<||>")) (progn (return-from mp6-function (concatenate 'string (sv-string "( f_bool(") (sv-string (concatenate 'string (sv-string (sv-emit_javascript (mp-Main::sv-array-index (sv-arguments sv-self) 0) )) (sv-string (concatenate 'string (sv-string ")") (sv-string (concatenate 'string (sv-string " || f_bool(") (sv-string (concatenate 'string (sv-string (sv-emit_javascript (mp-Main::sv-array-index (sv-arguments sv-self) 1) )) (sv-string ") )")))))))))))) nil)(if (sv-bool (sv-eq sv-code "infix:<eq>")) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_javascript c)) (sv-arguments sv-self)) " == ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "infix:<ne>")) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_javascript c)) (sv-arguments sv-self)) " != ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "infix:<==>")) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_javascript c)) (sv-arguments sv-self)) " == ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "infix:<!=>")) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_javascript c)) (sv-arguments sv-self)) " != ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "exists")) (let ((sv-arg (sv-undef))) (setf sv-arg (mp-Main::sv-array-index (sv-arguments sv-self) 0))(if (sv-bool (typep sv-arg 'mp-Lookup)) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-emit_javascript (sv-obj sv-arg ) )) (sv-string (concatenate 'string (sv-string ").hasOwnProperty(") (sv-string (concatenate 'string (sv-string (sv-emit_javascript (sv-index_exp sv-arg ) )) (sv-string ")")))))))))) nil)) nil)(if (sv-bool (sv-eq sv-code "ternary:<?? !!>")) (progn (return-from mp6-function (concatenate 'string (sv-string "( f_bool(") (sv-string (concatenate 'string (sv-string (sv-emit_javascript (mp-Main::sv-array-index (sv-arguments sv-self) 0) )) (sv-string (concatenate 'string (sv-string ")") (sv-string (concatenate 'string (sv-string " ? ") (sv-string (concatenate 'string (sv-string (sv-emit_javascript (mp-Main::sv-array-index (sv-arguments sv-self) 1) )) (sv-string (concatenate 'string (sv-string " : ") (sv-string (concatenate 'string (sv-string (sv-emit_javascript (mp-Main::sv-array-index (sv-arguments sv-self) 2) )) (sv-string ")")))))))))))))))) nil)(setf sv-code (concatenate 'string (sv-string "f_") (sv-string (sv-code sv-self))))(if (sv-bool (sv-namespace sv-self)) (progn (setf sv-code (concatenate 'string (sv-string (mp-Main::sv-to_javascript_namespace (sv-namespace sv-self))) (sv-string (concatenate 'string (sv-string ".") (sv-string sv-code)))))) (progn (if (sv-bool (sv-and (not (sv-eq sv-code "f_index")) (sv-and (not (sv-eq sv-code "f_die")) (sv-and (not (sv-eq sv-code "f_pop")) (sv-and (not (sv-eq sv-code "f_shift")) (not (sv-eq sv-code "f_push"))))))) (progn (setf sv-code (concatenate 'string (sv-string "v__NAMESPACE.") (sv-string sv-code)))) nil)))(concatenate 'string (sv-string sv-code) (sv-string (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit_javascript c)) (sv-arguments sv-self)) ", ")) (sv-string ")")))))))))
(defmethod sv-perl ((self mp-Apply))
(mp-Main::sv-lisp_dump_object "::Apply" (list (let ((m (make-instance 'mp-Pair))) (setf (sv-key m) "code") (setf (sv-value m) (sv-code self)) m) (let ((m (make-instance 'mp-Pair))) (setf (sv-key m) "arguments") (setf (sv-value m) (sv-arguments self)) m) (let ((m (make-instance 'mp-Pair))) (setf (sv-key m) "namespace") (setf (sv-value m) (sv-namespace self)) m) )))
View
2  liblisp/MiniPerl6/Perl5/Emitter.lisp
@@ -956,7 +956,7 @@ new-slots))
(:documentation "a method")))
(defmethod sv-emit ((sv-self mp-Apply))
(block mp6-function
- (let ((sv-ns (sv-undef))(sv-code (sv-undef))) (setf sv-ns "")(if (sv-bool (sv-namespace sv-self)) (progn (setf sv-ns (concatenate 'string (sv-string (sv-namespace sv-self)) (sv-string "::")))) nil)(setf sv-code (concatenate 'string (sv-string sv-ns) (sv-string (sv-code sv-self))))(if (sv-bool (typep sv-code 'string)) nil (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-emit (sv-code sv-self) )) (sv-string (concatenate 'string (sv-string ")->(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit c)) (sv-arguments sv-self)) ", ")) (sv-string ")")))))))))))(if (sv-bool (sv-eq sv-code "self")) (progn (return-from mp6-function "$self")) nil)(if (sv-bool (sv-eq sv-code "false")) (progn (return-from mp6-function "0")) nil)(if (sv-bool (sv-eq sv-code "make")) (progn (return-from mp6-function (concatenate 'string (sv-string "($MATCH->{capture} = (") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit c)) (sv-arguments sv-self)) ", ")) (sv-string "))")))))) nil)(if (sv-bool (sv-eq sv-code "say")) (progn (return-from mp6-function (concatenate 'string (sv-string "Main::say(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit c)) (sv-arguments sv-self)) ", ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "print")) (progn (return-from mp6-function (concatenate 'string (sv-string "Main::print(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit c)) (sv-arguments sv-self)) ", ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "warn")) (progn (return-from mp6-function (concatenate 'string (sv-string "warn(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit c)) (sv-arguments sv-self)) ", ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "array")) (progn (return-from mp6-function (concatenate 'string (sv-string "@{") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit c)) (sv-arguments sv-self)) " ")) (sv-string "}")))))) nil)(if (sv-bool (sv-eq sv-code "pop")) (progn (return-from mp6-function (concatenate 'string (sv-string "pop( @{") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit c)) (sv-arguments sv-self)) " ")) (sv-string "} )")))))) nil)(if (sv-bool (sv-eq sv-code "push")) (progn (return-from mp6-function (concatenate 'string (sv-string "push( @{") (sv-string (concatenate 'string (sv-string (sv-emit (mp-Main::sv-array-index (sv-arguments sv-self) 0) )) (sv-string (concatenate 'string (sv-string "}, ") (sv-string (concatenate 'string (sv-string (sv-emit (mp-Main::sv-array-index (sv-arguments sv-self) 1) )) (sv-string " )")))))))))) nil)(if (sv-bool (sv-eq sv-code "shift")) (progn (return-from mp6-function (concatenate 'string (sv-string "shift( @{") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit c)) (sv-arguments sv-self)) " ")) (sv-string "} )")))))) nil)(if (sv-bool (sv-eq sv-code "Int")) (progn (return-from mp6-function (concatenate 'string (sv-string "(0+") (sv-string (concatenate 'string (sv-string (sv-emit (mp-Main::sv-array-index (sv-arguments sv-self) 0) )) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "Num")) (progn (return-from mp6-function (concatenate 'string (sv-string "(0+") (sv-string (concatenate 'string (sv-string (sv-emit (mp-Main::sv-array-index (sv-arguments sv-self) 0) )) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "prefix:<~>")) (progn (return-from mp6-function (concatenate 'string (sv-string "(\"\" . ") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit c)) (sv-arguments sv-self)) " ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "prefix:<!>")) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit c)) (sv-arguments sv-self)) " ")) (sv-string " ? 0 : 1)")))))) nil)(if (sv-bool (sv-eq sv-code "prefix:<?>")) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit c)) (sv-arguments sv-self)) " ")) (sv-string " ? 1 : 0)")))))) nil)(if (sv-bool (sv-eq sv-code "prefix:<$>")) (progn (return-from mp6-function (concatenate 'string (sv-string "${") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit c)) (sv-arguments sv-self)) " ")) (sv-string "}")))))) nil)(if (sv-bool (sv-eq sv-code "prefix:<@>")) (progn (return-from mp6-function (concatenate 'string (sv-string "@{") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit c)) (sv-arguments sv-self)) " ")) (sv-string "}")))))) nil)(if (sv-bool (sv-eq sv-code "prefix:<%>")) (progn (return-from mp6-function (concatenate 'string (sv-string "%{") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit c)) (sv-arguments sv-self)) " ")) (sv-string "}")))))) nil)(if (sv-bool (sv-eq sv-code "infix:<~>")) (progn (return-from mp6-function (concatenate 'string (sv-string "") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit c)) (sv-arguments sv-self)) " . ")) (sv-string "")))))) nil)(if (sv-bool (sv-eq sv-code "infix:<+>")) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit c)) (sv-arguments sv-self)) " + ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "infix:<->")) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit c)) (sv-arguments sv-self)) " - ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "infix:<>>")) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit c)) (sv-arguments sv-self)) " > ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "infix:<<>")) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit c)) (sv-arguments sv-self)) " < ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "infix:<x>")) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit c)) (sv-arguments sv-self)) " x ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "infix:<>=>")) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit c)) (sv-arguments sv-self)) " >= ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "infix:<<=>")) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit c)) (sv-arguments sv-self)) " <= ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "infix:<&&>")) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit c)) (sv-arguments sv-self)) " && ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "infix:<||>")) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit c)) (sv-arguments sv-self)) " || ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "infix:<eq>")) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit c)) (sv-arguments sv-self)) " eq ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "infix:<ne>")) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit c)) (sv-arguments sv-self)) " ne ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "infix:<==>")) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit c)) (sv-arguments sv-self)) " == ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "infix:<!=>")) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit c)) (sv-arguments sv-self)) " != ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "ternary:<?? !!>")) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-emit (mp-Main::sv-array-index (sv-arguments sv-self) 0) )) (sv-string (concatenate 'string (sv-string " ? ") (sv-string (concatenate 'string (sv-string (sv-emit (mp-Main::sv-array-index (sv-arguments sv-self) 1) )) (sv-string (concatenate 'string (sv-string " : ") (sv-string (concatenate 'string (sv-string (sv-emit (mp-Main::sv-array-index (sv-arguments sv-self) 2) )) (sv-string ")")))))))))))))) nil)(concatenate 'string (sv-string sv-code) (sv-string (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit c)) (sv-arguments sv-self)) ", ")) (sv-string ")")))))))))
+ (let ((sv-ns (sv-undef))(sv-code (sv-undef))) (setf sv-ns "")(if (sv-bool (sv-namespace sv-self)) (progn (setf sv-ns (concatenate 'string (sv-string (sv-namespace sv-self)) (sv-string "::")))) nil)(setf sv-code (concatenate 'string (sv-string sv-ns) (sv-string (sv-code sv-self))))(if (sv-bool (typep sv-code 'string)) nil (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-emit (sv-code sv-self) )) (sv-string (concatenate 'string (sv-string ")->(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit c)) (sv-arguments sv-self)) ", ")) (sv-string ")")))))))))))(if (sv-bool (sv-eq sv-code "self")) (progn (return-from mp6-function "$self")) nil)(if (sv-bool (sv-eq sv-code "false")) (progn (return-from mp6-function "0")) nil)(if (sv-bool (sv-eq sv-code "make")) (progn (return-from mp6-function (concatenate 'string (sv-string "($MATCH->{capture} = (") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit c)) (sv-arguments sv-self)) ", ")) (sv-string "))")))))) nil)(if (sv-bool (sv-eq sv-code "say")) (progn (return-from mp6-function (concatenate 'string (sv-string "Main::say(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit c)) (sv-arguments sv-self)) ", ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "print")) (progn (return-from mp6-function (concatenate 'string (sv-string "Main::print(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit c)) (sv-arguments sv-self)) ", ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "warn")) (progn (return-from mp6-function (concatenate 'string (sv-string "warn(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit c)) (sv-arguments sv-self)) ", ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "array")) (progn (return-from mp6-function (concatenate 'string (sv-string "@{") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit c)) (sv-arguments sv-self)) " ")) (sv-string "}")))))) nil)(if (sv-bool (sv-eq sv-code "pop")) (progn (return-from mp6-function (concatenate 'string (sv-string "pop( @{") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit c)) (sv-arguments sv-self)) " ")) (sv-string "} )")))))) nil)(if (sv-bool (sv-eq sv-code "push")) (progn (return-from mp6-function (concatenate 'string (sv-string "push( @{") (sv-string (concatenate 'string (sv-string (sv-emit (mp-Main::sv-array-index (sv-arguments sv-self) 0) )) (sv-string (concatenate 'string (sv-string "}, ") (sv-string (concatenate 'string (sv-string (sv-emit (mp-Main::sv-array-index (sv-arguments sv-self) 1) )) (sv-string " )")))))))))) nil)(if (sv-bool (sv-eq sv-code "shift")) (progn (return-from mp6-function (concatenate 'string (sv-string "shift( @{") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit c)) (sv-arguments sv-self)) " ")) (sv-string "} )")))))) nil)(if (sv-bool (sv-eq sv-code "Int")) (progn (return-from mp6-function (concatenate 'string (sv-string "(0+") (sv-string (concatenate 'string (sv-string (sv-emit (mp-Main::sv-array-index (sv-arguments sv-self) 0) )) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "Num")) (progn (return-from mp6-function (concatenate 'string (sv-string "(0+") (sv-string (concatenate 'string (sv-string (sv-emit (mp-Main::sv-array-index (sv-arguments sv-self) 0) )) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "prefix:<~>")) (progn (return-from mp6-function (concatenate 'string (sv-string "(\"\" . ") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit c)) (sv-arguments sv-self)) " ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "prefix:<!>")) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit c)) (sv-arguments sv-self)) " ")) (sv-string " ? 0 : 1)")))))) nil)(if (sv-bool (sv-eq sv-code "prefix:<?>")) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit c)) (sv-arguments sv-self)) " ")) (sv-string " ? 1 : 0)")))))) nil)(if (sv-bool (sv-eq sv-code "prefix:<$>")) (progn (return-from mp6-function (concatenate 'string (sv-string "${") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit c)) (sv-arguments sv-self)) " ")) (sv-string "}")))))) nil)(if (sv-bool (sv-eq sv-code "prefix:<@>")) (progn (return-from mp6-function (concatenate 'string (sv-string "@{") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit c)) (sv-arguments sv-self)) " ")) (sv-string "}")))))) nil)(if (sv-bool (sv-eq sv-code "prefix:<%>")) (progn (return-from mp6-function (concatenate 'string (sv-string "%{") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit c)) (sv-arguments sv-self)) " ")) (sv-string "}")))))) nil)(if (sv-bool (sv-eq sv-code "infix:<~>")) (progn (return-from mp6-function (concatenate 'string (sv-string "") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit c)) (sv-arguments sv-self)) " . ")) (sv-string "")))))) nil)(if (sv-bool (sv-eq sv-code "infix:<+>")) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit c)) (sv-arguments sv-self)) " + ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "infix:<->")) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit c)) (sv-arguments sv-self)) " - ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "infix:<*>")) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit c)) (sv-arguments sv-self)) " * ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "infix:</>")) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit c)) (sv-arguments sv-self)) " / ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "infix:<>>")) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit c)) (sv-arguments sv-self)) " > ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "infix:<<>")) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit c)) (sv-arguments sv-self)) " < ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "infix:<>=>")) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit c)) (sv-arguments sv-self)) " >= ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "infix:<<=>")) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit c)) (sv-arguments sv-self)) " <= ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "infix:<x>")) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit c)) (sv-arguments sv-self)) " x ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "infix:<&&>")) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit c)) (sv-arguments sv-self)) " && ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "infix:<||>")) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit c)) (sv-arguments sv-self)) " || ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "infix:<eq>")) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit c)) (sv-arguments sv-self)) " eq ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "infix:<ne>")) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit c)) (sv-arguments sv-self)) " ne ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "infix:<==>")) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit c)) (sv-arguments sv-self)) " == ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "infix:<!=>")) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit c)) (sv-arguments sv-self)) " != ")) (sv-string ")")))))) nil)(if (sv-bool (sv-eq sv-code "ternary:<?? !!>")) (progn (return-from mp6-function (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-emit (mp-Main::sv-array-index (sv-arguments sv-self) 0) )) (sv-string (concatenate 'string (sv-string " ? ") (sv-string (concatenate 'string (sv-string (sv-emit (mp-Main::sv-array-index (sv-arguments sv-self) 1) )) (sv-string (concatenate 'string (sv-string " : ") (sv-string (concatenate 'string (sv-string (sv-emit (mp-Main::sv-array-index (sv-arguments sv-self) 2) )) (sv-string ")")))))))))))))) nil)(concatenate 'string (sv-string sv-code) (sv-string (concatenate 'string (sv-string "(") (sv-string (concatenate 'string (sv-string (sv-join (map 'vector #'(lambda (c) (sv-emit c)) (sv-arguments sv-self)) ", ")) (sv-string ")")))))))))
(defmethod sv-perl ((self mp-Apply))
(mp-Main::sv-lisp_dump_object "::Apply" (list (let ((m (make-instance 'mp-Pair))) (setf (sv-key m) "code") (setf (sv-value m) (sv-code self)) m) (let ((m (make-instance 'mp-Pair))) (setf (sv-key m) "arguments") (setf (sv-value m) (sv-arguments self)) m) (let ((m (make-instance 'mp-Pair))) (setf (sv-key m) "namespace") (setf (sv-value m) (sv-namespace self)) m) )))
View
2  mp6.pl
@@ -6,7 +6,7 @@ package main;
BEGIN {
$::_V6_COMPILER_NAME = 'MiniPerl6';
- $::_V6_COMPILER_VERSION = '3.0';
+ $::_V6_COMPILER_VERSION = '4.1';
}
use MiniPerl6::Perl5::Runtime;
View
2  perlito.js
@@ -821,7 +821,7 @@ if (typeof Apply != 'object') {
// method emit_javascript
Apply.f_emit_javascript = function () {
var v_self = this;
- try { var v_code;(v_code = v_self.v_code);if ( f_bool(f_isa(v_code, "Str")) ) { (function () { null })() } else { (function () { throw(( f_string("(") + f_string(( f_string(v_self.v_code.f_emit_javascript()) + f_string(( f_string(")->(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit() ) } return out; })(v_self.v_arguments).join(", ")) + f_string(")") )) )) )) )); })() };if ( f_bool((v_code == "self")) ) { (function () { throw("v_self"); })() } else { (function () { null })() };if ( f_bool((v_code == "false")) ) { (function () { throw("0"); })() } else { (function () { null })() };if ( f_bool((v_code == "make")) ) { (function () { throw(( f_string("(v_MATCH.v_capture = ") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(", ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "say")) ) { (function () { throw(( f_string("say(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" + ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "print")) ) { (function () { throw(( f_string("f_print(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" + ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "warn")) ) { (function () { throw(( f_string("f_warn(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" + ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "defined")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" ")) + f_string(" != null)") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "substr")) ) { (function () { throw(( f_string("(") + f_string(( f_string(v_self.v_arguments[0].f_emit_javascript()) + f_string(( f_string(" || \"\").substr(") + f_string(( f_string(v_self.v_arguments[1].f_emit_javascript()) + f_string(( f_string(", ") + f_string(( f_string(v_self.v_arguments[2].f_emit_javascript()) + f_string(")") )) )) )) )) )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "Int")) ) { (function () { throw(( f_string("parseInt(") + f_string(( f_string(v_self.v_arguments[0].f_emit_javascript()) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "Num")) ) { (function () { throw(( f_string("parseFloat(") + f_string(( f_string(v_self.v_arguments[0].f_emit_javascript()) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "prefix:<~>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" ")) + f_string(").f_string()") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "prefix:<!>")) ) { (function () { throw(( f_string("( f_bool(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" ")) + f_string(") ? false : true)") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "prefix:<?>")) ) { (function () { throw(( f_string("( f_bool(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" ")) + f_string(") ? true : false)") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "prefix:<$>")) ) { (function () { throw(( f_string("f_scalar(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "prefix:<@>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "prefix:<%>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" ")) + f_string(").f_hash()") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<~>")) ) { (function () { throw(( f_string("( f_string(") + f_string(( f_string(v_self.v_arguments[0].f_emit_javascript()) + f_string(( f_string(")") + f_string(( f_string(" + f_string(") + f_string(( f_string(v_self.v_arguments[1].f_emit_javascript()) + f_string(") )") )) )) )) )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<+>")) ) { (function () { throw(( f_string("f_add(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(", ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<->")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" - ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<>>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" > ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<<>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" < ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<>=>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" >= ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<<=>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" <= ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<&&>")) ) { (function () { throw(( f_string("( f_bool(") + f_string(( f_string(v_self.v_arguments[0].f_emit_javascript()) + f_string(( f_string(")") + f_string(( f_string(" && f_bool(") + f_string(( f_string(v_self.v_arguments[1].f_emit_javascript()) + f_string(") )") )) )) )) )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<||>")) ) { (function () { throw(( f_string("( f_bool(") + f_string(( f_string(v_self.v_arguments[0].f_emit_javascript()) + f_string(( f_string(")") + f_string(( f_string(" || f_bool(") + f_string(( f_string(v_self.v_arguments[1].f_emit_javascript()) + f_string(") )") )) )) )) )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<eq>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" == ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<ne>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" != ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<==>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" == ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<!=>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" != ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "exists")) ) { (function () { var v_arg;(v_arg = v_self.v_arguments[0]);if ( f_bool(f_isa(v_arg, "Lookup")) ) { (function () { throw(( f_string("(") + f_string(( f_string(v_arg.f_obj().f_emit_javascript()) + f_string(( f_string(").hasOwnProperty(") + f_string(( f_string(v_arg.f_index_exp().f_emit_javascript()) + f_string(")") )) )) )) )); })() } else { (function () { null })() }; })() } else { (function () { null })() };if ( f_bool((v_code == "ternary:<?? !!>")) ) { (function () { throw(( f_string("( f_bool(") + f_string(( f_string(v_self.v_arguments[0].f_emit_javascript()) + f_string(( f_string(")") + f_string(( f_string(" ? ") + f_string(( f_string(v_self.v_arguments[1].f_emit_javascript()) + f_string(( f_string(" : ") + f_string(( f_string(v_self.v_arguments[2].f_emit_javascript()) + f_string(")") )) )) )) )) )) )) )); })() } else { (function () { null })() };(v_code = ( f_string("f_") + f_string(v_self.v_code) ));if ( f_bool(v_self.v_namespace) ) { (function () { (v_code = ( f_string(Main.f_to_javascript_namespace(v_self.v_namespace)) + f_string(( f_string(".") + f_string(v_code) )) )); })() } else { (function () { if ( f_bool(( f_bool((v_code != "f_index")) && f_bool(( f_bool((v_code != "f_die")) && f_bool(( f_bool((v_code != "f_pop")) && f_bool(( f_bool((v_code != "f_shift")) && f_bool((v_code != "f_push")) )) )) )) )) ) { (function () { (v_code = ( f_string("v__NAMESPACE.") + f_string(v_code) )); })() } else { (function () { null })() }; })() };return(( f_string(v_code) + f_string(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(", ")) + f_string(")") )) )) )) } catch(err) { if ( err instanceof Error ) { throw(err) } else { return(err) } }
+ try { var v_code;(v_code = v_self.v_code);if ( f_bool(f_isa(v_code, "Str")) ) { (function () { null })() } else { (function () { throw(( f_string("(") + f_string(( f_string(v_self.v_code.f_emit_javascript()) + f_string(( f_string(")->(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit() ) } return out; })(v_self.v_arguments).join(", ")) + f_string(")") )) )) )) )); })() };if ( f_bool((v_code == "self")) ) { (function () { throw("v_self"); })() } else { (function () { null })() };if ( f_bool((v_code == "false")) ) { (function () { throw("0"); })() } else { (function () { null })() };if ( f_bool((v_code == "make")) ) { (function () { throw(( f_string("(v_MATCH.v_capture = ") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(", ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "say")) ) { (function () { throw(( f_string("say(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" + ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "print")) ) { (function () { throw(( f_string("f_print(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" + ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "warn")) ) { (function () { throw(( f_string("f_warn(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" + ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "defined")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" ")) + f_string(" != null)") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "substr")) ) { (function () { throw(( f_string("(") + f_string(( f_string(v_self.v_arguments[0].f_emit_javascript()) + f_string(( f_string(" || \"\").substr(") + f_string(( f_string(v_self.v_arguments[1].f_emit_javascript()) + f_string(( f_string(", ") + f_string(( f_string(v_self.v_arguments[2].f_emit_javascript()) + f_string(")") )) )) )) )) )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "Int")) ) { (function () { throw(( f_string("parseInt(") + f_string(( f_string(v_self.v_arguments[0].f_emit_javascript()) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "Num")) ) { (function () { throw(( f_string("parseFloat(") + f_string(( f_string(v_self.v_arguments[0].f_emit_javascript()) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "prefix:<~>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" ")) + f_string(").f_string()") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "prefix:<!>")) ) { (function () { throw(( f_string("( f_bool(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" ")) + f_string(") ? false : true)") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "prefix:<?>")) ) { (function () { throw(( f_string("( f_bool(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" ")) + f_string(") ? true : false)") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "prefix:<$>")) ) { (function () { throw(( f_string("f_scalar(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "prefix:<@>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "prefix:<%>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" ")) + f_string(").f_hash()") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<~>")) ) { (function () { throw(( f_string("( f_string(") + f_string(( f_string(v_self.v_arguments[0].f_emit_javascript()) + f_string(( f_string(")") + f_string(( f_string(" + f_string(") + f_string(( f_string(v_self.v_arguments[1].f_emit_javascript()) + f_string(") )") )) )) )) )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<+>")) ) { (function () { throw(( f_string("f_add(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(", ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<->")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" - ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<*>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" * ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:</>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" / ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<>>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" > ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<<>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" < ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<>=>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" >= ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<<=>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" <= ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<&&>")) ) { (function () { throw(( f_string("( f_bool(") + f_string(( f_string(v_self.v_arguments[0].f_emit_javascript()) + f_string(( f_string(")") + f_string(( f_string(" && f_bool(") + f_string(( f_string(v_self.v_arguments[1].f_emit_javascript()) + f_string(") )") )) )) )) )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<||>")) ) { (function () { throw(( f_string("( f_bool(") + f_string(( f_string(v_self.v_arguments[0].f_emit_javascript()) + f_string(( f_string(")") + f_string(( f_string(" || f_bool(") + f_string(( f_string(v_self.v_arguments[1].f_emit_javascript()) + f_string(") )") )) )) )) )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<eq>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" == ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<ne>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" != ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<==>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" == ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "infix:<!=>")) ) { (function () { throw(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(" != ")) + f_string(")") )) )); })() } else { (function () { null })() };if ( f_bool((v_code == "exists")) ) { (function () { var v_arg;(v_arg = v_self.v_arguments[0]);if ( f_bool(f_isa(v_arg, "Lookup")) ) { (function () { throw(( f_string("(") + f_string(( f_string(v_arg.f_obj().f_emit_javascript()) + f_string(( f_string(").hasOwnProperty(") + f_string(( f_string(v_arg.f_index_exp().f_emit_javascript()) + f_string(")") )) )) )) )); })() } else { (function () { null })() }; })() } else { (function () { null })() };if ( f_bool((v_code == "ternary:<?? !!>")) ) { (function () { throw(( f_string("( f_bool(") + f_string(( f_string(v_self.v_arguments[0].f_emit_javascript()) + f_string(( f_string(")") + f_string(( f_string(" ? ") + f_string(( f_string(v_self.v_arguments[1].f_emit_javascript()) + f_string(( f_string(" : ") + f_string(( f_string(v_self.v_arguments[2].f_emit_javascript()) + f_string(")") )) )) )) )) )) )) )); })() } else { (function () { null })() };(v_code = ( f_string("f_") + f_string(v_self.v_code) ));if ( f_bool(v_self.v_namespace) ) { (function () { (v_code = ( f_string(Main.f_to_javascript_namespace(v_self.v_namespace)) + f_string(( f_string(".") + f_string(v_code) )) )); })() } else { (function () { if ( f_bool(( f_bool((v_code != "f_index")) && f_bool(( f_bool((v_code != "f_die")) && f_bool(( f_bool((v_code != "f_pop")) && f_bool(( f_bool((v_code != "f_shift")) && f_bool((v_code != "f_push")) )) )) )) )) ) { (function () { (v_code = ( f_string("v__NAMESPACE.") + f_string(v_code) )); })() } else { (function () { null })() }; })() };return(( f_string(v_code) + f_string(( f_string("(") + f_string(( f_string((function (a_) { var out = []; if ( typeof a_ == 'undefined' ) { return out }; for(var i = 0; i < a_.length; i++) { out.push( a_[i].f_emit_javascript() ) } return out; })(v_self.v_arguments).join(", ")) + f_string(")") )) )) )) } catch(err) { if ( err instanceof Error ) { throw(err) } else { return(err) } }
}
Apply.f_emit_javascript; // v8 bug workaround
})();
View
12 t/03-num.t
@@ -1,7 +1,7 @@
use v6;
class Main {
- say '1..3';
+ say '1..5';
my $v := 1 + 0.3;
if ( $v < 1.29 ) || ( $v > 1.31 ) {
print 'not '
@@ -17,4 +17,14 @@ class Main {
print 'not '
}
say 'ok ', 3, ' # ', ($v + '3.4');
+
+ if ( $v / 2 ) != 0.65 {
+ print 'not '
+ }
+ say 'ok 4 # ', ($v / 2);
+
+ if ( $v * 2 ) != 2.6 {
+ print 'not '
+ }
+ say 'ok 5 # ', ($v * 2);
}
View
2  util/mp6.pl
@@ -11,7 +11,7 @@
use MiniPerl6::Emitter::Token;
my $_V6_COMPILER_NAME := 'MiniPerl6';
- my $_V6_COMPILER_VERSION := '3.0';
+ my $_V6_COMPILER_VERSION := '4.1';
my $source := '';
my $backend := 'go';
my $execute := 0;
Please sign in to comment.
Something went wrong with that request. Please try again.