From: Eric S. Raymond Date: Mon, 2 Oct 2006 10:48:21 +0000 (+0000) Subject: This appears to get class processing right. X-Git-Tag: 1.0~42 X-Git-Url: http://thyrsus.com/gitweb/?a=commitdiff_plain;h=90bf14ab4339b07732ae02adf34c165fd09c58c4;p=ctopy.git This appears to get class processing right. --- diff --git a/ctopy b/ctopy index 31c04f8..185d123 100755 --- a/ctopy +++ b/ctopy @@ -52,18 +52,18 @@ repeat_transformations = ( ( # What we're doing here is trying to get rid of variable # declarations that don't have initializer parts. - # First, bare types between a comma and a trailing semicolon go away. - (r"(\n[ \t]*)((?:%(type)s).*)(,\s*%(id)s\s*);", r"\1\2;"), - # But bare classes between comma and semicolon get a following initializer - (r"(\n[ \t]*)(%(cls)s)(.*,\s)*(%(id)s)(\s*;)", r"\1\2\3\4 = \2()\5;"), - # Bare ids between commas in a declaration line go away. - (r"(\n[ \t]*(?:%(type)s)\s+.*,)(%(id)s),(.*);", r"\1\3"), - # But bare class names between commas get an initializer - (r"(\n[ \t]*)(%(cls)s)(\s+.*,)(%(id)s),(.*);", r"\1\2\3\4 =\2(),\5"), # Bare ids just after the type and before a comma or semi go away. (r"(\n[ \t]*(?:%(type)s))(\s*%(id)s)([;,])", r"\1\3"), # Bare ids after class names and before comma or semi get an initializer. (r"(\n[ \t]*)(%(cls)s)(\s*%(id)s)([;,])", r"\1\2\3 = \2()\4"), + # Bare types between a comma and a trailing semicolon go away. + (r"(\n[ \t]*)((?:%(type)s).*)(,\s*%(id)s\s*);", r"\1\2;"), + # But bare classes between comma and semicolon get a following initializer + (r"(\n[ \t]*)(%(cls)s)(.*,\s)*(%(id)s)(\s*;)", r"\1\2\3\4 = \2()\5"), + # Bare ids between commas in a declaration line go away. + (r"(\n[ \t]*(?:%(type)s)\s+.*)(,\s*%(id)s),(.*);", r"\1\3"), + # But bare class names between commas get an initializer + (r"(\n[ \t]*)(%(cls)s)(\s+.*,)(\s*%(id)s),(.*);", r"\1\2\3\4 = \2(),\5"), # Any declaration line not containing an initializer goes away. (r"\n[ \t]*(?:%(type)s|%(cls)s)[^=;]*;", ""), ),