Commits

Anonymous committed 9461739

reorder arguments for mkcall

Comments (0)

Files changed (1)

src/parser/actions.pm

 method TOP($/) {
   my $past := PAST::Block.new();
   for $<chardef> {
-    $past.push( mkcall( mkstr($_<character>), 'declare'));
+    $past.push( mkcall('declare', mkstr($_<character>)));
   }
   for $<act> {
     $past.push( $( $_ ) );
 sub mkstr($arg) {
   return PAST::Val.new(:value(""~$arg));
 }
-sub mkcall($arg,$name) {
-return PAST::Op.new($arg, :name($name), :pasttype('call'));
+sub mkcall($name, $arg) {
+  return PAST::Op.new($arg, :name($name), :pasttype('call'));
 }
 sub mkcall0($name) {
-return PAST::Op.new(:name($name), :pasttype('call'));
+  return PAST::Op.new(:name($name), :pasttype('call'));
 }
 
 method assignment($/) {
-  make mkcall($($<value>), 'assign');
+  make mkcall('assign', $($<value>));
 }
 
 method events($/, $k) {
     }
     make $past;
 }
+
 method sentence($/, $key) {
   make $( $/{$key} );
 }
 
-sub dbg($str) {
-  if (0) {
-    say($str);
-  }
-}
 
 method value($/, $key) {
   make $( $/{$key} );
 
 method reference($/, $k) {
   if $k eq 'named_ref' {
-    make mkcall( mkstr($<character>), 'valueof');
+    make mkcall('valueof',  mkstr($<character>));
   }
   elsif $k eq 'you_ref' {
-    make mkcall( mkcall0('find_other_name'), 'valueof');
+    make mkcall('valueof', mkcall0('find_other_name'));
   }
   else {
-    make mkcall( mkcall0('get_speaker_name'), 'valueof');
+    make mkcall('valueof', mkcall0('get_speaker_name'));
   }
 }
 
   my $past := PAST::Stmts.new();
 
   for $<charlist><character> {
-    my $res := mkcall( mkstr($_),'enter');
+    my $res := mkcall('enter', mkstr($_));
     $past.push($res);
   }
   make $past;
 
   if $k eq 'list' {
     for $<charlist><character> {
-      my $res := mkcall( mkstr($_), 'exit');
+      my $res := mkcall('exit', mkstr($_));
       $past.push($res);
     }
   }
   make $past;
 }
 method exits($/) {
-  make mkcall( mkstr($<character>), 'exit');
+  make mkcall('exit', mkstr($<character>));
 }
 
 method immediate($/) {
 
 
 method tap($/) {
-  make mkcall( $($<value>), 'tap' );
+  make mkcall('tap', $($<value>));
 }
 
 method memorize($/) {
-  make mkcall( $($<value>), 'push' );
+  make mkcall('push', $($<value>));
 }
 
 method recall($/) {
 }
 
 method plan($/) {
-  make mkcall( $($<value>), 'plan' );
+  make mkcall('plan', $($<value>));
 }
 
 method test($/, $k) {
   make $( $/{$key} );
 }
 
-method unary($/, $key) {
-  make mkcall( $($<value>), $key );
+method unary($/, $k) {
+  make mkcall($k, $($<value>));
 }
 
 method binary($/, $key) {