tools/pas2c/Pas2C.hs
branch0.9.21
changeset 10747 07ade56c3b4a
parent 10688 9459c45b5190
child 11398 c3a535886806
equal deleted inserted replaced
10745:fab746a3597e 10747:07ade56c3b4a
   666                                 return $ text s
   666                                 return $ text s
   667 initExpr2C' (InitFloat s) = return $ text s
   667 initExpr2C' (InitFloat s) = return $ text s
   668 initExpr2C' (InitHexNumber s) = return $ text "0x" <> (text . map toLower $ s)
   668 initExpr2C' (InitHexNumber s) = return $ text "0x" <> (text . map toLower $ s)
   669 initExpr2C' (InitString [a]) = return . quotes $ text [a]
   669 initExpr2C' (InitString [a]) = return . quotes $ text [a]
   670 initExpr2C' (InitString s) = return $ strInit s
   670 initExpr2C' (InitString s) = return $ strInit s
       
   671 initExpr2C' (InitPChar s) = return $ doubleQuotes (text $ escapeStr s)
   671 initExpr2C' (InitChar a) = return $ text "0x" <> text (showHex (read a) "")
   672 initExpr2C' (InitChar a) = return $ text "0x" <> text (showHex (read a) "")
   672 initExpr2C' (InitReference i) = id2C IOLookup i
   673 initExpr2C' (InitReference i) = id2C IOLookup i
   673 initExpr2C' (InitRecord fields) = do
   674 initExpr2C' (InitRecord fields) = do
   674     (fs :: [Doc]) <- mapM (\(Identifier a _, b) -> liftM (text "." <> text a <+> equals <+>) $ initExpr2C b) fields
   675     (fs :: [Doc]) <- mapM (\(Identifier a _, b) -> liftM (text "." <> text a <+> equals <+>) $ initExpr2C b) fields
   675     return $ lbrace $+$ (nest 4 . vcat . punctuate comma $ fs) $+$ rbrace
   676     return $ lbrace $+$ (nest 4 . vcat . punctuate comma $ fs) $+$ rbrace