Author: pmichaud
Date: Thu Oct  4 22:01:07 2007
New Revision: 21863

Modified:
   trunk/runtime/parrot/library/PGE/Glob.pir
   trunk/runtime/parrot/library/PGE/P6Grammar.pir
   trunk/runtime/parrot/library/PGE/Perl6Grammar.pir

Log:
[pge]:
* Convert more 'newfrom' calls to 'new' in PGE runtime libraries.


Modified: trunk/runtime/parrot/library/PGE/Glob.pir
==============================================================================
--- trunk/runtime/parrot/library/PGE/Glob.pir   (original)
+++ trunk/runtime/parrot/library/PGE/Glob.pir   Thu Oct  4 22:01:07 2007
@@ -172,13 +172,11 @@
     .param pmc adverbs         :slurpy :named
 
     .local string target
-    .local pmc mfrom, mpos
     .local int pos
-    (mob, target, mfrom, mpos) = mob.newfrom(0, 'PGE::Exp::Literal')
-    pos = mfrom
-    ($S0, $I0) = 'scan_literal'(target, mfrom, '*?[{')
+    (mob, pos, target) = mob.'new'(mob, 'grammar'=>'PGE::Exp::Literal')
+    ($S0, $I0) = 'scan_literal'(target, pos, '*?[{')
     if $I0 <= pos goto end
-    mpos = $I0
+    mob.'to'($I0)
     mob.'result_object'($S0)
   end:
     .return (mob)
@@ -195,10 +193,9 @@
 .sub 'glob_quest'
     .param pmc mob
     .param pmc adverbs         :slurpy :named
-    .local pmc mtarget, mfrom, mpos
     ##   The '?' is already in mob['KEY'], so we don't need to find it here.
-    (mob, mtarget, mfrom, mpos) = mob.newfrom(0, 'PGE::Exp::CCShortcut')
-    assign mpos, mfrom
+    (mob, $I0) = mob.'new'(mob, 'grammar'=>'PGE::Exp::CCShortcut')
+    mob.'to'($I0)
     mob.'result_object'('.')
     .return (mob)
 .end
@@ -214,15 +211,15 @@
 .sub 'glob_star'
     .param pmc mob
     .param pmc adverbs         :slurpy :named
-    .local pmc mtarget, mfrom, mpos
+    .local int pos
     ##   The '*' is already in mob['KEY'], so we don't need to find it here.
     ##   We create a Quant object, then a CCShortcut inside of it.
-    (mob, mtarget, mfrom, mpos) = mob.newfrom(0, 'PGE::Exp::Quant')
-    assign mpos, mfrom
+    (mob, pos) = mob.'new'(mob, 'grammar'=>'PGE::Exp::Quant')
+    mob.'to'(pos)
     mob['min'] = 0
     mob['max'] = GLOB_INF
-    ($P0, $P1, $P2, $P3) = mob.newfrom(0, 'PGE::Exp::CCShortcut')
-    assign $P3, $P2
+    $P0 = mob.'new'(mob, 'grammar'=>'PGE::Exp::CCShortcut')
+    $P0.'to'(pos)
     $P0.'result_object'('.')
     mob[0] = $P0
     .return (mob)
@@ -240,12 +237,10 @@
     .param pmc adverbs         :slurpy :named
 
     .local string target
-    .local pmc mfrom, mpos
-    (mob, target, mfrom, mpos) = mob.newfrom(0, 'PGE::Exp::EnumCharList')
-
     .local int pos, lastpos
-    pos = mfrom
+    (mob, pos, target) = mob.'new'(mob, 'grammar'=>'PGE::Exp::EnumCharList')
     lastpos = length target
+
     $S0 = substr target, pos, 1
     if $S0 == '!' goto negate
     if $S0 == '^' goto negate
@@ -286,12 +281,12 @@
     charlist .= '-'
   scan_end:
     inc pos
-    mpos = pos
+    mob.'to'(pos)
     mob.'result_object'(charlist)
     .return (mob)
 
   err_noclose:
-    mpos = -1
+    mob.'to'(-1)
     .return (mob)
 .end
 
@@ -308,35 +303,34 @@
 
     .local string target
     .local int pos, lastpos
-    (mob, target, $P2, $P3) = mob.newfrom(0, 'PGE::Exp::Literal')
-    pos = $P2
+    (mob, pos, target) = mob.'new'(mob, 'grammar'=>'PGE::Exp::Literal')
     lastpos = length target
 
     ($S0, pos) = 'scan_literal'(target, pos, ',}')
+    mob.'to'(pos)
     mob.'result_object'($S0)
-    $P3 = pos
   alt_loop:
     if pos >= lastpos goto err_noclose
     $S0 = substr target, pos, 1
     if $S0 == '}' goto end
-    ($P0, $P1, $P2, $P3) = mob.newfrom(0, 'PGE::Exp::Alt')
+    $P0 = mob.'new'(mob, 'grammar'=>'PGE::Exp::Alt')
     inc pos
-    $P3 = pos
+    mob.'to'(pos)
     $P0[0] = mob
     mob = $P0
-    ($P0, $P1, $P2, $P3) = mob.newfrom(0, 'PGE::Exp::Literal')
+    $P0 = mob.'new'(mob, 'grammar'=>'PGE::Exp::Literal')
     ($S0, pos) = 'scan_literal'(target, pos, ',}')
-    $P3 = pos
+    mob.'to'(pos)
     $P0.'result_object'($S0)
     mob[1] = $P0
     goto alt_loop
   end:
     inc pos
-    mob.to(pos)
+    mob.'to'(pos)
     .return (mob)
 
   err_noclose:
-    mob.to(-1)
+    mob.'to'(-1)
     .return (mob)
 .end
 

Modified: trunk/runtime/parrot/library/PGE/P6Grammar.pir
==============================================================================
--- trunk/runtime/parrot/library/PGE/P6Grammar.pir      (original)
+++ trunk/runtime/parrot/library/PGE/P6Grammar.pir      Thu Oct  4 22:01:07 2007
@@ -140,8 +140,8 @@
 
     # get our initial match object
     .local pmc match
-    $P0 = get_hll_global ['PGE::Match'], 'newfrom'
-    match = $P0(source, 0, 'PGE::P6Grammar')
+    $P0 = get_hll_global ['PGE'], 'Match'
+    match = $P0.'new'(source, 'grammar'=>'PGE::P6Grammar')
 
     .local pmc stmtrule
     stmtrule = get_hll_global ['PGE::P6Grammar'], 'statement'

Modified: trunk/runtime/parrot/library/PGE/Perl6Grammar.pir
==============================================================================
--- trunk/runtime/parrot/library/PGE/Perl6Grammar.pir   (original)
+++ trunk/runtime/parrot/library/PGE/Perl6Grammar.pir   Thu Oct  4 22:01:07 2007
@@ -146,8 +146,8 @@
 
     # get our initial match object
     .local pmc match
-    $P0 = get_hll_global ['PGE::Match'], 'newfrom'
-    match = $P0(source, 0, 'PGE::Perl6Grammar')
+    $P0 = get_hll_global ['PGE'], 'Match'
+    match = $P0.'new'(source, 'grammar'=>'PGE::Perl6Grammar')
 
     .local pmc stmtrule
     stmtrule = get_hll_global ['PGE::Perl6Grammar'], 'statement'

Reply via email to