Skip to content

Instantly share code, notes, and snippets.

@dajobe
Created January 5, 2010 07:07
Show Gist options
  • Save dajobe/269211 to your computer and use it in GitHub Desktop.
Save dajobe/269211 to your computer and use it in GitHub Desktop.
#!/usr/bin/perl -pi~
if(!/^\s+\*/) {
# Skip lex <TOKEN> lines
if(!/^</) {
# Put spaces around assignment and comparitor ops
s{([\w\)\]])([=<>]|==)([\w\(\[])}{$1 $2 $3}g;
s{(\S)([-+*/~|=]=)(\S)}{$1 $2 $3}g;
}
s{(if|while|for) \(}{$1\(}g;
s{if\(([^\)]+) == NULL\)}{if(!$1)};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment