diff -r b1d0d26d41fa -r e6033fe39b7f tools/pas2c.hs --- a/tools/pas2c.hs Tue Apr 24 06:53:39 2012 +0200 +++ b/tools/pas2c.hs Tue Apr 24 16:11:07 2012 +0400 @@ -46,10 +46,16 @@ addStringConst :: String -> State RenderState Doc addStringConst str = do - i <- getUniq - let sn = "__str" ++ show i - modify (\s -> s{lastType = BTString, stringConsts = (sn, str) : stringConsts s}) - return $ text sn + strs <- gets stringConsts + let a = find ((==) str . snd) strs + if isJust a then + return . text . fst . fromJust $ a + else + do + i <- getUniq + let sn = "__str" ++ show i + modify (\s -> s{lastType = BTString, stringConsts = (sn, str) : strs}) + return $ text sn escapeStr :: String -> String escapeStr = foldr escapeChar []