mirror of
https://github.com/pragma-/pbot.git
synced 2024-12-23 19:22:40 +01:00
CGrammar: Improve handling of space seperator in declaration initializers; fix issue with typedefs starting with a type specifier
This commit is contained in:
parent
0c8078c6db
commit
029cc1ec7a
@ -13,7 +13,7 @@ use warnings;
|
||||
# These are set automatically by the build/commit script
|
||||
use constant {
|
||||
BUILD_NAME => "PBot",
|
||||
BUILD_REVISION => 719,
|
||||
BUILD_REVISION => 720,
|
||||
BUILD_DATE => "2014-07-07",
|
||||
};
|
||||
|
||||
|
@ -681,14 +681,12 @@ declaration:
|
||||
|
||||
my @identifiers = ($first_identifier) unless not length $first_identifier;
|
||||
|
||||
my $sep = '';
|
||||
foreach my $arg (@args) {
|
||||
if ($arg =~ /initialized/) {
|
||||
$first_initializer .= "$sep$arg";
|
||||
$first_initializer .= (length $first_initializer ? ' ' : '') . $arg;
|
||||
} else {
|
||||
$first_qualifier .= "$sep$arg";
|
||||
$first_qualifier .= (length $first_qualifier ? ' ' : '') . $arg;
|
||||
}
|
||||
$sep = ' ';
|
||||
}
|
||||
|
||||
my @initializers;
|
||||
@ -702,14 +700,12 @@ declaration:
|
||||
my ($qualifier, $initializer);
|
||||
my $identifier = shift @args;
|
||||
|
||||
my $sep = '';
|
||||
foreach my $arg (@args) {
|
||||
if ($arg =~ /initialized/) {
|
||||
$initializer .= "$sep$arg";
|
||||
$initializer .= (length $initializer ? ' ' : '') . $arg;
|
||||
} else {
|
||||
$qualifier .= "$sep$arg";
|
||||
$qualifier .= (length $qualifier ? ' ' : '') . $arg;
|
||||
}
|
||||
$sep = ' ';
|
||||
}
|
||||
|
||||
next unless $qualifier eq $first_qualifier;
|
||||
@ -817,7 +813,7 @@ declaration:
|
||||
$comma = ', ';
|
||||
$and = ' and ';
|
||||
} else {
|
||||
$initializer =~ s/^\s*initialized to \^L//;
|
||||
$initializer =~ s/^initialized to \^L//;
|
||||
$return .= "$and$identifier to $initializer";
|
||||
if ($i < @initializers - 2) {
|
||||
$and = $comma = ', ';
|
||||
@ -1611,7 +1607,8 @@ atomic_type_specifier:
|
||||
{ $return = "atomic $item{type_name}"; }
|
||||
|
||||
type_specifier:
|
||||
<skip:''> /\s*/ ('void' | 'double' | 'float' | 'char' | 'short' | 'int' | 'long'
|
||||
<skip:''> /\s*/
|
||||
(typedef_name | 'void' | 'double' | 'float' | 'char' | 'short' | 'int' | 'long'
|
||||
| 'signed' | 'unsigned'
|
||||
| 'FILE' | 'fpos_t'
|
||||
| 'bool' | '_Bool'
|
||||
@ -1635,7 +1632,7 @@ type_specifier:
|
||||
| <skip:'[\s]*'> struct_or_union_specifier
|
||||
| <skip:'[\s]*'> enum_specifier
|
||||
| <skip:'[\s]*'> atomic_type_specifier
|
||||
| typedef_name) .../\W/
|
||||
) .../\W/
|
||||
{ $return = $item[3]; }
|
||||
|
||||
typedef_name:
|
||||
|
Loading…
Reference in New Issue
Block a user