expressions: make assign_expression() take an op argument
[smatch.git] / smatch_scripts / strip_whitespace.pl
blob6c00e523a774e315c635269fb7930c98139aa9e4
1 #!/usr/bin/perl
3 use strict;
5 my $file = shift();
6 open FILE, "<$file";
7 my $txt = do { local $/; <FILE> };
9 # strip C99 comments
10 $txt =~ s/\/\/.*//g;
11 # strip newlines
12 $txt =~ s/\n//g;
13 # strip remaining comments
14 $txt =~ s/\/\*.*?\*\///g;
15 # strip tabs
16 $txt =~ s/\t//g;
17 # strip spaces
18 $txt =~ s/ //g;
19 # add newlines
20 $txt =~ s/;/;\n/g;
21 $txt =~ s/{/{\n/g;
22 $txt =~ s/}/}\n/g;
24 print "$txt\n";