diff options
| author | bringert <unknown> | 2004-08-23 07:51:36 +0000 |
|---|---|---|
| committer | bringert <unknown> | 2004-08-23 07:51:36 +0000 |
| commit | 65f012d15513814bd2cc4ad74f54edd35ade13fe (patch) | |
| tree | 089419071773038e8357a6b97a9ec0481df2a338 /src/GF/Source/PrintGF.hs | |
| parent | 25ffe15333a881022047409a1c12a17dd41d1198 (diff) | |
Added CFGM format (pm -printer=cfgm) and utf8 conversion for pm.
Diffstat (limited to 'src/GF/Source/PrintGF.hs')
| -rw-r--r-- | src/GF/Source/PrintGF.hs | 11 |
1 files changed, 6 insertions, 5 deletions
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 |
