# externs can just disappear -- this may discard a following comment
(r"extern[^;]+;.*\n", r""),
# macros
- (r"#define\s+(%(id)s)\s+(.*)[ \t]*\n", r"\1\t= \2\n"),
- (r"#define\s+(%(id)s)\(([^)]*)\)\s+(.*\))[ \t]*\n", r"def \1(\2):\treturn \3\n"),
- (r"#define\s+(%(id)s)\(([^)]*)\)\s+([^(].*)[ \t]*\n", r"def \1(\2):\t\3\n"),
+ (r"#define\s+(%(id)s)\s+(.*)[ \t]*(?=\n|$)", r"\1\t= \2"),
+ (r"#define\s+(%(id)s)\(([^)]*)\)\s+(.*\))[ \t]*(?=\n|$)", r"def \1(\2):\treturn \3"),
+ (r"#define\s+(%(id)s)\(([^)]*)\)\s+([^(].*)[ \t]*(?=\n|$)", r"def \1(\2):\t\3"),
# function headers
(r"(?:^|\n)(?:static\s+)?(?:%(type)s) +(.*\)) *\n", r"\ndef \1:\n"),
(r"\(void\):\n", r"():\n"),
boundaries.append(i+1)
state = "text"
boundaries.append(len(input))
- if boundaries[0] == 0:
- boundaries.pop(0)
+ if debug >= 2:
+ print "Boundaries:", boundaries
if debug:
print "Regexp transformation begins"
regions = []