3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-19 10:29:30 +01: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
use constant {
BUILD_NAME => "PBot",
BUILD_REVISION => 727,
BUILD_DATE => "2014-07-10",
BUILD_REVISION => 728,
BUILD_DATE => "2014-07-11",
};
1;

View File

@ -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