mirror of
https://github.com/pragma-/pbot.git
synced 2024-12-23 19:22:40 +01:00
CGrammar: Support flexible array struct members; fix up minor whitespace issue
This commit is contained in:
parent
5b10d9769e
commit
520d1a2c9c
@ -13,7 +13,7 @@ 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 => 708,
|
BUILD_REVISION => 709,
|
||||||
BUILD_DATE => "2014-07-04",
|
BUILD_DATE => "2014-07-04",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -750,7 +750,7 @@ declaration:
|
|||||||
$first_qualifier =~ s/an array/arrays/;
|
$first_qualifier =~ s/an array/arrays/;
|
||||||
}
|
}
|
||||||
$return .= "$first_qualifier";
|
$return .= "$first_qualifier";
|
||||||
$return .= $item{declaration_specifiers} if $item{declaration_specifiers};
|
$return .= " $item{declaration_specifiers}" if $item{declaration_specifiers};
|
||||||
} else {
|
} else {
|
||||||
if (@identifiers == 1 and $item{declaration_specifiers} !~ /^(a|an)\s+/) {
|
if (@identifiers == 1 and $item{declaration_specifiers} !~ /^(a|an)\s+/) {
|
||||||
$return .= $item{declaration_specifiers} =~ m/^[aeiouy]/ ? 'an ' : 'a ';
|
$return .= $item{declaration_specifiers} =~ m/^[aeiouy]/ ? 'an ' : 'a ';
|
||||||
@ -837,7 +837,7 @@ init_declarator_list:
|
|||||||
<leftop: init_declarator ',' init_declarator>
|
<leftop: init_declarator ',' init_declarator>
|
||||||
|
|
||||||
init_declarator:
|
init_declarator:
|
||||||
declarator[context => 'init_declarator']
|
declarator[context => "$arg{context}|init_declarator"]
|
||||||
{
|
{
|
||||||
$return = $item{declarator};
|
$return = $item{declarator};
|
||||||
}
|
}
|
||||||
@ -1304,7 +1304,11 @@ array_declarator:
|
|||||||
$size = "$size elements";
|
$size = "$size elements";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$size = 'unspecified length';
|
if ($arg{context} =~ /struct member/) {
|
||||||
|
$size = 'flexible length';
|
||||||
|
} else {
|
||||||
|
$size = 'unspecified length';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
my $qualifiers = join('', @{$item{'array_qualifiers(?)'}});
|
my $qualifiers = join('', @{$item{'array_qualifiers(?)'}});
|
||||||
@ -1395,7 +1399,11 @@ parameter_declaration:
|
|||||||
|
|
||||||
abstract_declarator:
|
abstract_declarator:
|
||||||
pointer(?) direct_abstract_declarator(s)
|
pointer(?) direct_abstract_declarator(s)
|
||||||
{ $return = join(' ',@{$item{'pointer(?)'}}) . ' ' . join(' ', @{$item{'direct_abstract_declarator(s)'}}); }
|
{
|
||||||
|
my $pointer = join(' ', @{$item{'pointer(?)'}});
|
||||||
|
$return = "$pointer " if $pointer;
|
||||||
|
$return .= join(' ', @{$item{'direct_abstract_declarator(s)'}});
|
||||||
|
}
|
||||||
| pointer
|
| pointer
|
||||||
|
|
||||||
direct_abstract_declarator:
|
direct_abstract_declarator:
|
||||||
|
Loading…
Reference in New Issue
Block a user