mirror of
https://github.com/pragma-/pbot.git
synced 2024-12-25 04:02:37 +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
|
# These are set automatically by the build/commit script
|
||||||
use constant {
|
use constant {
|
||||||
BUILD_NAME => "PBot",
|
BUILD_NAME => "PBot",
|
||||||
BUILD_REVISION => 719,
|
BUILD_REVISION => 720,
|
||||||
BUILD_DATE => "2014-07-07",
|
BUILD_DATE => "2014-07-07",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -681,14 +681,12 @@ declaration:
|
|||||||
|
|
||||||
my @identifiers = ($first_identifier) unless not length $first_identifier;
|
my @identifiers = ($first_identifier) unless not length $first_identifier;
|
||||||
|
|
||||||
my $sep = '';
|
|
||||||
foreach my $arg (@args) {
|
foreach my $arg (@args) {
|
||||||
if ($arg =~ /initialized/) {
|
if ($arg =~ /initialized/) {
|
||||||
$first_initializer .= "$sep$arg";
|
$first_initializer .= (length $first_initializer ? ' ' : '') . $arg;
|
||||||
} else {
|
} else {
|
||||||
$first_qualifier .= "$sep$arg";
|
$first_qualifier .= (length $first_qualifier ? ' ' : '') . $arg;
|
||||||
}
|
}
|
||||||
$sep = ' ';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
my @initializers;
|
my @initializers;
|
||||||
@ -702,14 +700,12 @@ declaration:
|
|||||||
my ($qualifier, $initializer);
|
my ($qualifier, $initializer);
|
||||||
my $identifier = shift @args;
|
my $identifier = shift @args;
|
||||||
|
|
||||||
my $sep = '';
|
|
||||||
foreach my $arg (@args) {
|
foreach my $arg (@args) {
|
||||||
if ($arg =~ /initialized/) {
|
if ($arg =~ /initialized/) {
|
||||||
$initializer .= "$sep$arg";
|
$initializer .= (length $initializer ? ' ' : '') . $arg;
|
||||||
} else {
|
} else {
|
||||||
$qualifier .= "$sep$arg";
|
$qualifier .= (length $qualifier ? ' ' : '') . $arg;
|
||||||
}
|
}
|
||||||
$sep = ' ';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
next unless $qualifier eq $first_qualifier;
|
next unless $qualifier eq $first_qualifier;
|
||||||
@ -817,7 +813,7 @@ declaration:
|
|||||||
$comma = ', ';
|
$comma = ', ';
|
||||||
$and = ' and ';
|
$and = ' and ';
|
||||||
} else {
|
} else {
|
||||||
$initializer =~ s/^\s*initialized to \^L//;
|
$initializer =~ s/^initialized to \^L//;
|
||||||
$return .= "$and$identifier to $initializer";
|
$return .= "$and$identifier to $initializer";
|
||||||
if ($i < @initializers - 2) {
|
if ($i < @initializers - 2) {
|
||||||
$and = $comma = ', ';
|
$and = $comma = ', ';
|
||||||
@ -1611,7 +1607,8 @@ atomic_type_specifier:
|
|||||||
{ $return = "atomic $item{type_name}"; }
|
{ $return = "atomic $item{type_name}"; }
|
||||||
|
|
||||||
type_specifier:
|
type_specifier:
|
||||||
<skip:''> /\s*/ ('void' | 'double' | 'float' | 'char' | 'short' | 'int' | 'long'
|
<skip:''> /\s*/
|
||||||
|
(typedef_name | 'void' | 'double' | 'float' | 'char' | 'short' | 'int' | 'long'
|
||||||
| 'signed' | 'unsigned'
|
| 'signed' | 'unsigned'
|
||||||
| 'FILE' | 'fpos_t'
|
| 'FILE' | 'fpos_t'
|
||||||
| 'bool' | '_Bool'
|
| 'bool' | '_Bool'
|
||||||
@ -1635,7 +1632,7 @@ type_specifier:
|
|||||||
| <skip:'[\s]*'> struct_or_union_specifier
|
| <skip:'[\s]*'> struct_or_union_specifier
|
||||||
| <skip:'[\s]*'> enum_specifier
|
| <skip:'[\s]*'> enum_specifier
|
||||||
| <skip:'[\s]*'> atomic_type_specifier
|
| <skip:'[\s]*'> atomic_type_specifier
|
||||||
| typedef_name) .../\W/
|
) .../\W/
|
||||||
{ $return = $item[3]; }
|
{ $return = $item[3]; }
|
||||||
|
|
||||||
typedef_name:
|
typedef_name:
|
||||||
|
Loading…
Reference in New Issue
Block a user