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

compiler_vm improvements

Server-side C base now strips print_last_statement() and rebuilds/re-runs code
if there was any bad gdb output related to it (i.e. "No such symbol" or "A
syntax error in expression").
This commit is contained in:
Pragmatic Software 2015-09-17 22:18:14 -07:00
parent 76fc3a33a1
commit ef3b8f0fbc

View File

@ -41,9 +41,17 @@ sub postprocess {
$result =~ s/\s+$//;
$self->{no_output} = 1 if not length $result;
if (not length $result) {
$self->{no_output} = 1;
} elsif ($self->{code} =~ m/print_last_statement\(.*\);$/m
&& ($result =~ m/A syntax error in expression/ || $result =~ m/No symbol.*in current context/)) {
# strip print_last_statement and rebuild/re-run
$self->{code} =~ s/print_last_statement\((.*)\);/$1;/mg;
$self->preprocess;
$self->postprocess;
} else {
$self->{output} .= $result;
}
}
1;