[svn:parrot] r38361 - in branches/pmc_pct/compilers/nqp/src: . Grammar

bacek at svn.parrot.org bacek at svn.parrot.org
Sun Apr 26 02:10:53 UTC 2009


Author: bacek
Date: Sun Apr 26 02:10:53 2009
New Revision: 38361
URL: https://trac.parrot.org/parrot/changeset/38361

Log:
[nqp] Add handling of self

Modified:
   branches/pmc_pct/compilers/nqp/src/Grammar.pg
   branches/pmc_pct/compilers/nqp/src/Grammar/Actions.pir

Modified: branches/pmc_pct/compilers/nqp/src/Grammar.pg
==============================================================================
--- branches/pmc_pct/compilers/nqp/src/Grammar.pg	Sun Apr 26 02:10:35 2009	(r38360)
+++ branches/pmc_pct/compilers/nqp/src/Grammar.pg	Sun Apr 26 02:10:53 2009	(r38361)
@@ -287,6 +287,7 @@
     | <circumfix> {*}                                      #= circumfix
     | <variable> {*}                                       #= variable
     | <subcall> {*}                                        #= subcall
+    | 'self' >> {*}                                        #= self
     | <value> {*}                                          #= value
     | <name> {*}                                           #= name
 }

Modified: branches/pmc_pct/compilers/nqp/src/Grammar/Actions.pir
==============================================================================
--- branches/pmc_pct/compilers/nqp/src/Grammar/Actions.pir	Sun Apr 26 02:10:35 2009	(r38360)
+++ branches/pmc_pct/compilers/nqp/src/Grammar/Actions.pir	Sun Apr 26 02:10:53 2009	(r38361)
@@ -743,9 +743,16 @@
 .sub 'noun' :method
     .param pmc match
     .param pmc key
+
     $P0 = match[key]
+    if key == 'self' goto make_self
     $P1 = $P0.'ast'()
     match.'!make'($P1)
+    .return()
+  make_self:
+    $P9 = get_hll_global ['PAST'], 'Op'
+    $P1 = $P9.'new'('inline'=>'    %r = self', 'pasttype'=>'inline', 'node'=>$P0)
+    match.'!make'($P1)
 .end
 
 


More information about the parrot-commits mailing list