diff --git a/modules/c2english/CGrammar.pm b/modules/c2english/CGrammar.pm index e08de595..eff0a9b6 100644 --- a/modules/c2english/CGrammar.pm +++ b/modules/c2english/CGrammar.pm @@ -622,7 +622,6 @@ logical_OR_AND_expression: log_OR_AND_bit_or_and_eq rel_add_mul_shift_expression[context => 'logical_OR_AND_expression']> { - if (defined $arg{context} and $arg{context} eq 'for conditional') { print STDERR "hmm2\n"; } my $expression = join('', @{$item[1]}); if($arg{context} =~ /initializer expression$/ and $expression =~ / / @@ -1924,12 +1923,13 @@ string: { my $final_string = ""; foreach my $string (@{$item[-1]}) { + my $modifier = ""; + $modifier = 'an UTF-8 string ' if $string =~ s/^u8//; + $modifier = 'a wide character string ' if $string =~ s/^L//; + $modifier = 'a 16-bit character string ' if $string =~ s/^u//; + $modifier = 'a 32-bit character string ' if $string =~ s/^U//; + if (not length $final_string) { - my $modifier = ""; - $modifier = 'an UTF-8 string ' if $string =~ s/^u8//; - $modifier = 'a wide character string ' if $string =~ s/^L//; - $modifier = 'a 16-bit character string ' if $string =~ s/^u//; - $modifier = 'a 32-bit character string ' if $string =~ s/^U//; $final_string = $modifier; $final_string .= '"'; } diff --git a/modules/c2english/c2eng.pl b/modules/c2english/c2eng.pl index 0ad294aa..8efec339 100755 --- a/modules/c2english/c2eng.pl +++ b/modules/c2english/c2eng.pl @@ -74,8 +74,10 @@ foreach my $arg (@ARGV) { $output =~ s/the a /the /g; $output =~ s/Then if it has the value/If it has the value/g; $output =~ s/result of the expression a generic-selection/result of a generic-selection/g; + $output =~ s/the result of the expression (an?) (16-bit character|32-bit character|wide character|UTF-8) string/$1 $2 string/gi; $output =~ s/the function a generic-selection/the function resulting from a generic-selection/g; $output =~ s/\.\s+Then exit switch block/ and then exit switch block/g; + $output =~ s/,\././g; foreach my $quote (@quotes) { next unless $quote;