Commits

fperrad_ committed 0f816d6

old NQP is gone, use the new one

  • Participants
  • Parent commits e4f0025

Comments (0)

Files changed (1)

File src/parser/actions.pm

 method TOP($/) {
   my $past := PAST::Block.new();
   for $<chardef> {
-    $past.push( mkcall('declare', mkstr($_<character>)));
+    $past.push(mkcall('declare', mkstr($_<character>)));
   }
   for $<act> {
-    $past.push( $( $_ ) );
+    $past.push($_.ast);
   }
   make $past;
 }
 
 sub mkstr($arg) {
-  return PAST::Val.new(:value(""~$arg));
+  return PAST::Val.new(:value('' ~ $arg));
 }
 sub mkcall($name, $arg) {
   return PAST::Op.new($arg, :name($name), :pasttype('call'));
 }
 
 method assignment($/) {
-  make mkcall('assign', $($<value>));
+  make mkcall('assign', $<value>.ast);
 }
 
 method events($/, $k) {
-  make $( $/{$k} );
+  make $/{$k}.ast;
 }
 
 method act($/, $k) {
     my $past := PAST::Stmts.new();
     if $k eq 'open' {
       #fugly
-      our $?ACT := ""~$<roman>;
-      $past.push(PAST::Op.new( :inline("act_"~$?ACT~":")));
+      our $?ACT := '' ~ $<roman>;
+      $past.push(PAST::Op.new(:inline('act_' ~ $?ACT ~ ':')));
     }
     else {
       for $<scene> {
-        $past.push( $( $_ ) );
+        $past.push($_.ast);
       }
     }
     make $past;
 method scene($/) {
     our $?ACT;
     my $past := PAST::Stmts.new(:name($<roman>));
-    my $lbl := PAST::Op.new( 
-      :inline("scene_"~$?ACT~"_"~$<roman>~":"));
-    $past.push($lbl);
+    $past.push(PAST::Op.new(:inline('scene_' ~ $?ACT ~ '_' ~ $<roman> ~ ':')));
     for $<events> {
-      $past.push( $( $_ ) );
+      $past.push($_.ast);
     }
     make $past;
 }
 
 method branch($/) {
   our $?ACT;
-  make PAST::Op.new(:inline("goto "~"scene_"~$?ACT~"_"~$<roman>));
+  make PAST::Op.new(:inline('goto ' ~ 'scene_' ~ $?ACT ~ '_' ~ $<roman>));
 }
 
 method io($/,$k) {
     my $past := PAST::Stmts.new();
     $past.push(
       PAST::Op.new(
-        PAST::Var.new(
-          :name('the_speaker'),
-          :scope('package')
-        ),
+        PAST::Var.new(:name('the_speaker'), :scope('package')),
         mkstr($<character>),
         :pasttype('bind')
       )
     );
     for $<sentence> {
-      $past.push( $( $_ ) );
+      $past.push($_.ast);
     }
     make $past;
 }
 
 method sentence($/, $key) {
-  make $( $/{$key} );
+  make $/{$key}.ast;
 }
 
 
 method value($/, $key) {
-  make $( $/{$key} );
+  make $/{$key}.ast;
 }
 
 method question($/) {
-  my  $res := $($<comparison>);
+  my  $res := $<comparison>.ast;
   for $<value> {
-    $res.push( $( $_ ));
+    $res.push($_.ast);
   }
   make $res;
 }
 
 method comparison($/,$k) {
-    make mkcall0( $k );
+    make mkcall0($k);
 }
 
 method reference($/, $k) {
   if $k eq 'named_ref' {
-    make mkcall('valueof',  mkstr($<character>));
+    make mkcall('valueof', mkstr($<character>));
   }
   elsif $k eq 'you_ref' {
     make mkcall('valueof', mkcall0('find_other_name'));
   my $past := PAST::Stmts.new();
   if $<character> {
     for $<character> {
-      my $res := mkcall($k, mkstr($_));
-      $past.push($res);
+      $past.push(mkcall($k, mkstr($_)));
     }
   }
   else {
     $past.push(mkcall0('exeunt_omnes'));
-  } 
+  }
   make $past;
 }
 
   }
   for $<adjective> {
     unless $_<first_person_possessive> || $_<second_person_possessive> || $_<third_person_possessive> {
-      $value:= $value*2;
+      $value := $value * 2;
     }
   }
-  make PAST::Val.new( :value( $value ) );
+  make PAST::Val.new(:value($value));
 }
 
 
 method tap($/) {
-  make mkcall('tap', $($<value>));
+  make mkcall('tap', $<value>.ast);
 }
 
 method memorize($/) {
-  make mkcall('push', $($<value>));
+  make mkcall('push', $<value>.ast);
 }
 
 method recall($/) {
-  make mkcall0( 'pop' );
+  make mkcall0('pop');
 }
 
 method plan($/) {
-  make mkcall('plan', $($<value>));
+  make mkcall('plan', $<value>.ast);
 }
 
 method test($/, $k) {
-  my $test := PAST::Var.new(:name('the_condition'),:scope('package'));
-  make PAST::Op.new( $test, $($<sentence>), :pasttype($k));
+  my $test := PAST::Var.new(:name('the_condition'), :scope('package'));
+  make PAST::Op.new( $test, $<sentence>.ast, :pasttype($k));
 }
 
 method computation($/, $key) {
-  make $( $/{$key} );
+  make $/{$key}.ast;
 }
 
 method unary($/, $k) {
-  make mkcall($k, $($<value>));
+  make mkcall($k, $<value>.ast);
 }
 
 method binary($/, $key) {
-  my $res := PAST::Op.new(:pirop( $key ));
-  for $<value> { $res.push( $( $_ )) }
+  my $res := PAST::Op.new(:pirop($key));
+  for $<value> {
+    $res.push($_.ast)
+  }
   make $res;
 }