From b2114ca03fa375968ef8099066a53f2a13b1e754 Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Fri, 11 Jul 2014 11:30:05 +0000 Subject: [PATCH] CGrammar: Concatenate adjacent string literals --- PBot/VERSION.pm | 4 ++-- modules/c2english/CGrammar.pm | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/PBot/VERSION.pm b/PBot/VERSION.pm index f7daea1c..bbdf3862 100644 --- a/PBot/VERSION.pm +++ b/PBot/VERSION.pm @@ -13,8 +13,8 @@ use warnings; # These are set automatically by the build/commit script use constant { BUILD_NAME => "PBot", - BUILD_REVISION => 727, - BUILD_DATE => "2014-07-10", + BUILD_REVISION => 728, + BUILD_DATE => "2014-07-11", }; 1; diff --git a/modules/c2english/CGrammar.pm b/modules/c2english/CGrammar.pm index 3861c64d..a1110e1a 100644 --- a/modules/c2english/CGrammar.pm +++ b/modules/c2english/CGrammar.pm @@ -1847,7 +1847,20 @@ identifier_word: { $return = "`$item[-1]`"; } string: - /(?:\"(?:\\\"|(?!\").)*\")/ + (/(?:\"(?:\\\"|(?!\").)*\")/)(s) + { + if (@{$item[-1]} == 1) { + $return = @{$item[-1]}[0]; + } else { + $return = '"'; + foreach my $string (@{$item[-1]}) { + $string =~ s/^"//; + $string =~ s/"$//; + $return .= $string; + } + $return .= '"'; + } + } reserved: /(auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto