Z-Encode external-core output
authorJan Rochel <jan.rochel@stud.uka.de>
Sun, 2 Jul 2006 21:44:38 +0000 (21:44 +0000)
committerJan Rochel <jan.rochel@stud.uka.de>
Sun, 2 Jul 2006 21:44:38 +0000 (21:44 +0000)
HEAD doesn't z-encode external-core output (unlike 6.4). I suppose, that
this is unwanted behaviour. It probably results from this patch:

========================================================================
Fri Jan  6 17:30:19 CET 2006  simonmar
  * [project @ 2006-01-06 16:30:17 by simonmar]
  Add support for UTF-8 source files

[...]

Z-encoding has been moved right to the back end.  Previously we
used to Z-encode every identifier on the way in for simplicity,
and only decode when we needed to show something to the user.
Instead, we now keep every string in its UTF-8 encoding, and
Z-encode right before printing it out.

[...]
========================================================================

Greetings
Jan

compiler/coreSyn/PprExternalCore.lhs

index 29451d0..1d4e954 100644 (file)
@@ -8,6 +8,7 @@ module PprExternalCore () where
 import Pretty
 import ExternalCore
 import Char
+import Encoding ( zEncodeString )
 
 instance Show Module where
   showsPrec d m = shows (pmodule m)
@@ -40,7 +41,7 @@ instance Show Lit where
 indent = nest 2
 
 pmodule (Module mname tdefs vdefgs) =
-  (text "%module" <+> text mname)
+  (text "%module" <+> text (zEncodeString mname))
     $$ indent ((vcat (map ((<> char ';') . ptdef) tdefs))
               $$ (vcat (map ((<> char ';') . pvdefg) vdefgs)))
 
@@ -59,7 +60,7 @@ pcdef (Constr dcon tbinds tys)  =
 pcdef (GadtConstr dcon ty)  =
   (pname dcon) <+> text "::" <+> pty ty
 
-pname id = text id
+pname id = text (zEncodeString id)
 
 pqname ("",id) = pname id
 pqname (m,id)  = pname m <> char '.' <> pname id