#!/usr/bin/perl -w
#-- FILE:   nospace
#-- (C)opyright 2001 KUBO Takuya (kubo@ees.hokudai.ac.jp).
#--    All rights are reserved.
#--    Do not modify without amending copyright,
#--    distribute freely but retain this paragraph.
#-- CHANGE: Mon Nov 19 12:30:25 2001

use strict;
while (my $file = shift @ARGV) {
	open IN, $file or die "ERROR: Cannnot open $file";
	my @buffer;
	while (<IN>) {
		s/([\(\{])( )/$1/go; # "( ", "{ " -> "(", "{"
		s/( )([\)\}])/$2/go; # " )", " }" -> ")", "}"
		push @buffer, $_;
	}
	close IN;
	open OUT, ">$file" or die "ERROR: Cannnot open $file";
	warn "# nospacing $file ...\n";
	foreach (@buffer) {
		print OUT;
	}
	close OUT;
}
exit 0;
