3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-26 22:09:26 +01:00

Make extra semi-colon more identifible as to not replace inside for(;;) or other cases

This commit is contained in:
Pragmatic Software 2010-04-29 01:43:40 +00:00
parent 271839b71f
commit 0aeeedfaaa
2 changed files with 4 additions and 4 deletions

View File

@ -60,10 +60,10 @@ $code = $preludes{$lang} . $code;
if(($lang eq "C" or $lang eq "C++") and not $code =~ m/(int|void) main\s*\([^)]*\)\s*{/) {
my $prelude = '';
$prelude = "$1$2" if $code =~ s/^\s*(#.*)(#.*?[>\n])//s;
$code = "$prelude\n\nint main(int argc, char **argv) { $code ; return 0; }";
$code = "$prelude\n\nint main(int argc, char **argv) { $code;/**/ return 0; }";
$code =~ s/;\s*;\/\*\*\//;/g;
}
$code =~ s/;\s*;/;/g;
$code = pretty($code);
my %post = ( 'lang' => $lang, 'code' => $code, 'private' => 'True', 'run' => 'True', 'submit' => 'Submit' );

View File

@ -128,10 +128,10 @@ if(($languages{$lang}{'id'} == 1 or $languages{$lang}{'id'} == 11 or $languages{
my $prelude = '';
$prelude = "$1$2" if $code =~ s/^\s*(#.*)(#.*?[>\n])//s;
$code =~ s/^\s+//;
$code = "$prelude\n\nint main(int argc, char **argv) { $code; return 0;}\n";
$code = "$prelude\n\nint main(int argc, char **argv) { $code;/**/ return 0;}\n";
$code =~ s/;\s*;\/\*\*\//;/g;
}
$code =~ s/;\s*;/;/g;
$code = pretty($code);
$code =~ s/\\n/\n/g if $languages{$lang}{'id'} == 13 or $languages{$lang}{'id'} == 101;