tools/pas2c.hs
changeset 7043 7c080e5ac8d0
parent 7042 de20086a6bcc
child 7046 acc6b5159cde
equal deleted inserted replaced
7042:de20086a6bcc 7043:7c080e5ac8d0
   690     return $ text s
   690     return $ text s
   691 expr2C (FloatLiteral s) = return $ text s
   691 expr2C (FloatLiteral s) = return $ text s
   692 expr2C (HexNumber s) = return $ text "0x" <> (text . map toLower $ s)
   692 expr2C (HexNumber s) = return $ text "0x" <> (text . map toLower $ s)
   693 expr2C (StringLiteral [a]) = do
   693 expr2C (StringLiteral [a]) = do
   694     modify(\s -> s{lastType = BTChar})
   694     modify(\s -> s{lastType = BTChar})
   695     return . quotes $ text [a]
   695     return . quotes . text $ escape a
       
   696     where
       
   697         escape '\'' = "\\\'"
       
   698         escape a = [a]
   696 expr2C (StringLiteral s) = addStringConst s
   699 expr2C (StringLiteral s) = addStringConst s
   697 expr2C (Reference ref) = ref2CF ref
   700 expr2C (Reference ref) = ref2CF ref
   698 expr2C (PrefixOp op expr) = do
   701 expr2C (PrefixOp op expr) = do
   699     e <- expr2C expr
   702     e <- expr2C expr
   700     lt <- gets lastType
   703     lt <- gets lastType