From 3e47f6bc58ff69b94e8e1b9a1c7c2811f8e3bec9 Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Fri, 18 Jul 2014 00:39:06 +0000 Subject: [PATCH] CGrammar: Emit "Do nothing" for empty case statements --- PBot/VERSION.pm | 2 +- modules/c2english/CGrammar.pm | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/PBot/VERSION.pm b/PBot/VERSION.pm index 47fa3767..13abf82c 100644 --- a/PBot/VERSION.pm +++ b/PBot/VERSION.pm @@ -13,7 +13,7 @@ use warnings; # These are set automatically by the build/commit script use constant { BUILD_NAME => "PBot", - BUILD_REVISION => 738, + BUILD_REVISION => 739, BUILD_DATE => "2014-07-17", }; diff --git a/modules/c2english/CGrammar.pm b/modules/c2english/CGrammar.pm index bbbc91ac..87ad2d7a 100644 --- a/modules/c2english/CGrammar.pm +++ b/modules/c2english/CGrammar.pm @@ -421,6 +421,8 @@ labeled_statement: my $statements = join('', @{$item[-1]}); if (length $statements and $statements !~ /Exit switch block\.\s*$/) { $statements .= "Fall through to the next case.\n"; + } elsif (not length $statements and not $last) { + $statements = "Do nothing.\n"; } $return = "If it has the value $item[-2], ^L$statements$last"; }