tools/pas2c/Pas2C.hs
branch1.0.0
changeset 15895 f8a3f204242d
parent 15887 6b10b0cdbeab
child 15896 fac577eb8756
equal deleted inserted replaced
15891:ccce86a05f31 15895:f8a3f204242d
   709                   (Identifier "LongWord" _) -> return $ text "4294967295"
   709                   (Identifier "LongWord" _) -> return $ text "4294967295"
   710                   _ -> error $ "BuiltInFunction 'high' in initExpr: " ++ show e'
   710                   _ -> error $ "BuiltInFunction 'high' in initExpr: " ++ show e'
   711          a -> error $ "BuiltInFunction 'high' in initExpr: " ++ show a ++ ": " ++ show hi
   711          a -> error $ "BuiltInFunction 'high' in initExpr: " ++ show a ++ ": " ++ show hi
   712 initExpr2C' (BuiltInFunction "succ" [BuiltInFunction "pred" [e]]) = initExpr2C' e
   712 initExpr2C' (BuiltInFunction "succ" [BuiltInFunction "pred" [e]]) = initExpr2C' e
   713 initExpr2C' (BuiltInFunction "pred" [BuiltInFunction "succ" [e]]) = initExpr2C' e
   713 initExpr2C' (BuiltInFunction "pred" [BuiltInFunction "succ" [e]]) = initExpr2C' e
   714 initExpr2C' (BuiltInFunction "succ" [e]) = liftM (<> text " + 1") $ initExpr2C' e
   714 initExpr2C' (BuiltInFunction "succ" [e]) = liftM (\e' ->  text "(" <> e' <> text " + 1)") $ initExpr2C' e
   715 initExpr2C' (BuiltInFunction "pred" [e]) = liftM (<> text " - 1") $ initExpr2C' e
   715 initExpr2C' (BuiltInFunction "pred" [e]) = liftM (\e' ->  text "(" <> e' <> text " - 1)") $ initExpr2C' e
   716 initExpr2C' b@(BuiltInFunction _ _) = error $ show b
   716 initExpr2C' b@(BuiltInFunction _ _) = error $ show b
   717 initExpr2C' (InitTypeCast t' i) = do
   717 initExpr2C' (InitTypeCast t' i) = do
   718     e <- initExpr2C i
   718     e <- initExpr2C i
   719     t <- id2C IOLookup t'
   719     t <- id2C IOLookup t'
   720     return . parens $ parens t <> e
   720     return . parens $ parens t <> e