r'\s*#include.*',r'#\s*line.*',
# Common error macros.
r'\bEFAULT\b', r'\bEINVAL\b', r'\bENOSYS\b',
- # Punctuation
+ # Punctuation and whitespace
r'\{', r'\}', r'\(', r'\)', r'\<', r'\>', r'\[', r'\]',
r'\^', '&', r'\|', r'\*', r'\?', r'\.', r'\+',
'\\\n', ';', ':', '%', ',', '-', '/', '=', '!', '\n','\t', '\v'
)),
"shell": map(re.compile, (
# Idioms that don't convey any meaning in isolation
- r"exit *\([01]\);",
+ r"exit *[01];?",
# Bare shell keywords
- "\bcase\b", "\bdone\b", "\bdo\b", "\belse\b", "\besac\b",
- "\bfi\b", "\bif\b", "\bwhile\b",
+ r"\bcase\b", r"\bdone\b", r"\bdo\b", r"\belse\b", r"\besac\b",
+ r"\bfi\b", r"\bif\b", r"\bwhile\b",
# Blank comment
"^#\n",
+ # Ounctuation and whitespace
+ ':', '\n','\t', '\v'
)),
}
if savecopy == text:
break
else:
- text = text.strip()
if debug:
print "Reduced:", `text`
continue