(
# 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;"),
(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)[^=;]*;", ""),
),
# 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*", ""),
),
)