summaryrefslogtreecommitdiff
path: root/src/GF/Canon/PrintGFC.hs
diff options
context:
space:
mode:
authorbringert <unknown>2004-08-23 07:51:36 +0000
committerbringert <unknown>2004-08-23 07:51:36 +0000
commit65f012d15513814bd2cc4ad74f54edd35ade13fe (patch)
tree089419071773038e8357a6b97a9ec0481df2a338 /src/GF/Canon/PrintGFC.hs
parent25ffe15333a881022047409a1c12a17dd41d1198 (diff)
Added CFGM format (pm -printer=cfgm) and utf8 conversion for pm.
Diffstat (limited to 'src/GF/Canon/PrintGFC.hs')
-rw-r--r--src/GF/Canon/PrintGFC.hs11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/GF/Canon/PrintGFC.hs b/src/GF/Canon/PrintGFC.hs
index 77e60c75d..e2b6e057a 100644
--- a/src/GF/Canon/PrintGFC.hs
+++ b/src/GF/Canon/PrintGFC.hs
@@ -69,12 +69,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
+mkEsc :: Char -> Char -> ShowS
+mkEsc q s = case s of
+ _ | s == q -> showChar '\\' . showChar s
+ '\\'-> showString "\\\\"
'\n' -> showString "\\n"
'\t' -> showString "\\t"
_ -> showChar s