[svn:languages] r118 - chitchat/trunk/src/parser
fperrad at svn.parrot.org
fperrad at svn.parrot.org
Sun May 30 18:36:53 UTC 2010
Author: fperrad
Date: Sun May 30 18:36:53 2010
New Revision: 118
URL: https://trac.parrot.org/languages/changeset/118
Log:
[Chitchat] old NQP is gone
Modified:
chitchat/trunk/src/parser/actions.pm
Modified: chitchat/trunk/src/parser/actions.pm
==============================================================================
--- chitchat/trunk/src/parser/actions.pm Fri May 28 16:08:28 2010 (r117)
+++ chitchat/trunk/src/parser/actions.pm Sun May 30 18:36:53 2010 (r118)
@@ -21,7 +21,7 @@
method TOP($/) {
my $past := PAST::Block.new( :blocktype('declaration'), :node( $/ ) );
for $<exprs> {
- $past.push( $( $_ ) );
+ $past.push( $_.ast );
}
make $past;
}
@@ -29,36 +29,35 @@
method block($/) {
my $past := PAST::Block.new( :blocktype('declaration'), :node($/) );
for $<id> {
- my $param := $( $_ );
+ my $param := $_.ast;
$param.isdecl(1);
$param.scope('parameter');
$past.push($param);
}
if $<temps> {
- my $temps := $( $<temps>[0] );
+ my $temps := $<temps>[0].ast;
$past.push($temps);
}
- $past.push( $( $<exprs> ) );
+ $past.push( $<exprs>.ast );
make $past;
}
method method($/) {
- my $past := $( $<message> );
+ my $past := $<message>.ast;
## todo: pragma
if $<temps> {
- $past.push( $( $<temps>[0] ) );
+ $past.push( $<temps>[0].ast );
}
- $past.push( $( $<exprs> ) );
+ $past.push( $<exprs>.ast );
make $past;
}
method message($/, $key) {
if $key eq 'id' {
- my $name := $( $<id> );
- make PAST::Block.new( :name($name), :node($/) );
+ make PAST::Block.new( :name($<id>.ast), :node($/) );
}
elsif $key eq 'binsel' {
## create a new block for a binary operator; stick to
@@ -66,14 +65,14 @@
make PAST::Block.new( :name('infix:' ~ ~$<binsel>), :node($/) );
}
elsif $key eq 'keysel' {
- my $name := "";
+ my $name := '';
for $<keysel> {
$name := $name ~ ~$_;
}
my $past := PAST::Block.new( :name($name), :node($/) );
for $<id> {
- my $param := $( $_ );
+ my $param := $_.ast;
$param.scope('parameter');
$past.push($param);
}
@@ -84,7 +83,7 @@
method temps($/) {
my $past := PAST::Stmts.new( :node($/) );
for $<id> {
- my $temp := $( $_ );
+ my $temp := $_.ast;
$temp.scope('lexical');
$temp.isdecl(1);
$past.push( $temp );
@@ -95,24 +94,24 @@
method exprs($/) {
my $past := PAST::Stmts.new();
for $<expr> {
- $past.push( $( $_ ) );
+ $past.push( $_.ast );
}
make $past;
}
method expr($/) {
# for $<id> {
- # $( $_ );
+ # $_.ast;
# }
- make $( $<expr2> );
+ make $<expr2>.ast;
}
method expr2($/,$key) {
- my $past := $( $/{$key} );
+ my $past := $/{$key}.ast;
if $key eq 'msgexpr' {
#my $statlist := PAST::Stmts.new();
#for $<cascade> {
- # my $stat := $( $_ );
+ # my $stat := $_.ast;
# $stat.unshift($past);
# $statlist.push($stat);
#}
@@ -126,17 +125,17 @@
method cascade($/,$key) {
- make $( $/{$key} );
+ make $/{$key}.ast;
}
method msgexpr($/,$key) {
- make $( $/{$key} );
+ make $/{$key}.ast;
}
method keyexpr($/) {
my $past := PAST::Op.new( :pasttype('callmethod') );
- $past.push( PAST::Var.new( :name( $( $<keyexpr2>).name() ), :scope('package') ) );
- my @args := $( $<keymsg> );
+ $past.push( PAST::Var.new( :name( ~$<keyexpr2> ), :scope('package') ) );
+ my @args := $<keymsg>.ast;
my $name := '';
while + at args {
$name := $name ~ ~@args.shift();
@@ -147,7 +146,7 @@
}
method keyexpr2($/, $key) {
- make $( $/{$key} );
+ make $/{$key}.ast;
}
method keymsg($/) {
@@ -156,16 +155,16 @@
my $i := 0;
while $i < $num {
@past.push( ~$<keysel>[$i] );
- @past.push( $($<keyexpr2>[$i]) );
+ @past.push( $<keyexpr2>[$i].ast );
$i++;
}
make @past;
}
method binexpr($/) {
- my $past := $( $<primary> );
+ my $past := $<primary>.ast;
for $<binmsg> {
- my $call := $( $_ );
+ my $call := $_.ast;
$call.unshift($past);
$past := $call;
}
@@ -174,28 +173,28 @@
method binmsg($/) {
my $past := PAST::Op.new( :name('infix:' ~ ~$<binsel>), :pasttype('call') );
- $past.push( $( $<primary> ) );
+ $past.push( $<primary>.ast );
make $past;
}
method unaryexpr($/) {
- make $( $<unit> );
+ make $<unit>.ast;
}
method primary($/,$key) {
- make $( $<unit> );
+ make $<unit>.ast;
}
method unit($/,$key) {
- make $( $/{$key} );
+ make $/{$key}.ast;
}
method literal($/,$key) {
- make $( $/{$key} );
+ make $/{$key}.ast;
}
method arrayelem($/,$key) {
- make $( $/{$key} );
+ make $/{$key}.ast;
}
method number($/) {
More information about the parrot-commits
mailing list