]> thyrsus.com Git - ctopy.git/commitdiff
This appears to get class processing right.
authorEric S. Raymond <esr@thyrsus.com>
Mon, 2 Oct 2006 10:48:21 +0000 (10:48 +0000)
committerEric S. Raymond <esr@thyrsus.com>
Mon, 2 Oct 2006 10:48:21 +0000 (10:48 +0000)
ctopy

diff --git a/ctopy b/ctopy
index 31c04f891b56f4c4820d0ceb7ba283a81d721487..185d123ed6c7c2e69742a54c4a379acca5763c8e 100755 (executable)
--- 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)[^=;]*;", ""),
     ),