3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-10-01 17:16:39 +02:00

CGrammar: Concatenate adjacent string literals

This commit is contained in:
Pragmatic Software 2014-07-11 11:30:05 +00:00
parent 69eca9a336
commit b2114ca03f
2 changed files with 16 additions and 3 deletions

View File

@ -13,8 +13,8 @@ use warnings;
# These are set automatically by the build/commit script # These are set automatically by the build/commit script
use constant { use constant {
BUILD_NAME => "PBot", BUILD_NAME => "PBot",
BUILD_REVISION => 727, BUILD_REVISION => 728,
BUILD_DATE => "2014-07-10", BUILD_DATE => "2014-07-11",
}; };
1; 1;

View File

@ -1847,7 +1847,20 @@ identifier_word:
{ $return = "`$item[-1]`"; } { $return = "`$item[-1]`"; }
string: 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: reserved:
/(auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto /(auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto