forked from GitHub/gf-core
Added CFGM format (pm -printer=cfgm) and utf8 conversion for pm.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user