Author: autrijus
Date: Sat Nov  5 12:12:18 2005
New Revision: 9802

Modified:
   trunk/runtime/parrot/library/PGE/Hs.pir
Log:
* PGE::Hs - accomodate the fact that PGE can return
  arbitrary PMC object instead of just Match ones.

  Introduce the PGE_String form to capture the attributes
  returned by PGE.


Modified: trunk/runtime/parrot/library/PGE/Hs.pir
==============================================================================
--- trunk/runtime/parrot/library/PGE/Hs.pir     (original)
+++ trunk/runtime/parrot/library/PGE/Hs.pir     Sat Nov  5 12:12:18 2005
@@ -21,6 +21,7 @@ The Haskell-side data structure is defin
     data MatchPGE
         = PGE_Match Int Int [MatchPGE] [(String, MatchPGE)]
         | PGE_Array [MatchPGE]
+        | PGE_String String
         | PGE_Fail
         deriving (Show, Eq, Ord, Read)
 
@@ -151,7 +152,7 @@ END:
     .local int ari, arc
     .local int tmpi, cond
     .local string tmps, key
-    .local pmc capt, iter, subelm, elm, escape, is_array
+    .local pmc capt, iter, subelm, elm, escape
 
     out = ""
     escape = find_global "Data::Escape", "String"
@@ -208,18 +209,27 @@ END:
     out .= ")"
     unless iter goto end
     out .= ", "
-    goto subrules_loop
+    goto subrules_body
   subrules_fail:
     out .= PGE_FAIL
     key = shift iter
-    goto subrules_loop
+    unless iter goto end
+    goto subrules_body
 
   dumper:
     $I0 = isa elm, "Array"
     if $I0 goto dumper_array
+    $I0 = can elm, "dump_hs"
+    unless $I0 goto dumper_string
     tmps = elm."dump_hs"()
     out .= tmps
     ret
+  dumper_string:
+    tmps = escape(elm)
+    out .= 'PGE_String "'
+    out .= tmps
+    out .= '"'
+    ret
   dumper_fail:
     out .= PGE_FAIL
     ret

Reply via email to