[svn:parrot] r37765 - branches/pge1/compilers/pge/PGE

pmichaud at svn.parrot.org pmichaud at svn.parrot.org
Fri Mar 27 20:34:45 UTC 2009


Author: pmichaud
Date: Fri Mar 27 20:34:43 2009
New Revision: 37765
URL: https://trac.parrot.org/parrot/changeset/37765

Log:
[pge]:  Separate get/set into separate .ast and !make methods on Match.

Modified:
   branches/pge1/compilers/pge/PGE/Match.pir
   branches/pge1/compilers/pge/PGE/Perl6Regex.pir

Modified: branches/pge1/compilers/pge/PGE/Match.pir
==============================================================================
--- branches/pge1/compilers/pge/PGE/Match.pir	Fri Mar 27 20:20:32 2009	(r37764)
+++ branches/pge1/compilers/pge/PGE/Match.pir	Fri Mar 27 20:34:43 2009	(r37765)
@@ -251,26 +251,33 @@
 .end
 
 .sub 'result_object' :method
-    .param pmc obj             :slurpy
-    .tailcall self.'ast'(obj :flat)
+    .param pmc obj
+    .tailcall self.'!make'(obj)
+.end
+
+=item C<!make(pmc obj)>
+
+Sets the "ast object" for the Match invocant.
+
+=cut
+
+.sub '!make' :method
+    .param pmc obj
+    setattribute self, '$!ast', obj
+    .return (obj)
 .end
 
 
 =item C<ast([pmc obj])>
 
-Returns or sets the "result object" for the match object.
+Returns the "ast object" for the match object.  If no ast object
+has been set, then it returns the string between C<.from> and C<.to>.
 
 =cut
 
 .sub 'ast' :method
-    .param pmc obj             :optional
-    .param int has_obj         :opt_flag
-    if has_obj == 0 goto get_obj
-    setattribute self, '$!ast', obj
-    goto ret_obj
-  get_obj:
+    .local pmc obj
     obj = getattribute self, '$!ast'
-  ret_obj:
     if null obj goto ret_null
     .return (obj)
   ret_null:

Modified: branches/pge1/compilers/pge/PGE/Perl6Regex.pir
==============================================================================
--- branches/pge1/compilers/pge/PGE/Perl6Regex.pir	Fri Mar 27 20:20:32 2009	(r37764)
+++ branches/pge1/compilers/pge/PGE/Perl6Regex.pir	Fri Mar 27 20:34:43 2009	(r37765)
@@ -333,7 +333,7 @@
     $S0 = substr target, pos, litlen
     pos += litlen
     mob = mob.'new'(mob, 'grammar'=>'PGE::Exp::Literal')
-    mob.'ast'($S0)
+    mob.'!make'($S0)
     mob.'to'(pos)
     .return (mob)
 
@@ -376,7 +376,7 @@
   quoted_metachar:
     inc pos
     mob = mob.'new'(mob, 'grammar'=>'PGE::Exp::Literal')
-    mob.'ast'(initchar)
+    mob.'!make'(initchar)
     mob.'to'(pos)
     .return (mob)
 
@@ -401,7 +401,7 @@
 
   term_literal:
     mob = mob.'new'(mob, 'grammar'=>'PGE::Exp::Literal')
-    mob.'ast'(charlist)
+    mob.'!make'(charlist)
     mob.'to'(pos)
     .return (mob)
 
@@ -1032,7 +1032,7 @@
     goto literal_iter
   literal_end:
     inc pos
-    mob.'ast'(lit)
+    mob.'!make'(lit)
     mob.'to'(pos)
     .return (mob)
   literal_error:


More information about the parrot-commits mailing list