# HG changeset patch # User alfadur # Date 1663731365 -10800 # Node ID f8a3f204242dfc671f0c79e5be09df5733340e96 # Parent ccce86a05f31445ceb63efd8955a552b895f43c0 fix pred/succ conversion diff -r ccce86a05f31 -r f8a3f204242d tools/pas2c/Pas2C.hs --- a/tools/pas2c/Pas2C.hs Mon Sep 12 18:37:04 2022 -0400 +++ b/tools/pas2c/Pas2C.hs Wed Sep 21 06:36:05 2022 +0300 @@ -711,8 +711,8 @@ a -> error $ "BuiltInFunction 'high' in initExpr: " ++ show a ++ ": " ++ show hi initExpr2C' (BuiltInFunction "succ" [BuiltInFunction "pred" [e]]) = initExpr2C' e initExpr2C' (BuiltInFunction "pred" [BuiltInFunction "succ" [e]]) = initExpr2C' e -initExpr2C' (BuiltInFunction "succ" [e]) = liftM (<> text " + 1") $ initExpr2C' e -initExpr2C' (BuiltInFunction "pred" [e]) = liftM (<> text " - 1") $ initExpr2C' e +initExpr2C' (BuiltInFunction "succ" [e]) = liftM (\e' -> text "(" <> e' <> text " + 1)") $ initExpr2C' e +initExpr2C' (BuiltInFunction "pred" [e]) = liftM (\e' -> text "(" <> e' <> text " - 1)") $ initExpr2C' e initExpr2C' b@(BuiltInFunction _ _) = error $ show b initExpr2C' (InitTypeCast t' i) = do e <- initExpr2C i