3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-26 22:09:26 +01:00

CGrammar: Progress on C11 features -- added compound-literals

This commit is contained in:
Pragmatic Software 2014-07-01 18:57:02 +00:00
parent 34def4f9ad
commit 73967e0721
3 changed files with 8 additions and 2 deletions

View File

@ -13,7 +13,7 @@ use warnings;
# These are set automatically by the build/commit script
use constant {
BUILD_NAME => "PBot",
BUILD_REVISION => 689,
BUILD_REVISION => 690,
BUILD_DATE => "2014-07-01",
};

View File

@ -1080,6 +1080,12 @@ postfix_expression:
$return = undef;
}
}
| '(' type_name ')' '{' initializer_list '}' postfix_productions[context => "$arg{context}|compound literal"](?)
{
my $postfix = $item[-1]->[0];
$return = "A compound-literal of type $item{type_name} initialized to the set { $item{initializer_list} }";
$return = "$postfix $return" if $postfix;
}
postfix_suffix:
'[' expression ']'
@ -1517,7 +1523,6 @@ enum_specifier:
| 'enum' identifier
{ $return = "an enumeration of type $item{identifier}"; }
enumerator_list:
<leftop:enumerator ',' enumerator>

View File

@ -81,6 +81,7 @@ foreach my $arg (@ARGV) {
$output =~ s/of evaluate/of/g;
$output =~ s/the evaluate the/the/g;
$output =~ s/by evaluate the/by the/g;
$output =~ s/the a/the/g;
foreach my $quote (@quotes) {
next unless $quote;