mirror of
https://github.com/pragma-/pbot.git
synced 2024-12-23 19:22:40 +01:00
CGrammar: Move output beautification to c2eng.pl; white-out string literals before beautifying
This commit is contained in:
parent
5730d56d54
commit
086d5059b1
@ -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",
|
||||
};
|
||||
|
||||
|
@ -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 {
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user