From 65f012d15513814bd2cc4ad74f54edd35ade13fe Mon Sep 17 00:00:00 2001 From: bringert Date: Mon, 23 Aug 2004 07:51:36 +0000 Subject: Added CFGM format (pm -printer=cfgm) and utf8 conversion for pm. --- src/GF/Source/PrintGF.hs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/GF/Source/PrintGF.hs') diff --git a/src/GF/Source/PrintGF.hs b/src/GF/Source/PrintGF.hs index 2774246bf..88b20308e 100644 --- a/src/GF/Source/PrintGF.hs +++ b/src/GF/Source/PrintGF.hs @@ -66,12 +66,13 @@ instance Print Double where prt _ x = doc (shows x) instance Print Char where - prt _ s = doc (showChar '\'' . mkEsc s . showChar '\'') - prtList s = doc (showChar '"' . concatS (map mkEsc s) . showChar '"') + prt _ s = doc (showChar '\'' . mkEsc '\'' s . showChar '\'') + prtList s = doc (showChar '"' . concatS (map (mkEsc '"') s) . showChar '"') -mkEsc :: Char -> ShowS -mkEsc s = case s of - _ | elem s "\\\"" -> showChar '\\' . showChar s -- H (don't escape ') +mkEsc :: Char -> Char -> ShowS +mkEsc q s = case s of + _ | s == q -> showChar '\\' . showChar s + '\\'-> showString "\\\\" '\n' -> showString "\\n" '\t' -> showString "\\t" _ -> showChar s -- cgit v1.2.3