From: Eric S. Raymond Date: Fri, 29 Sep 2006 03:50:34 +0000 (+0000) Subject: We now text and insert some needed line continuations. X-Git-Tag: 1.0~55 X-Git-Url: http://thyrsus.com/gitweb/?a=commitdiff_plain;h=bb7a59b85c50c71a96ef29bde52fa6d0c9ebea00;p=ctopy.git We now text and insert some needed line continuations. --- diff --git a/ctopy b/ctopy index 65b9997..98db347 100755 --- a/ctopy +++ b/ctopy @@ -20,7 +20,6 @@ Limitations: a loop variable, but not the more complex ones. * Doesn't even attempt to translate switch/case or do/while. * Doesn't attempt to translate ternary operator. - * Won't put Python line continuations in multiline conditionals. * C comma expressions will spuriously turn into Python tuuple constructors, * We don't translate frexp and modf because their call conventions differ between Python and C, so we want them to throw an error. @@ -87,6 +86,7 @@ unsafe_transformations = ( (r" *\|\| *", r" or "), (r"-\>", "."), (r"!(?!=) *", "not "), + (r"(and|or) *\n", r"\1 \\\n"), # increment and decrement statements (r"(%(id)s)\+\+([;\n])", r"\1 += 1\2"), (r"(%(id)s)--([;\n])", r"\1 -= 1\2"),