From: Eric S. Raymond Date: Mon, 2 Oct 2006 02:00:47 +0000 (+0000) Subject: Another step towards correct class processing. X-Git-Tag: 1.0~43 X-Git-Url: http://thyrsus.com/gitweb/?a=commitdiff_plain;h=51f01aeab909398f49645320924f05ee817c41e4;p=ctopy.git Another step towards correct class processing. --- diff --git a/ctopy b/ctopy index 30ce147..31c04f8 100755 --- a/ctopy +++ b/ctopy @@ -52,7 +52,7 @@ repeat_transformations = ( ( # What we're doing here is trying to get rid of variable # declarations that don't have initializer parts. - # First, bare ids between a comma and a trailing semicolon go away. + # 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;"), @@ -60,10 +60,10 @@ repeat_transformations = ( (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 go away. - (r"(\n[ \t]*(?:%(type)s))(\s*%(id)s),(.*);", r"\1\3"), - # Bare class names after the type and before comma get an initializer. - (r"(\n[ \t]*)(%(cls)s)(\s*%(id)s),(.*);", r"\1\2\3 = \2(),\4"), + # 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"), # Any declaration line not containing an initializer goes away. (r"\n[ \t]*(?:%(type)s|%(cls)s)[^=;]*;", ""), ), @@ -80,7 +80,7 @@ repeat_transformations = ( # This will strip remaining type declarators out of formal parameter lists. # It will also remove types from the beginning of declaration lines. # Won't nuke casts because it looks for at least one following whitespace. - (r"(?:%(type)s|%(cls)s)\s\s*", ""), + (r"(?:%(type)s|%(cls)s)[\s;]\s*", ""), ), )