1
0
forked from GitHub/gf-core

Added CFGM format (pm -printer=cfgm) and utf8 conversion for pm.

This commit is contained in:
bringert
2004-08-23 07:51:36 +00:00
parent 25ffe15333
commit 65f012d155
22 changed files with 1829 additions and 20 deletions

View File

@@ -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