diff --git a/PBot/VERSION.pm b/PBot/VERSION.pm index 35f7e000..19ecd8b7 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 => 683, + BUILD_REVISION => 684, BUILD_DATE => "2014-06-28", }; diff --git a/modules/c2english.pl b/modules/c2english.pl index 4adbe12f..d7831e4d 100755 --- a/modules/c2english.pl +++ b/modules/c2english.pl @@ -404,11 +404,6 @@ if(not $output) { $output = "Does not compute; I only understand valid C89 code.\n"; } -# beautification -$output =~ s/the value the expression/the value of the expression/g; -$output =~ s/the value the member/the value of the member/g; -$output =~ s/the value the/the/g; - print "$output\n"; sub execute { diff --git a/modules/c2english/c2eng.pl b/modules/c2english/c2eng.pl index 8a7280cc..7675c19d 100755 --- a/modules/c2english/c2eng.pl +++ b/modules/c2english/c2eng.pl @@ -69,7 +69,22 @@ foreach my $arg (@ARGV) { if(length $text) { print "Bad parse at: $text"; } else { - print join('', flatten($result)); + my $output = join('', flatten($result)); + + # beautification + my @quotes; + $output =~ s/(?:\"((?:\\\"|(?!\").)*)\")/push @quotes, $1; '"' . ('-' x length $1) . '"'/ge; + + $output =~ s/the value the expression/the value of the expression/g; + $output =~ s/the value the member/the value of the member/g; + $output =~ s/the value the/the/g; + $output =~ s/of evaluate/of/g; + + foreach my $quote (@quotes) { + $output =~ s/"-*"/"$quote"/; + } + + print $output; } }