From: Eric S. Raymond Date: Thu, 28 Sep 2006 20:31:55 +0000 (+0000) Subject: Also handles boxed comment in ai.c, but with simpler rules. X-Git-Tag: 1.0~62 X-Git-Url: http://thyrsus.com/gitweb/?a=commitdiff_plain;h=f0110698a71bf4774568c2fac92841c40cb5bfcf;p=ctopy.git Also handles boxed comment in ai.c, but with simpler rules. --- diff --git a/ctopy b/ctopy index 305beb4..841decf 100755 --- a/ctopy +++ b/ctopy @@ -169,9 +169,9 @@ def ctopy(input, debug=0): if regions[i].count("\n") <= 1: # winged comment regions[i] = "#" + regions[i][2:-2] elif re.search("/\*+\n", regions[i]): # boxed comment - regions[i] = re.sub(r"\n([ \t]*) \*", r"\n\1# ", regions[i]) - regions[i] = re.sub(r"^([ \t]*)/\*+", r"\1#", regions[i]) - regions[i] = re.sub(r"\n([ \t]*)\*+/$", r"\n\1#", regions[i]) + regions[i] = re.sub(r"\n([ \t]*) \*", r"\n\1 ", regions[i]) + regions[i] = re.sub(r"^([ \t]*)/\*+", r"\1", regions[i]) + regions[i] = re.sub(r"\n([ \t]*)\*+/$", r"\n\1", regions[i]) regions[i] = re.sub(r"\n([ \t]*)(?!#)", r"\n\1# ", regions[i]) else: regions[i] = regions[i].replace("/*", "#")