# HG changeset patch # User sheepluva # Date 1418839353 -3600 # Node ID 9459c45b519027e8b919d2cde348ca194b4bf125 # Parent 2e921409b5b1e9aeb65436920a694b3b8dee95d3 dark magic: make "continue" statement work in pas2c-parsed for-loops. (would skip iteration and lead to infinite loops before) diff -r 2e921409b5b1 -r 9459c45b5190 tools/pas2c/Pas2C.hs --- a/tools/pas2c/Pas2C.hs Wed Dec 17 14:56:14 2014 +0100 +++ b/tools/pas2c/Pas2C.hs Wed Dec 17 19:02:33 2014 +0100 @@ -909,17 +909,15 @@ iType <- gets lastIdTypeDecl e1 <- expr2C e1' e2 <- expr2C e2' - let inc = if up then "inc" else "dec" - let add = if up then "+ 1" else "- 1" let iEnd = i <> text "__end__" - ph <- phrase2C . appendPhrase (BuiltInFunctionCall [Reference $ SimpleReference i'] (SimpleReference (Identifier inc BTUnknown))) $ wrapPhrase p + ph <- phrase2C $ wrapPhrase p return . braces $ i <+> text "=" <+> e1 <> semi $$ iType <+> iEnd <+> text "=" <+> e2 <> semi $$ text "if" <+> (parens $ i <+> text (if up then "<=" else ">=") <+> iEnd) <+> text "do" <+> ph <+> - text "while" <> parens (i <+> text "!=" <+> iEnd <+> text add) <> semi + text "while" <> parens (i <> text (if up then "++" else "--") <+> text "!=" <+> iEnd) <> semi where appendPhrase p (Phrases ps) = Phrases $ ps ++ [p] appendPhrase _ _ = error "illegal appendPhrase call"