3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-12-23 19:22:40 +01:00

Correct handling of concatenated prefixed string literals

This commit is contained in:
Pragmatic Software 2015-02-22 23:58:03 -08:00
parent 6cf818419f
commit 06d6e0f0d4
2 changed files with 8 additions and 6 deletions

View File

@ -622,7 +622,6 @@ logical_OR_AND_expression:
log_OR_AND_bit_or_and_eq log_OR_AND_bit_or_and_eq
rel_add_mul_shift_expression[context => 'logical_OR_AND_expression']> 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]}); my $expression = join('', @{$item[1]});
if($arg{context} =~ /initializer expression$/ if($arg{context} =~ /initializer expression$/
and $expression =~ / / and $expression =~ / /
@ -1924,12 +1923,13 @@ string:
{ {
my $final_string = ""; my $final_string = "";
foreach my $string (@{$item[-1]}) { 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) { 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 = $modifier;
$final_string .= '"'; $final_string .= '"';
} }

View File

@ -74,8 +74,10 @@ foreach my $arg (@ARGV) {
$output =~ s/the a /the /g; $output =~ s/the a /the /g;
$output =~ s/Then if it has the value/If it has the value/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/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/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/\.\s+Then exit switch block/ and then exit switch block/g;
$output =~ s/,\././g;
foreach my $quote (@quotes) { foreach my $quote (@quotes) {
next unless $quote; next unless $quote;