From e7f4729567a232d4823d564f1fb40c3b502ca692 Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Sun, 1 May 2022 10:30:34 -0700 Subject: [PATCH] pbot-vm: rebuild without print_last_statement() if "cannot subscript something" error --- applets/pbot-vm/guest/lib/Languages/_c_base.pm | 9 ++++++++- lib/PBot/VERSION.pm | 4 ++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/applets/pbot-vm/guest/lib/Languages/_c_base.pm b/applets/pbot-vm/guest/lib/Languages/_c_base.pm index aa35a7e6..db68c2fa 100755 --- a/applets/pbot-vm/guest/lib/Languages/_c_base.pm +++ b/applets/pbot-vm/guest/lib/Languages/_c_base.pm @@ -112,7 +112,14 @@ sub postprocess { 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/ || $result =~ m/has unknown return type; cast the call to its declared return/ || $result =~ m/Can't take address of.*which isn't an lvalue/)) { + && ( + # should move this into its own function with a list + $result =~ m/A syntax error in expression/ + || $result =~ m/No symbol.*in current context/ + || $result =~ m/has unknown return type; cast the call to its declared return/ + || $result =~ m/Can't take address of.*which isn't an lvalue/ + || $result =~ m/cannot subscript something/ + )) { # strip print_last_statement and rebuild/re-run $self->{code} =~ s/print_last_statement\((.*)\);/$1;/mg; $self->preprocess; diff --git a/lib/PBot/VERSION.pm b/lib/PBot/VERSION.pm index 6cd3568d..c97be039 100644 --- a/lib/PBot/VERSION.pm +++ b/lib/PBot/VERSION.pm @@ -25,8 +25,8 @@ use PBot::Imports; # These are set by the /misc/update_version script use constant { BUILD_NAME => "PBot", - BUILD_REVISION => 4533, - BUILD_DATE => "2022-04-08", + BUILD_REVISION => 4534, + BUILD_DATE => "2022-05-01", }; sub initialize {}